TheScripts 0 Share Posted June 10, 2016 Hello, I'm working on a script that paints helpful information on the client but does not need to control the mouse and/or keyboard. Is there a way to prevent DreamBot from disabling mouse/keyboard input when the script is started? Thanks, TheScripts Link to comment Share on other sites More sharing options...
Hopewelljnj 46 Share Posted June 10, 2016 You could manually setup a keyboard and mouse listener to do it. But the user is just better off disabling it. Link to comment Share on other sites More sharing options...
Mad 86 Share Posted June 11, 2016 Instance.getInstance().setKeyboardInputEnabled(true); Instance.getInstance().setMouseInputEnabled(true); Link to comment Share on other sites More sharing options...
Before 95 Share Posted June 11, 2016 Instance.getInstance().setKeyboardInputEnabled(true); Instance.getInstance().setMouseInputEnabled(true); Put this in your onResume(), and make your onStart() call your onResume() Link to comment Share on other sites More sharing options...
TheScripts 0 Author Share Posted June 12, 2016 Instance.getInstance().setKeyboardInputEnabled(true); Instance.getInstance().setMouseInputEnabled(true); Put this in your onResume(), and make your onStart() call your onResume() Thank you, this is exactly what I was looking for. I spent quite awhile browsing through the API documentation for this; but I see now that the Instance class does not reside in the API package hierarchy. I did, however, find an issue while testing this solution; It seems to work when the script is started, but the mouse and keyboard input become disabled if I pause then play the script. Test Script: public class Main extends AbstractScript { @Override public void onStart() { getRandomManager().disableSolver(RandomEvent.LOGIN); onResume(); } @Override public void onResume() { Instance.getInstance().setMouseInputEnabled(true); Instance.getInstance().setKeyboardInputEnabled(true); } @Override public int onLoop() { return 1000; } } Any suggestions on how to correct this? On a side note: Is there an easy way to disable all random solvers, or do I need to disable each one separately? I tried calling getRandomManager().kill(), but the login solver seemed to be called first and the screen on the client went red (as if to login), and stayed that remained that way until the script was stopped. On a side side note: I've been using IntelliJ IDEA to create the JARs for my scripts, directly into the DreamBot script folder, and as soon as I run the script I can no longer delete the JAR or build a new copy over it. This results in me needed to kill DreamBot and relaunch it each time I want to rebuild the JAR. Any suggestions? Link to comment Share on other sites More sharing options...
Cardozz 46 Share Posted June 12, 2016 add public void onPaused(){ onResume(); } Now when the script is paused, onResume() will also be called. Link to comment Share on other sites More sharing options...
TheScripts 0 Author Share Posted June 12, 2016 add public void onPaused(){ onResume(); } Now when the script is paused, onResume() will also be called. Thank you for the suggestion. I have tested that method and it does not appear to solve the issue; the mouse and keyboard input is still disabled when I press the start button (after being paused). I have been able to, somewhat, get around the issue by adding the following to onLoop(): if (!Instance.getInstance().isMouseInputEnabled()) { Instance.getInstance().setMouseInputEnabled(true); } if (!Instance.getInstance().isKeyboardInputEnabled()) { Instance.getInstance().setKeyboardInputEnabled(true); } Link to comment Share on other sites More sharing options...
Before 95 Share Posted June 12, 2016 Thank you for the suggestion. I have tested that method and it does not appear to solve the issue; the mouse and keyboard input is still disabled when I press the start button (after being paused). I have been able to, somewhat, get around the issue by adding the following to onLoop(): if (!Instance.getInstance().isMouseInputEnabled()) { Instance.getInstance().setMouseInputEnabled(true); } if (!Instance.getInstance().isKeyboardInputEnabled()) { Instance.getInstance().setKeyboardInputEnabled(true); } This should work but it's kind of memory intensive. You could probably get around this with a boolean system and a function that autocalls itself every 5 seconds or so that checks it (rather than checking it at each onLoop() ) but that's probably too complicated in itself and this should be ok. Link to comment Share on other sites More sharing options...
Mad 86 Share Posted June 12, 2016 This should work but it's kind of memory intensive. You could probably get around this with a boolean system and a function that autocalls itself every 5 seconds or so that checks it (rather than checking it at each onLoop() ) but that's probably too complicated in itself and this should be ok. This isn't memory intensive, all it does it change a Boolean to true or false. You could run it 10k a second and it won't have any impact. Link to comment Share on other sites More sharing options...
Before 95 Share Posted June 12, 2016 This isn't memory intensive, all it does it change a Boolean to true or false. You could run it 10k a second and it won't have any impact. oh shit it is a boolean check, thought it was something else. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.