I got this code that teleports me to GE... The teleporting works fine but when I arrive at the GE it keeps teleporting until I run out of charges. Shouldn't the "if" statement only work if my player ISN'T inside the geArea? I know I can fix this by just adding more code after my character teleports... but that makes me wonder if "if" statements are even necessary or do they even work?
I don't know much about Java but it seems like the script just ignores all of the "if" statements and executes all methods from top to bottom.
Code:
case TELEPORT:
Area geArea = new Area(3165, 3480, 3161, 3476); //area of all possible squares in GE that you can get teleported to.
Position current2 = myPlayer().getPosition();
log("STARTING");
if (!geArea.contains(myPlayer()));{
getEquipment().interact(EquipmentSlot.RING, "Grand exchange");
log("teleporting");
new ConditionalSleep(5000) {
@Override
public boolean condition() {
return !myPlayer().getPosition().equals(current2);
}
}.sleep();
}
sleep(random(500, 600));
break;