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

Need Help Scripting For RSBot

HellBomb

Member
Joined
Dec 31, 2008
Sythe Gold
0
Messages
42
Need Help Scripting For RSBot
i am having issues with my script. i am making a auto mining script and i am need some help with paint. i can not make a chart that will keep track of what i bank/how long script has been running. can anyone who is experienced help?
 
Need Help Scripting For RSBot
I'll give you a hand :)

Firstly, add this after your scriptname
PHP:
implements PaintListener
So, for example
PHP:
public class SCRIPTNAME extends Script {
becomes
PHP:
public class SCRIPTNAME extends Script implements PaintListener {

Then, add this to your ints (after you declare the class, but before your methods
PHP:
private final long startTime = System.currentTimeMillis();

Finally, add this method to your script
PHP:
	public void onRepaint(Graphics g) {
		if (isLoggedIn()) {
			long millis = System.currentTimeMillis() - startTime;
			long hours = millis / (1000 * 60 * 60);
			millis -= hours * (1000 * 60 * 60);
			long minutes = millis / (1000 * 60);
			millis -= minutes * (1000 * 60);
			long seconds = millis / 1000;
			g.setColor(new Color(0, 100, 0, 100));
			g.setColor(Color.green);
			g.drawString("Runtime: " + hours + "h " + minutes + "min "
					+ seconds + "sec.", 200, 365);
		}
	}

Once all of this is done, you'll have a basic paint that will display how long the script has been running for. To add extra stuff, simply put
PHP:
g.drawString("STUFF HERE"), X,Y;
but replace the "STUFF HERE" with your text, and replace the X and Y with the X and Y coordinate that you want to start the string on.
 
Need Help Scripting For RSBot
thx but i am in need of more than just time, i al also looking on how count amount of a certain item banked
 
Need Help Scripting For RSBot
thx but i am in need of more than just time, i al also looking on how count amount of a certain item banked

hiya! I know how to do what you want.




Lets say coal's ID is 453. If I want to count how much coal I have, I would say int currentcoal = getInventoryCount(453);. Then, whenever I banked my coal I would add this number to the global integer variable that tracks how much coal I have banked so far.

I wrote something up for you:



int totalbankedcoal = 0;
int id_coal = 453;
public void bankAllMyStuff()
{
if(bank.getInterface().isValid())
{
int currentcoal = getInventoryCount(id_coal);
totalbankedcoal += currentcoal;
bank.depositAllExcept();
bank.close();
}
}
public void onRepaint(Graphics g)
{
g.drawString("Coal Banked: " + totalbankedcoal + ".",15,200);
}



I hope that helps! If you need any more help, just let me know.

-Ben B.
 
Need Help Scripting For RSBot
o ok, do you know of any websites that have a good tutorial that will help me learn how to write the scrips. well what i mostly need is a list of all the commands like get inventory, get stats, stuff like that. If anyone here knows any guides or would help me get a grasp on it i would really appreciate it.
 
Need Help Scripting For RSBot
o ok, do you know of any websites that have a good tutorial that will help me learn how to write the scrips. well what i mostly need is a list of all the commands like get inventory, get stats, stuff like that. If anyone here knows any guides or would help me get a grasp on it i would really appreciate it.

I've written a full, in-depth tutorial for RSBot scripting.

Go to my website at rsbot2.110mb.com

Also, you'll find my (incomplete, but still helpful) mining scripting tutorial useful.
 
Need Help Scripting For RSBot
thank you very much. this is will give me a very good jump start into scripting
 
Runescape Gamblingrunescape gambling
Back
Top