Jump to content

Welcome to DreamBot!

Download for Free

Supercharge Your Bots

Run unlimited bots today using DreamBot's Covert Mode and
stay more protected.

Upgrade Now
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java 8 installed
  • Still not working? Try downloading and running JarFix
  • 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
OSRS Gambling

Interested in advertising your business? Reach out today!

Download the DreamBot client today!

Recommended Posts

Hello Everyone,

I've been contacted by several newbie scripters complaining about after they add their first script in, all scripts disappear from the Script Manager.

I'll be listing 2 probable causes and their fixes! So let's get on with it!

 

First Probable Cause: ScriptManifest isn't added to the main class.

How to Diagnose:

1) Open your Script Main Class (The File that contains the OnLoop method)

2) Look above class declaration

public class MainClassName extends AbstractScript

3) Do you see the following or something similar?

@ScriptManifest(author = "Scripter_Name", category = Category.CATEGORY_ENUM, name = "Script_Name", description = "Brief_Script_Description", version = 1.0)

 

If the answer is YES, then proceed to the next probable cause otherwise keep reading the following:

Add the ScriptManifest line above the main class declaration as shown below:

@ScriptManifest(author = "Scripter_Name", category = Category.CATEGORY_ENUM, name = "Script_Name", description = "Brief_Script_Description", image = "image path", version = 1.0) 
//ADD THIS ^
public class Main extends AbstractScript {

 

A short explanation of the fields:

author = Put your name there

category = Dreambot has several category that your script type can fall in, ex: FISHING would be Category.FISHING

name = Put your script's name here

description = [OPTIONAL] add a brief description here (Will appear in the script manager)

version = Put the version number of your script here.. default: 1.0

image = Put your script icon/image path. Thanks @Infidel

 

Second Probable Cause: SDK/JDK isn't set to 8 in the IDE

Even though you do have JRE 8 installed and used on your computer, you may have selected the wrong JDK Compiler Version when first creating your project and/or you don't have JDK 8.

How to Diagnose?

IntelliJ

Step 1:

 RmpMYZN.png

- Open Project Structure by clicking the button with "1" written under it in the picture.

- Click Project on the sidebar

- Does the SDK say "1.8"? If not, change it to 1.8 and click apply. 

If SDK 1.8 doesn't appear in the dropdown,carry on to the next step:

 

Step 2:

Click "New..." and go to the JDK 1.8 Folder located in either "Program Files" or "Program Files (x86)" and click save.

If there is no JDK 1.8 in your system, download it here then restart IntelliJ.

This link might be of further use to you: https://www.jetbrains.com/help/idea/sdk.html

 

Eclipse

 

How to Diagnose?

Step 1: Check what JDK is currently enabled:

P0tcw.png

Open the Project Properties by right clicking the project and clicking Properties/Project Configuration

Click Java Build Path on the side-bar

If it doesn't say JavaSE-1.8 then carry on to the next step:

 

Step 2: Change the JDK Enabled version:

Click on the Add Library button. It brings your screen to point to the Java location.

Select "Directory", button right besides JRE home and point to the installed folder location.

 

This link may be useful to eclipse users: https://www.eclipse.org/documentation/

 

and that's it! I hope this helped you in someway or the other!

 

Edited by Defiled

Share this post


Link to post
Share on other sites
54 minutes ago, Hashtag said:

Great guide, thanks!

:D Thank you :D

Share this post


Link to post
Share on other sites

Upvoted because good guide and Eclipse > Intellij.

Extra param for SM, that I might be the only one that uses (Doesn't pop on SDN, but personal / private scripts = A++)

image = "imagesite.com/yourimage.png"

j0lHODa.png

Share this post


Link to post
Share on other sites
6 hours ago, Infidel said:

Upvoted because good guide and Eclipse > Intellij.

Extra param for SM, that I might be the only one that uses (Doesn't pop on SDN, but personal / private scripts = A++)


image = "imagesite.com/yourimage.png"

j0lHODa.png

Thank you for your contribution! I will add it to the thread.

Everyone uses the IDE they're comfortable with, for an example I use both of them.. eclipse is really awesome with swift guis cuz of the windowbuilder.. and intellijs auto complete is a lot better than eclipse.

Share this post


Link to post
Share on other sites
4 hours ago, Infidel said:

I am Eclipse fanboy. =D

I am a Dual Fanboy

Share this post


Link to post
Share on other sites
11 hours ago, digest said:

Thank you man!

You're welcome man :)

Share this post


Link to post
Share on other sites

Hello,

Your guide helped more that other guides but I'm still having issues. The local scripts still won't load. I changed to JDK to 1.8 and it still won't work. I've tried every thread here and can't find a solution. If you (or anyone else who reads this) can help me figure out the issue I will gladly PayPal you. Please PM me. 

 

There are no error messages. No other scripts in scripts folders. I uninstalled and reinstalled Java 8 twice. I tried different code. I deleted Dreambot and all subfolders and redownloaded it twice as well. 

I don't know if this is related or not but I am also having issues launching Dream Bot through DBLauncher. It only loads through Clint.jar on my Mac. I've purchased a VPS and set it up and I've been able to run multiple bots there, but now I am trying to get into scripting and I'm using my Mac which I'm still getting use to. I'm fluent with windows and Linux and I don't see what having a Mac would do to cause these issues. I haven't had any issues launching dreambot through DBLauncher on Windows or Linux. I know people can script using Mac because I've seen tutorials. 

 

I really don't want to write all my code on my VPS, I'd much rather use my Mac. 

 

I really don't know what I am doing wrong. 

Here is the pictures of the export: 

1678589623_ScreenShot2020-06-10at11_16_49AM.thumb.png.1528947a2457110db247fc7900e2a6a5.png

 

This is the source code: 

import org.dreambot.api.methods.Calculations;

import org.dreambot.api.script.AbstractScript;

import org.dreambot.api.script.ScriptManifest;

import org.dreambot.api.script.Category;

import org.dreambot.api.wrappers.interactive.GameObject;

 

@ScriptManifest(author = "You", category = Category.THIEVING, name ="Thieve", version = 1.0)

public class main extends AbstractScript {

 

public void onStart() {

log("Welcome to Simple Tea Thiever by Apaec.");

log("If you experience any issues while running this script please report them to me on the forums.");

log("Enjoy the script, gain some thieving levels!.");

}

 

private enum State {

STEAL, DROP, WAIT

};

 

private State getState() {

GameObject stall = getGameObjects().closest("Tea stall");

if (!getInventory().isEmpty())

return State.DROP;

if (stall != null)

return State.STEAL;

return State.WAIT;

}

 

public void onExit() {

 

}

 

@Override

public int onLoop() {

switch (getState()) {

case STEAL:

GameObject stall = getGameObjects().closest("Tea stall");

if (stall != null) {

stall.interact("Steal-from");

}

break;

case DROP:

getInventory().drop("Cup of tea");

break;

case WAIT:

sleep(Calculations.random(500, 600));

break;

}

return Calculations.random(500, 600);

}

}

Screen Shot 2020-06-10 at 11.16.49 AM.png

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...