• Log in or sign up for an account here: https://www.sythe.org/login

RsBot Script Help

Go L Den

Member
Banned
Joined
May 1, 2007
Sythe Gold
0
Messages
84
RsBot Script Help
Hey guys, I'm very new to scripting for RsBot, and I was wondering if someone could give me some help with a Nullpointer error.

I created an extremely simple script using a tutorial to open a bank booth, but I keep getting a nullpointer error whenever I run it.

Here is the script code:

Code:
}
import java.awt.*;

import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;

public class AutoBank extends Script implements PaintListener {




public void onRepaint(Graphics g) 
{
Bot.getEventManager().addListener(PaintListener.class, this);
}
public double getVersion() 
{
return 1.0;
}
public String getScriptCategory() 
{
return "Auto Bank";
}
public String getName() 
{
return "AutoBank";
}
public String getAuthor() 
{
return "Go_L_Den";
}

public boolean onStart(String[] args) 
{

return true;
}

public void onFinish() {

}
int id1 = 36831;
boolean first = true;
boolean foundobject = false;

RSObject bankbooth = findObject(id1); 

public int loop() {



if(first) {

foundobject = true;
log("Found an object!");
first = false;

}
if(foundobject,"Use-quickly") {

atObject(bankbooth);
}

return 1000;
}
}

and here is the nullpointer error that I get whenever I run the script (it occurs after the object is found):

Code:
java.lang.NullPointerException
	at com.speljohan.rsbot.script.Methods.atObject(Methods.java:2081)
	at AutoBank.loop(AutoBank.java:62)
	at com.speljohan.rsbot.script.Script.run(Script.java:102)
	at com.speljohan.rsbot.script.ScriptHandler$1.run(ScriptHandler.java:70)
	at java.lang.Thread.run(Thread.java:619)

If someone could tell me what I did incorrectly and how I should have done it to avoid this error, I would greatly appreciate it.

Thanks,

Go L Den
 
RsBot Script Help
Your loop looks a bit funky. Try something more like this?
PHP:
import java.awt.*;

import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;

public class AutoBank extends Script {
    public int BBooth = 36786;

    public double getVersion() {
	return 1.0;
    }

    public String getScriptCategory() {
	return "Auto Bank";
    }

    public String getName() {
	return "AutoBank";
    }

    public String getAuthor() {
	return "Go_L_Den";
    }

    public boolean onStart(String[] args) {
	return true;
    }

    public void onFinish() {
    }

    public int loop() {
    RSObject Booth = findObject(BBooth);
	atObject(Booth, "Use-Quickly");
	log("Found Bank Booth");
	return -1;
    }
}
 
RsBot Script Help
where is the package " com.speljohan", in my RSBot 1.16, there is no package about " com.speljohan". what shall i do?
 
Runescape Gamblingrunescape gambling
Back
Top