Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script not doing anything after webwalk, or until paused / resumed

Featured Replies

Hi all,

I'm working on a script.

There are no errors in my script and no error messages appear, This is not the first script I have made and I like to believe I have a decent amount of scripting knowledge. 

For some reason, the script just likes to sit still after having webwalked to the bank / field. Not doing anything, not logging anything even though I have a log messages troughout my whole script, also in the beginning of the onloop and before calling the actual methods.

The weird thing is if I pause and then resume the script it will run as expected. (for a couple of trips) And sometimes runs fine for like ~10 trips.

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.event.WebWalkEvent;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.Condition;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "contiez", info = "Farms", logo = "", name = "potato", version = 1.0)

public class potato extends Script {

	private int itemid = 1942;
	private int world = 0;

	@Override
	public int onLoop() throws InterruptedException {
		log("Loop");
		getPotatos();
		return (random(400, 600));
	}

	private void getPotatos() throws InterruptedException {
		log("method 1");
		
		Area field = new Area(3155, 3290, 3140, 3268);
		Area pregate = new Area(3143, 3292, 3146, 3294);
		Entity potato = objects.closest("Potato");

		if (world == 0) {
			world = worlds.getCurrentWorld();
		}

		if (!getInventory().isFull()) {
			if (!field.contains(myPlayer())) {
				log("walk to field");
				WebWalkEvent webEvent = new WebWalkEvent(field);
				webEvent.setBreakCondition(new Condition() {
					@Override
					public boolean evaluate() {
						return field.contains(myPlayer());
					}
				});
				execute(webEvent);
			} else if (field.contains(myPlayer()) && getMap().canReach(potato)) {
				if (potato != null)
					potato.interact("Pick");
				new ConditionalSleep(750, 500) {
					@Override
					public boolean condition() throws InterruptedException {
						return myPlayer().isAnimating() && myPlayer().isMoving();
					}
				}.sleep();
			} else if (field.contains(myPlayer()) && !getMap().canReach(potato)) {
				log("walk to gate");
				WebWalkEvent webEvent = new WebWalkEvent(pregate);
				webEvent.setBreakCondition(new Condition() {
					@Override
					public boolean evaluate() {
						return pregate.contains(myPlayer());
					}
				});
				execute(webEvent);
			}
		} else if (getInventory().isFull()) {
			bank();
		}

	}

	private void bank() throws InterruptedException {
		if (Banks.DRAYNOR.contains(myPlayer())) {
			if (getBank().isOpen()) {
				getBank().depositAll();
			} else {
				getBank().open();
			}
		} else {
			WebWalkEvent webEvent = new WebWalkEvent(Banks.DRAYNOR);
			log("walk to bank");
			webEvent.setBreakCondition(new Condition() {
				@Override
				public boolean evaluate() {
					return Banks.DRAYNOR.contains(myPlayer());
				}
			});
			execute(webEvent);
		}
	}

}

Help would be really appreciated!

Edited by Satan

Place a log after "execute(webEvent)" & see if it ever gets there, if it does you know the problem is indeed with webwalking, when do you exactly call this function?
If it's not, place logs throughout the script & see which one shows up last to know where exactly it failed.

  • Author
14 minutes ago, Neanel said:

Place a log after "execute(webEvent)" & see if it ever gets there, if it does you know the problem is indeed with webwalking, when do you exactly call this function?
If it's not, place logs throughout the script & see which one shows up last to know where exactly it failed.

Hey, thanks for replying. It always gets to where it needs to be, and logs: "WebWalkingEvent; Terminated because of break condition!" in the console. weirdly enough that is also the last method being called before it stops and just stands there. Even after restarting the script it does not seem to do anything now, where as before it did. Note that i didnt change anything in the script.

Are you checking if the player is already in the area before calling the webwalk event? Otherwise it would just be stuck in a loop.

if suddenly you’re script isn’t doing anything you might wanna reinstall everything & check if there are no nullpointers when assigning a value to a variable.

  • Author
5 minutes ago, Neanel said:

Are you checking if the player is already in the area before calling the webwalk event? Otherwise it would just be stuck in a loop.

if suddenly you’re script isn’t doing anything you might wanna reinstall everything & check if there are no nullpointers when assigning a value to a variable.

Thanks again, but yes I do checks before calling any method and there are null checks troughout the script, also if there were to be a NPE it would log it to the console i believe.

  • Author
5 minutes ago, Token said:

Always add an else case at the end and print an error message in there, it's most likely a logical problem where none of your conditions are met

Thanks for replying! Except how would this explain the log message at the top of the onLoop() not printing? It is not inside another block or anything.

Could you place a log in all your statements & show us the output? Place variables in the logs so you can track them.

new WebWalkEvent(shelfArea)

How does shelfArea variable look like?
Can't find it in your blok of code.

30 minutes ago, Satan said:

Thanks for replying! Except how would this explain the log message at the top of the onLoop() not printing? It is not inside another block or anything.

I don't see any onLoop in there nor the code running after webwalking so I can't provide any info on that

  • Author
37 minutes ago, Promo said:

new WebWalkEvent(shelfArea)

How does shelfArea variable look like?
Can't find it in your blok of code.

final private Area shelfArea = new Area(3087, 3251, 3094, 3255);

So could you post the log output? Then it'll be clearer what the problem is

  • Author
On 6/6/2019 at 2:25 PM, Token said:

I don't see any onLoop in there nor the code running after webwalking so I can't provide any info on that

 

On 6/6/2019 at 4:21 PM, Neanel said:

So could you post the log output? Then it'll be clearer what the problem is

I put the full code in the OP now. Did change what the script collects but the banking and walking is identical. Hopefully y'all can help.

Webwalker can walk 2-3 tiles outside your area and believes it Is in the area. You need to make the webwalker walk to the center

On 6/8/2019 at 9:20 PM, Juggles said:

Webwalker can walk 2-3 tiles outside your area and believes it Is in the area. You need to make the webwalker walk to the center

So rather walk to a position and then check if player is inside area or is there a getCenterPosition option for Area?

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.