someguy567 Posted August 18, 2018 Share Posted August 18, 2018 For my script I am wanting it to log out but then stay logged out for an X amount of time before logging back in. For this I need to disable the auto login temporarily. I would prefer not using a custom login handler, does anyone have a solution for this? Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted August 18, 2018 Share Posted August 18, 2018 A hacky way would be to pause the ScriptExecutor. You can check when you should resume it again in a different running thread. This is not the most beautiful way to do it though. Quote Link to comment Share on other sites More sharing options...
Juggles Posted August 18, 2018 Share Posted August 18, 2018 Use break handler. Does exaxtly what you want Quote Link to comment Share on other sites More sharing options...
Antonio Kala Posted August 18, 2018 Share Posted August 18, 2018 Go to settings and then turn on breaks. Is there a reason you can't use those? Quote Link to comment Share on other sites More sharing options...
someguy567 Posted August 18, 2018 Author Share Posted August 18, 2018 2 hours ago, Juggles said: Use break handler. Does exaxtly what you want How do you do that? 1 hour ago, Antonio Kala said: Go to settings and then turn on breaks. Is there a reason you can't use those? I'm wanting to do this through the script code, not set it through the client. Quote Link to comment Share on other sites More sharing options...
Antonio Kala Posted August 18, 2018 Share Posted August 18, 2018 (edited) 36 minutes ago, someguy567 said: How do you do that? I'm wanting to do this through the script code, not set it through the client. Then you can use -allow no randoms with cli and handle logging in/breaking. Edited August 18, 2018 by Antonio Kala Quote Link to comment Share on other sites More sharing options...
someguy567 Posted August 18, 2018 Author Share Posted August 18, 2018 That's not what I want to do though, I'm looking to achieve the effect via code Quote Link to comment Share on other sites More sharing options...
Lordsthan Posted August 18, 2018 Share Posted August 18, 2018 2 hours ago, someguy567 said: That's not what I want to do though, I'm looking to achieve the effect via code You can override the Break Manager via code: 1 Quote Link to comment Share on other sites More sharing options...
someguy567 Posted August 19, 2018 Author Share Posted August 19, 2018 How does that work though? Do I need to be in a break currently or what? I don't really understand. Can someone help out? Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted August 21, 2018 Share Posted August 21, 2018 On 8/19/2018 at 10:07 PM, someguy567 said: How does that work though? Do I need to be in a break currently or what? I don't really understand. Can someone help out? You make a custom BreakManager by creating a new class which extends RandomSolver. In the newly created BreakManager class you will handle the logic of when the BreakManager should be activated, you do this in the #shouldActivate method. Make sure that you don't forget to override the OSBot Break RandomSolver with your newly created one. Quote Link to comment Share on other sites More sharing options...
someguy567 Posted August 21, 2018 Author Share Posted August 21, 2018 3 hours ago, Eagle Scripts said: You make a custom BreakManager by creating a new class which extends RandomSolver. In the newly created BreakManager class you will handle the logic of when the BreakManager should be activated, you do this in the #shouldActivate method. Make sure that you don't forget to override the OSBot Break RandomSolver with your newly created one. Alright, so I have this. import org.osbot.rs07.script.RandomEvent; import org.osbot.rs07.script.RandomSolver; public class BreakManager extends RandomSolver { public BreakManager(RandomEvent arg0) { super(arg0); } @Override public boolean shouldActivate() { return true; } @Override public int onLoop() throws InterruptedException { return 1000; } } private final BreakManager breaks = new BreakManager(RandomEvent.BREAK_MANAGER); getBot().getRandomExecutor().overrideOSBotRandom(breaks); Then I have those two lines in the class I'm trying to use the break in. I tried it and it came up with the popup to let me know I'm overrriding the break manager but on the debug log there was something that I don't think should have happened. Since the bot didn't actually go on break and it came up with this error. https://prnt.sc/kl6h0e <--- Screenshot Is there something I am missing? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted August 21, 2018 Share Posted August 21, 2018 (edited) 44 minutes ago, someguy567 said: Alright, so I have this. import org.osbot.rs07.script.RandomEvent; import org.osbot.rs07.script.RandomSolver; public class BreakManager extends RandomSolver { public BreakManager(RandomEvent arg0) { super(arg0); } @Override public boolean shouldActivate() { return true; } @Override public int onLoop() throws InterruptedException { return 1000; } } private final BreakManager breaks = new BreakManager(RandomEvent.BREAK_MANAGER); getBot().getRandomExecutor().overrideOSBotRandom(breaks); Then I have those two lines in the class I'm trying to use the break in. I tried it and it came up with the popup to let me know I'm overrriding the break manager but on the debug log there was something that I don't think should have happened. Since the bot didn't actually go on break and it came up with this error. https://prnt.sc/kl6h0e <--- Screenshot Is there something I am missing? You must override the getName method. Additionally, this will not log you out or draw a paint.. or ever stop breaking again; you have to implement all that logic yourself. Alternatively, to simplify the process, you can extend the existing BreakManager class instead of RandomSolver, in order to re-use the OSBot built in break manager, but simply override when it should activate. This however, will fail if breaks are disabled in client settings, so you must check if there is already an existing break manager registered first; and also don't forget to exchange contexts with your new BreakManager before registering it. Edited August 21, 2018 by FrostBug 1 Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted August 21, 2018 Share Posted August 21, 2018 45 minutes ago, someguy567 said: Alright, so I have this. import org.osbot.rs07.script.RandomEvent; import org.osbot.rs07.script.RandomSolver; public class BreakManager extends RandomSolver { public BreakManager(RandomEvent arg0) { super(arg0); } @Override public boolean shouldActivate() { return true; } @Override public int onLoop() throws InterruptedException { return 1000; } } private final BreakManager breaks = new BreakManager(RandomEvent.BREAK_MANAGER); getBot().getRandomExecutor().overrideOSBotRandom(breaks); Then I have those two lines in the class I'm trying to use the break in. I tried it and it came up with the popup to let me know I'm overrriding the break manager but on the debug log there was something that I don't think should have happened. Since the bot didn't actually go on break and it came up with this error. https://prnt.sc/kl6h0e <--- Screenshot Is there something I am missing? Your BreakManager does not have a #getName function, every RandomSolver should have one, the client is trying to execute that method but it's not there, hence the NPE. Quote Link to comment Share on other sites More sharing options...
someguy567 Posted September 4, 2018 Author Share Posted September 4, 2018 You know that popup that appears warning you that you have a custom break manager? Is there a way to automatically press ok on that, since my script won't begin without clicking ok Quote Link to comment Share on other sites More sharing options...
Alek Posted September 4, 2018 Share Posted September 4, 2018 11 hours ago, someguy567 said: You know that popup that appears warning you that you have a custom break manager? Is there a way to automatically press ok on that, since my script won't begin without clicking ok No, this will never be possible. 2 Quote Link to comment Share on other sites More sharing options...