Jump to content

Welcome to DreamBot

VIP Enhancement

Want to upgrade your DreamBot experience? Consider signing up for VIP!
VIP allows you to run as many accounts as you want, view the forums ad-free, receive 10% off all script purchases, and so much more!
Visit the store to learn about all of these great features!

Upgrade to VIP Now
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java 8 installed
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox

DreamBot is the only Deadman Mode supported bot on the market!

Download the DreamBot client today!





Hashtag

Scripting 101

Recommended Posts

Paint

 

 

All about making the brilliant paint. (I wrote this section at 2am, please bear with me)

 

First of all, add this method in your script. All the example code below should be written inside this method.

EDOMKWB.png

 

Getting coordinates

 

 

A2wBEvC.png

 

 

 

Setting color

 

 

hTPh38c.png

 

 

 

Setting font

 

 

BnnvQE9.png

 

 

 

Drawing text

 

 

ZaI9t7L.png

 

 

 

Drawing rectangles

 

 

fy9cuHG.png

 

 

 

Drawing an image

 

 

nZ5uVpM.png

 

 

 

Drawing an in game tile

 

 

g2loaCS.png

 

 

 

The final product and full source

 

 

l8lIb1t.png

 

oTAQx0u.png

 

 

 

 

 

GUI

 

 

Nearly all scripts have some kind of a GUI. GUI is the window that appears when you start a script. You input all kinds of info, such as which enemy to attack and should your bot use prayer or not. Now we will take a look at creating a GUI ourselves. We will not be using any kind of a form maker program. Creating a GUI can be sometimes very tedious, especially when you write it completely yourself without the use of a form maker. I personally use WindowBuilder, a plugin for Eclipse. It saves me a lot of time when making a GUI. 

 

Starting off

 

 

MvErrQg.png

 

 

 

The createGUI method

 

 

mRlh1GH.png

 

 

 

Adding different components

 

 

p0Tkr5W.png

 

 

 

The final product and full source

 

 

08GCQ4I.png

 

ZikZxTr.png

 

 

 

 

 

AbstractScript versus TaskScript

 

 

Let's take a peek at the differences between AbstractScript and TaskScript. I have written a basic powerchopper script in both frameworks and the sources are visible in the spoilers below.

Both of the scripts work the same way. Chops trees until inventory is full and then drops them.

 

AbstractScript source

 

 

KxXbeBF.png

 

 

 

TaskScript source

 

 

bxoyyWa.png

 

dTkbPb0.png

 

tgvnj87.png

 

 

 

Okay, okay, I've seen enough code. Now what are the differences?

As I said the scripts work exactly the same way. However, some scripters, like me, prefer to use the TaskScript framework. Why is that? Well... mostly because your code is spread in to different classes which makes it easier for you to modify your code. You also get the opportunity to set priorities to your nodes and understanding which piece of code is ran is easier. Of course this example script is very basic and short which makes the use of TaskScript an overkill. It is better to use AbstractScript on small scripts using either if-framework or state-framework.

EZsm2Ej.png

 

 

 

 

Feel free to request new tutorials.

If you have any questions, do not hesitate to ask!

Share this post


Link to post
Share on other sites

What other tutorial are coming soon.

I saw someone asking tutorial on using TaskScript on Discord chat so I decided to start with this. In the future I will create tutorials on the basic stuff such as how to interact with different objects in game and doing other cool stuff such as gui and paint. All ideas are welcome and I'll try my best to create a tutorial for it! =)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...