Jump to content

Walk back to area if out of range?


Satire
 Share

Recommended Posts

So I was thinking about doing if(!area.contains(myplayer()) it'll walk back to the area. 

For some random reason, banking works fine but when I play my script at a bank with a full inv of food, when the check should be true, it just stays there on waiting....

 

Let's say I finished a task that is in lumby and my fighting area was in edgeville or varrock, after the task is complete, it should walk back to where it was fighting. 

Also how would I use webwalking without getting

 

[ERROR][bot #1][12/07 10:59:49 PM]: Error in script executor!
java.lang.NullPointerException
at main.Banking(main.java:108)
at main.onLoop(main.java:370)
at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(qh:103)
at java.lang.Thread.run(Unknown Source)
 
 
This only happens when it keeps spamming the webwalker. It says "your destination is complete" , opens the bank then spams that error. I think it's because I have a state called WALKING and it keeps spamming the webwalker. I thought the webwalker is a whole function that walks to the area then stops then continues running down the lines and completeing the task.  For example 

getWalking().webWalk(banks);
if(!getBank().open()){
getBank().open();
sleep(2500);
getBank().depositAll();
}
getWalking().webWalk(trainingarea);

Works like a charm but when I do this

my check

if(inventoryisfull && playerisnotinarea){
return State.WALKING;
--------------------------------------------------------
//when case = walking
if(selectedArea.equals("Edgeville Rats")){
getWalking().walk(new Position(3237,9866,0));

then it calls 

 

walkToDArea();

 

which basically walks to an area which contains string of x so I think the 2 webwalking instances are clashing on another or something. I can tell that everything works without webwalking (cause I've tested it). It's only when webwalking is called, this happens.

 

 

EDIT: Seems like WalkToDArea is the cause of those errors. I will re-write it and hopefully it'll work....

EDIT2: Seems to be happening when banking is called. No idea what's wrong with that, as banking was working yesterday!

EDIT3: SOLVED!

Edited by lol0
Link to comment
Share on other sites

I would add in a public enum State, and add in WALK_TO_BANK, WALK_TO_WHATEVER..

	public int onLoop() throws InterruptedException {
		log("Loop");
		currentState = getState();
		switch (currentState) {
		case WALK_TO_BANK:
			getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
			break;

^^ I use that for a basic woodcuting scripts, work perfectly..

Link to comment
Share on other sites

I would add in a public enum State, and add in WALK_TO_BANK, WALK_TO_WHATEVER..

	public int onLoop() throws InterruptedException {
		log("Loop");
		currentState = getState();
		switch (currentState) {
		case WALK_TO_BANK:
			getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
			break;

^^ I use that for a basic woodcuting scripts, work perfectly..

 

That won't work without very detailed arguments. Let's say I started the script with a full inventory of food or let's say I finished buying an item from GE, it doesn't want to walk back to the designated area. Ontop of that, something is causing my web walking to go null....

 

Here is my Walktoarea

private void walkToDArea(){
if(selectedArea.equals("Edgeville Rats")){
getWalking().walk(new Position(3237,9866,0));

}else if(selectedArea.equals("Chickens")){
getWalking().webWalk( new Position(3189,3278,0));
}

It should walk  back but it doesn't....  It throws me an error or just stands and says waiting.

It gets called when the state is Walking (if inv is full of food)

Edited by lol0
Link to comment
Share on other sites

getWalking().webWalk(banks);
if(!getBank().open()){
getBank().open();
sleep(2500);
getBank().depositAll();
}
getWalking().webWalk(trainingarea);

Why are you not checking if inventory is full before depositing? 

Also, you aren't checking before you walk back to the training area. 

If you fail to open the bank, it will just start walking back to the trainingarea.

Make sure to check every single action you do incase you fail.

Link to comment
Share on other sites

getWalking().webWalk(banks);
if(!getBank().open()){
getBank().open();
sleep(2500);
getBank().depositAll();
}
getWalking().webWalk(trainingarea);

Why are you not checking if inventory is full before depositing? 

Also, you aren't checking before you walk back to the training area. 

If you fail to open the bank, it will just start walking back to the trainingarea.

Make sure to check every single action you do incase you fail.

 

I have a check before hand for the inventory.  But I see what you mean for that second check. I've added that in. But it doesn't matter because I still get the errors for whatever reason... 

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.

 Share

  • Recently Browsing   0 members

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