Jump to content

Cheff

Trade With Caution
  • Posts

    5
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Cheff

  1. Thanks for the reply, I have tried this but I keep getting this error when I stop the script. (Should activate is never called in the logs and only called once on stop before error trace) java.lang.NullPointerException at org.osbot.rs07.randoms.BreakManager.shouldActivate(nk:108) at CustomBreakManager.shouldActivate(CustomBreakManager.java:24) at Runner.pause(Runner.java:205) at org.osbot.rs07.event.ScriptExecutor.suspend(kl:433) at org.osbot.rs07.event.ScriptExecutor.stop(kl:396) at org.osbot.rs07.event.ScriptExecutor.stop(kl:324) at org.osbot.Mb.run(rz:204) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Also what do you mean by exchanging contexts? Perhaps it is related to this issue? This is my custom handler: import org.osbot.rs07.Bot; import org.osbot.rs07.randoms.BreakManager; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest( name = "TestBreakManager", author = "Cheff", version = 1.1D, info = "Takes breaks", logo = "" ) public class CustomBreakManager extends BreakManager { private Bot bot; public CustomBreakManager(Bot iIiiiiiiIiii) { super(iIiiiiiiIiii); this.bot = iIiiiiiiIiii; } @Override public boolean shouldActivate() { bot.getLogger().info("Pass"); return super.shouldActivate() && true; //todo put logic here } @Override public String getName() { return "TestManager"; } } and setting it up on start first thing like so: getBot().getRandomExecutor().overrideOSBotRandom(new CustomBreakManager(getBot()));
  2. To be sure we are on the same page, I am able to detect when the break manager failed to start. I want to be able to start it manually later when player is moved to a safe spot.
  3. To answer my own question: 1) @Override public void pause() { if(bot.getRandomExecutor().forEvent(RandomEvent.BREAK_MANAGER).shouldActivate()) { isTakingABreak = true; } } 2) getBot().getCanvas().getGameBuffer() 3) Unsolved
  4. Had to create an account for me to post a thread, also by devs I mean other scripters (those developing a script) as well, dunno who the developers of Osbot are and didn't ask.
  5. New to the scene of scripting for oldschool and I have a couple of questions I have encountered during the development of my first script that I can't find an answer to on the site. 1) Is there a way for the script to detect when a random event kicks in? Example BreakManager started 2) When saving screenshots, is there a way to get a file stream of the saved image or the file name of the image? (method returns a bool only and cannot rely on the last image saved in folder if there are multiple bots running) 3) More of a suggestion to follow up on 1), but I have the script fighting some NPCs which could take some time to kill, sometimes the break manager kicks in while the player is fighting and of course he cannot logout, after a few seconds it looks like the break manager is canceled, if I am able to detect when the script tried to fire the break manager, is there a way I can manually tell the script to trigger a break after the NPC died and I looted?
×
×
  • Create New...