Jump to content
Trivial

Walking to a single tile not doing anything (localWalker)

Recommended Posts

In my hunting script, I check if a box trap is in an area that is 1x1, and if not, make the player walk to that using the localWalker, but it doesnt seem to do anything even though I tried both localWalker.walk(the 1x1 area) and localWalker.walk(x & y for the tile). What could be the problem? Heres some of the code:

if((normalTrap != null) && !spot1.contains(normalTrap)){
	return State.TRAP1;
}
case TRAP1:
	log("Starting trap1");
	if(spot1.contains(myPlayer())){
		inventory.interact("Lay", TRAP_ITEM_ID);
		trapsDown ++;
		sleep(random(1000,1500));
	} else {
		log("Walking to spot1");
		localWalker.walk(spot1, true); //or tile x & y
	}
	break;
Link to comment
Share on other sites

if (!spot1.contains(myPlayer())) { //if you're not standing in the hunting area

log("Returning to Hunting Area");

localWalker.walk(spot1.getRandomPosition(0)); //Walks into hunting area

}

Also, reset your count,then add one to trap count if trap1 is the first trap you're placing. Just Incase of DCs and what not.

If(box==null&&!box.exist())//don't quote me on the exist part

return state.Trap1;

case trap1:

Inventory.interact(xxxxxxx)

Trapcount == 0;

Trapcount++;

Link to comment
Share on other sites

Still not working. Everything else works except for the walking part.

I also tried a custom path walking method and giving it the tile its supposed to walk to, but still it does absolutely nothing.

Heres the area its supposed to walk to:

final Area spot1 = new Area(2503, 2881, 2503, 2881);
localWalker.walk(spot1.getRandomPosition(0));

This doesnt work either:

private Position spot1Pos = new Position(2503, 2881, 0);
localWalker.walk(spot1Pos);
Edited by Damighty
Link to comment
Share on other sites

The code should work, you must have got something else wrong.

 

  1. Are you sure the script is getting to that line when it's supposed to? check this but putting a log before it in an attempt to debug it
  2. Are you trying to walk to a position which is off the minimap / that kind of distance away? In which case you're probably better off using the localWalker.walkPath(Position[] path) method as this client doesn't currently have webwalking (still! x))
  3. I needed a third point to justify bullet points so  there we go

Apa

Link to comment
Share on other sites

The code should work, you must have got something else wrong.

 

  1. Are you sure the script is getting to that line when it's supposed to? check this but putting a log before it in an attempt to debug it
  2. Are you trying to walk to a position which is off the minimap / that kind of distance away? In which case you're probably better off using the localWalker.walkPath(Position[] path) method as this client doesn't currently have webwalking (still! x))
  3. I needed a third point to justify bullet points so  there we go

Apa

 

The code did get executed, but for some reason it just didnt want to walk to that tile.

Im using Pandemic's walking method now and its working, but theres another problem which is that I dont know

how to make the bot click a tile on the screen instead of clicking the minimap. Heres the method:

public boolean walkTile(Position p) throws InterruptedException {
	    mouse.click(new MiniMapTileDestination(bot, p), false);
	    int fail = 0;
	    while (myPosition().distance(p) > 2 && fail < 10) {
	        sleep(500);
	        if (!myPlayer().isMoving())
	            fail++;
	    }
	    return fail != 10;
	}

The point is to move to an exact 1-tile accurate position to place a trap on that particular tile, but sometimes that method gets stuck trying to spam click the minimap because I'm right next to the tile it should be clicking on.

Link to comment
Share on other sites

The code did get executed, but for some reason it just didnt want to walk to that tile.

Im using Pandemic's walking method now and its working, but theres another problem which is that I dont know

how to make the bot click a tile on the screen instead of clicking the minimap. Heres the method:

public boolean walkTile(Position p) throws InterruptedException {
	    mouse.click(new MiniMapTileDestination(bot, p), false);
	    int fail = 0;
	    while (myPosition().distance(p) > 2 && fail < 10) {
	        sleep(500);
	        if (!myPlayer().isMoving())
	            fail++;
	    }
	    return fail != 10;
	}

The point is to move to an exact 1-tile accurate position to place a trap on that particular tile, but sometimes that method gets stuck trying to spam click the minimap because I'm right next to the tile it should be clicking on.

if (map.distance(position) <= 5)
position.interact("Walk here");
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...