I'm working on my first script, a wine of zamorak grabber. Whenever the wine spawns, it calls this block of code:
GroundItem wine = groundItems.closest("Wine of zamorak");
if(wine != null){
magic.castSpellOnEntity(Spells.NormalSpells.TELEKINETIC_GRAB, wine);
sleep(random(400,600));
}
Whenever a wine spawns, however, it first tries to click underneath the table and then clicks the wine in the second run-through. How can I fix this?
I also have trouble when trying to walk from the bank to the temple. Whenever the program decides that the user is not in the temple and does not have a full inventory, it calls:
Position[] pathToWine = {
new Position(2954,3378,0),
new Position(2965,3389,0),
new Position(2962,3404,0),
new Position(2955,3417,0),
new Position(2949,3431,0),
new Position(2947,3447,0),
new Position(2945,3461,0),
new Position(2942,3477,0),
new Position(2940,3493,0),
new Position(2941,3508,0),
new Position(2931,3515,0)
};
localWalker.walkPath(pathToWine);
The walker, however, only manages to get to one of the positions then clicks at its feet once before stopping. What am I doing wrong?
Thank you,
BTheBrave