Jump to content
bumzag

Beginner questions: 1 - banking

Recommended Posts

Alright so I literally just dove into the API like 45 minutes ago, got IntelliJ up and running and am able to build a jar. Literally the only success I've had so far is writing a script that hovers over the nearest bank booth and logs a string. 

What I'm trying to do now is actually open the bank booth. Not deposit or anything, literally just open the booth. How do I do that?

Here's my code (like I said, all it does it hover over the nearest bank booth when standing in a bank):

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;

@ScriptManifest(name = "Skeleton", author = "Alek", version = 1.0, info = "", logo = "")

public final class CowMain extends Script {
    @Override

    public void onStart() {
        //Code here will execute before the loop is started
    }
    @Override

    public void onExit() {
        //Code here will execute after the script ends
    }
    @Override

    public int onLoop() {
        objects.closest("Bank booth").interact("Use");
        log("It's not working atm");
        return 100; //The amount of time in milliseconds before the loop starts over

    }
    @Override

    public void onPaint(Graphics2D g) {
        //This is where you will put your code for paint(s)
    }
}

 

Edited by bumzag
Link to comment
Share on other sites

4 minutes ago, bumzag said:

Okay so screwing around some more I figured it out, I add to add "throws Interrupted Exception" to the onLoop() method and added this to it:


getBank().open();
return 5000; //arbitrary number until the loop runs again, I know

 

Dig more into Conditional sleeps as this will try to open back meanwhile waiting 5 seconds, which is not very efficient, with conditional sleep it would sleep until condition is met in this case bank interface is open :) 

Link to comment
Share on other sites

2 minutes ago, Kramnik said:

Dig more into Conditional sleeps as this will try to open back meanwhile waiting 5 seconds, which is not very efficient, with conditional sleep it would sleep until condition is met in this case bank interface is open :) 

Thanks for the response. Not trying to make you do the work, but can you sort of push me in the right direction? I know the basic structure of what you're saying would be along the lines of

if (bank is open)
	sleep;
else
	open bank;

but I'm wildly unfamiliar with Java methods

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...