Rsbot Scripting: Tutorial Five – Making Your Script User-friendly
Add the final touches, to make your script perfect for you and your users.
BTOdell’s Tutorial Index
- <<<<Getting Started<<<<
- <<<Starting your Script<<<
- <<Script Backbone<<
- <Fill In The Blanks< (Previous)
- *Making Your Script User Friendly*
Now that you have a semi-working script
You can begin “polishing” up your script; adding user-friendly information that will tell users information on what the script is doing. Some good ways of doing this is using Java Graphics to make “Paint” on the RuneScape Applet that displays progress. Another way, is logging Server messages and accounting for them, and logging the progress when the script stops.
In these examples, we will be creating a string that shows the ores mined.
Add a private integer called “oresMined” and give it a value of 0.
Method 1: ServerMessageListener
- Have your script implement ServerMessageListener by adding “implement ServerMessageListener” after “extends Script”.
ServerMessageListener will be underlined in red, import to fix. - Add unimplemented methods and scroll down to the added method.
- First, you must convert the ServerMessageEvent to a String message by adding the following code:

- Then you can compare this “msg” variable to another string such as this:

- Then in your onFinish() method you can add:

Method 2: Paint
- Have your script implement PaintListener by adding “implement PaintListener” after “extends Script”.
(If you already have ServerMessageListener, separate the two with a comma.)
PaintListener will be underlined in red, import to fix. - Add unimplemented methods and scroll down to the added method.
Quick-reference: Change the Graphics “render” to simply “g” for quicker coding. - Using the Eclipse IDE you can browse all what Java Graphics can do by typing “g.” and waiting for the context menu to pop-up.
- But first, we need to have it so paint doesn’t show when your player is not logged in, so add the code:
“if (game.isLoggedIn())” with brackets. - The simplest way to show progress is using “g.drawString(String s, int x, int y)” This will draw a string starting at the given X and Y coordinates; you can get these by debugging your mouse coordinates with RSBot.

- Use the method of ServerMessageListener to increment the “oresMined” integer.
Thank you for reading all these tutorials. This is the end and I hope you learned some stuff. Check out some more tutorials at RSBot.org!
See Also: