TheGreatYam 1 Posted June 17, 2024 I'm hoping this is a simple question that can be handled through Dreambot; I'm wanted to log out of one account and into another then run a script. https://dreambot.org/javadocs/org/dreambot/api/script/ScriptManager.html ScriptManager seems to be close to what I need, but setAccount(String x) doesn't actually log into the other. Is there a way around this or do I need to build an external program that uses Dreambot's Quick start/CLI to implement this?
TheGreatYam 1 Author Posted June 17, 2024 (edited) I got something working - I think I just have to post here whenever I get stuck and then I'll figure out the answer. You need two parts for this: LoginUtility to handle the login and script manager to handle restart the script. The tricky part is stopping a script and then still be running in order to start the next. Someone smarter than me explains it well here. I have posted my code that is working which hopefully helps someone in the future public class Tester extends AbstractScript { @Override public int onLoop() { ScriptManager sm = ScriptManager.getScriptManager(); Tabs.logout(); sm.setAccount(accountName); LoginUtility.login(); ScriptStarter ss = new ScriptStarter(); Thread t1 = new Thread(ss); t1.start(); return -1; } } public class ScriptStarter implements Runnable{ @Override public void run() { ScriptManager manager = ScriptManager.getScriptManager(); manager.stop(); try { Thread.sleep(1000); } catch (InterruptedException e) { throw new RuntimeException(e); } manager.start(scriptName); } Edited June 17, 2024 by TheGreatYam
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