Jump to content

Pandemic's Scripting Series: Part II - Path Walking and Simple Banking [UPDATED FOR OSBOT 2]


Pandemic

Recommended Posts

  • 2 months later...

I am using the walkTile method in another script for personal use (nothing unique*), and one thing I notice is that it will spam click the minimap until the character is resting on that position, how would i go about so it won't do that. I am wanting it just to click once and walk to the general position and just continue on.

 

*I have an account which I'm trying to bot only using scripts I make myself, almost everything I'll make will already have a better made public script.

Edited by xarviar
Link to comment
Share on other sites

I am using the walkTile method in another script for personal use (nothing unique*), and one thing I notice is that it will spam click the minimap until the character is resting on that position, how would i go about so it won't do that. I am wanting it just to click once and walk to the general position and just continue on.

 

*I have an account which I'm trying to bot only using scripts I make myself, almost everything I'll make will already have a better made public script.

 

It shouldn't do that, have you modified it at all?

Link to comment
Share on other sites

I am using the walkTile method in another script for personal use (nothing unique*), and one thing I notice is that it will spam click the minimap until the character is resting on that position, how would i go about so it won't do that. I am wanting it just to click once and walk to the general position and just continue on.

 

*I have an account which I'm trying to bot only using scripts I make myself, almost everything I'll make will already have a better made public script.

 

You could set different areas in the path and have it walk to the areas not the exact positions.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Im having trouble with one piece of code in particular this part
 

private boolean walkTile(Position p) throws InterruptedException {
    mouse.move(new MinimapTileDestination(bot, p), false);
    sleep(random(150, 250));
    mouse.click(false);
    int failsafe = 0;
    while (failsafe <10 && myPlayer().getPosition().distance(p) >2) {
    sleep(200);
    failsafe++;
    if (myPlayer().isMoving())
    failsafe = 0;
    }
    if (failsafe == 10)
    return false;
    return true;
    }
 
eclipse is telling me the constructer minimaptiledestination (bot, position) is undefined.
 
any ideas as to why this is?
Link to comment
Share on other sites

 

Im having trouble with one piece of code in particular this part

 

private boolean walkTile(Position p) throws InterruptedException {
    mouse.move(new MinimapTileDestination(bot, p), false);
    sleep(random(150, 250));
    mouse.click(false);
    int failsafe = 0;
    while (failsafe <10 && myPlayer().getPosition().distance(p) >2) {
    sleep(200);
    failsafe++;
    if (myPlayer().isMoving())
    failsafe = 0;
    }
    if (failsafe == 10)
    return false;
    return true;
    }
 
eclipse is telling me the constructer minimaptiledestination (bot, position) is undefined.
 
any ideas as to why this is?

 

 

MiniMap

not Minimap.

 

org.osbot.rs07.input.mouse.MiniMapTileDestination;

Edited by Samaoru
Link to comment
Share on other sites

Omg Thank you its been driving me nuts for hours! 

 

if you have your osbot client attached in the build path of the project which it should be, then you can hover over the error and 90% of the time it will show you a fix for the problem including spelling errors :)

private boolean walkTile(Position p) throws InterruptedException {
	client.moveMouse(new MinimapTileDestination(bot, p), false);
	sleep(random(150, 250));
	client.pressMouse();
	int failsafe = 0;
	while (failsafe < 10 && myPlayer().getPosition().distance(p) > 2) {
		sleep(200);
		failsafe++;
		if (myPlayer().isMoving())
			failsafe = 0;
	}
	if (failsafe == 10)
		return false;
	return true;
}

should be:

	private boolean walkTile(Position p) throws InterruptedException {
		mouse.move(new MiniMapTileDestination(bot, p), false);
		sleep(random(150, 250));
		mouse.click(false);
		int failsafe = 0;
		while (failsafe < 10 && myPlayer().getPosition().distance(p) > 2) {
			sleep(200);
			failsafe++;
			if (myPlayer().isMoving())
				failsafe = 0;
		}
		if (failsafe == 10)
			return false;
		return true;
	}

should it not? <3

Link to comment
Share on other sites

Ok, I'm trying to get the banking to work and it will get to the bank & bank fine. But when it tries to get back to the mine it will start walking towards Wilderness. 

 

I tried adjusting several things and copying your exact source and I still have the problem... I've used this to make a script for normal logs & it all works up to the same point where it needs to walk back after banking.

 

Any ideas 

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 months later...

 

 

Step VI: Banking

Now that we’ve managed to walk to and from the bank, let’s actually do some banking!

If we’re in the bank state, that means we’re already in the bank!

Now, let’s add this case to our onLoop() function (as seen above), by simply adding this after the last “break;” and before the ‘}’:


case BANK:
    RS2Object bankBooth = objects.closest("Bank booth");
    if (bankBooth != null) {
        if (bankBooth.interact("Bank")) {
            while (!bank.isOpen())
                sleep(250);
            bank.depositAll();
        }
    }
    break;

This looks for the bank booth, if it isn’t null and if we actually managed to click on it, we’ll wait til it’s open, then deposit everything except our pickaxe, which is hardcoded so you’ll have to change this to whatever pickaxe you’re using. We’ll automatically detect which pickaxe we’re using in the next tutorial.

 

 

What if the bank booth is a closed booth? One that can't be used, the script wouldn't look for another bank booth, but just keep waiting

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.
Note: Your post will require moderator approval before it will be visible.

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...