Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
How to Make an RSBot Script

How to Make an RSBot Script



|Views: 42,535|Likes:
Published by keddyfish
This guide written by Ben B will show you how to create an RSBot Script for the RSBot.
This guide written by Ben B will show you how to create an RSBot Script for the RSBot.

More info:

Published by: keddyfish on Jun 24, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





1. Script Model2. GUI Building3. Player Movement4. Objects, Menus, and Items5. NPCs & Player Interactions6. Player Properties
Step 1 – Script Model
import java.awt.*;import com.speljohan.rsbot.bot.Bot; importcom.speljohan.rsbot.event.listeners.PaintListener; importcom.speljohan.rsbot.script.Script; importcom.speljohan.rsbot.script.wrappers.*;public class testscript extends Script implements PaintListener {public void onRepaint(Graphics g){ Bot.getEventManager().addListener(PaintListener.class,this); } public double getVersion() { return 1.0; } public StringgetScriptCategory() { return "Ben's Scripts"; } public StringgetName() { return "Test Script"; } public String getAuthor() { return"Ben B (Hunterbdb)"; }
public boolean onStart(String[] args){ Bot.getEventManager().addListener(PaintListener.class,this); Frame myframe = newFrame("Input"); myframe.setVisible(true); return true; }public void onFinish() { }public int loop() { return 1000; } }What you see above is the most simple script you will ever see inRsbot. Every script will have the minimum of these methods^. Letsreview what each method does:onStart(): this method is called when the script begins. It returns aboolean (true or false statement), which tells the script to either continue (if true) or to halt (if false).loop(): this is where the scripting code will go. loop() is calledrepeatedly. it repeats, and repeats, and repeats. This is how a scriptworks. for example: if you want your script to walk to cut some logsand walk to the bank, your loop() method will look like this:loop(){if(I have cut logs)then(walk to the bank)if(I have not cut logs)then(cut some logs)return 100;}the return statement is a number of milliseconds you want your program to wait inbetween repetitions. if you say "return 1000;" at the
end of the loop(), then your script will execute your code,wait 1000milliseconds, and then restart itself from the top.onRepaint(Graphics g): This is a method that allows you to draw onthe runescape screen. this method is called a million times a second.With this method, you can show the user progress reports. for example, if you want to show the user how many fish have beencaught, you can have this be drawn with the onRepaint(Graphics g)method.get() methods: these are methods like getVersion(), getAuthor(), etc.these simply return a string or double value, which corresponds to thename. for example, in getAuthor() I will say "return 'Ben B' " because Iam the author.
Step 2 – GUI Building
Alright, so the first thing you ever will want to do in your script is getinput from your user. Woah woah woah, what is input, you say? inputis when you ask the user for information or specifications. andexample of input in Rsbot would be asking "What kind of logs do youwant to fletch?". this inquiry is followed by a text box, such as the onebelow:
Rsbot uses the Java programming language, which means we needto use java to get input from the user of your script. The way javadoes this is through a GUI (Generic User Interface). Sounds high-tech, ya? Well, it isn't. Infact, it's so bloody simple I don't even knowwhy I bother explaining it. Java is an application programminglanguage, so it uses windows to display things. a window is anything,like the browser you are using to read this tutorial, or microsoft word.Everything on a computer is in some kind of window. A window in java is also called a frame, and this is where the code starts.Whenever you make a GUI, you will put the GUI code in theonStart() method. Why? Because theonStart()method is called when thescript begins.You wouldn't want to ask the user for input after thescript is done (duh!), so you ask for it when it starts (duh!).There are

Activity (80)

You've already reviewed this. Edit your review.
Aidan Kennedy added this note
i did not understand any of that
Oliver Shi added this note
1 thousand reads
1 hundred reads
Enis Cuna added this note
what program do i need? eclipse for javadevolopers?
Ricky Maureira liked this
Rob Jansen added this note
it doesnt even cost $5 JUST DO CONTROL S :)
Maffe811 added this note
I paid 5$ just to download this! You, sir, are awsome! This is my first step to learn java!

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->