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
Ant0s 0 Posted February 2 Aight, i managed to make it work! Basically: private List<String> accountList = Arrays.asList("Name1", "Name2", "Name3", "Name4"); private int processedAccounts = 0; do the stuff you want then call this.switchACC(); which is: private int switchACC() { String nickname = AccountManager.getAccountNickname(); this.log("Current account nickname: " + nickname); int currentIndex = this.accountList.indexOf(nickname); if (currentIndex == -1) { this.log("Error: Current account nickname not found in accountList. Stopping the script."); return -1; } else { int nextIndex = (currentIndex + 1) % this.accountList.size(); String nextAccount = (String)this.accountList.get(nextIndex); if (ScriptManager.getScriptManager().setAccount(nextAccount)) { this.log("Switched to account: " + nextAccount); this.sleep(1000L); ++this.processedAccounts; if (this.processedAccounts >= this.accountList.size()) { //remove this part to loop forever this.log("All accounts processed. Stopping the script."); //remove this part to loop forever this.stop(); //remove this part to loop forever return -1; //remove this part to loop forever } //remove this part to loop forever Tabs.logout(); this.sleep(1000L); } else { this.log("Failed to switch to account: " + nextAccount); } return 500; } } It will loop between accounts only once, remove that one line to infinite loop
GamersGodly12 2 Posted May 30 (edited) There is Elliots Account Checker that checks for bans and logs thru a list of accounts one time. It's a free script. EDIT: Ahh nvm, this was meant to go on a different thread. Edited June 17 by GamersGodly12
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