Now when I used a System.out.println(INHN); in-game it prints out item.chaosShield.
I already have tried placing the if ("chaosShield" == INHN) with if ("item.chaosShield" == INHN), however either way I get no System.out.println(asgardShieldBlockChance).
Am I using the String wrong and what do I have to do to use Strings for my If statements @_@
Now when I used a System.out.println(INHN); in-game it prints out item.chaosShield.
I already have tried placing the if ("chaosShield" == INHN) with if ("item.chaosShield" == INHN), however either way I get no System.out.println(asgardShieldBlockChance).
Am I using the String wrong and what do I have to do to use Strings for my If statements @_@
Its ok :D, now you learnt something new too Just don't forget to delete your System.out's when your done with them XD
No one likes their cmd prompt spammed.
Its ok , now you learnt something new too Just don't forget to delete your System.out's when your done with them XD
No one likes their cmd prompt spammed.
True that and I'll try out you mod when I get the chance
Now when I used a System.out.println(INHN); in-game it prints out item.chaosShield.
I already have tried placing the if ("chaosShield" == INHN) with if ("item.chaosShield" == INHN), however either way I get no System.out.println(asgardShieldBlockChance).
Am I using the String wrong and what do I have to do to use Strings for my If statements @_@
<---- Feels like a noobie D:
Your problem is that you cannot compare Strings with the == sign. This operator only checks if the OBJECT is equal to the other object, not the contents of the String.
Use String's equals() method, overridden from Object. It compares the VALUES of the Strings.
“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.”
- Linus Torvalds (Finnish American, software engineer and hacker, principal force behind the development of the Linux kernel)
My code:
Now when I used a System.out.println(INHN); in-game it prints out item.chaosShield.
I already have tried placing the if ("chaosShield" == INHN) with if ("item.chaosShield" == INHN), however either way I get no System.out.println(asgardShieldBlockChance).
Am I using the String wrong and what do I have to do to use Strings for my If statements @_@
<---- Feels like a noobie D:
Well you messed up on the println it should be
System.out.println("asgardSheildBlockChance");
Hope that helped, btw you forgot quotation marks
Honestly my problem comes for not getting the INHN name correctly in my IF statement? @_@
oh... sorry... i'm sorta new to java and I always use "" marks for the lines, but idk then, sorry
No one likes their cmd prompt spammed.
True that and I'll try out you mod when I get the chance
Your problem is that you cannot compare Strings with the == sign. This operator only checks if the OBJECT is equal to the other object, not the contents of the String.
Use String's equals() method, overridden from Object. It compares the VALUES of the Strings.
The print statement will now execute.
- Linus Torvalds (Finnish American, software engineer and hacker, principal force behind the development of the Linux kernel)