MrBigBertil 0 Share Posted December 3, 2022 So ive been doing a few scripts and im thinking about making an account builder of some sort, im just wondering if its possible to run another local script from the one i currently am running. For example if im in my "woodcutter" can i then make it so that when i reach a certain level i open the next script for example "fishing". Its just so i wont have to make a large script basicly, it would be easier to read etc. ps Im trying to run the files in the picture after eachother. im mostly wondering how i can call them from a "Main" script Thanks in advance Link to comment Share on other sites More sharing options...
420x69x420 72 Share Posted December 8, 2022 (edited) I use threads and ScriptManager class to accomplish this. I do it by starting a new thread, and inside of the thread I get the instance of the script manager, wait for the current script to stop, then start new script. As soon as the 1st script starts the new thread, the 1st script returns -1 to stop itself. But thread isn't killed on 1st script stop so 2nd script starts after 1000 ms (u should give DreamBot a second or two to finish script stopping / loading activities). Call this anywhere in your Main class you want to switch QuestScriptStarter questStarter = new QuestScriptStarter(); Logger.log("Attempting to stop current script and start tmp's Ten QP"); Thread t1 = new Thread(questStarter); t1.start(); return -1; and this is the class that implements Runnable package script.unlock.quests; import org.dreambot.api.script.ScriptManager; public class QuestScriptStarter implements Runnable{ @Override public void run() { ScriptManager manager = ScriptManager.getScriptManager(); try { Thread.sleep(1000); } catch (InterruptedException e) { throw new RuntimeException(e); } manager.start("tmp\'s Ten QP"); } } Also, I think that using this method to automatically switch scripts requires each startable Script to override the Quickstart method onStart(String[] args) in order for them to be started this way (not sure tbh) Edited December 8, 2022 by 420x69x420 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now