October 13, 201312 yr Hmm.. I used to be able to do this but I'm not sure how any more? I want to implement this into one of my scripts but I can't seem to get it this time around. I just need a method to check how much energy the player has and if there's a method to toggle it
October 13, 201312 yr Read the interface config # if it's 1 it's enabled and 0 it's disabled, then compare to how much energy you have left and interact with the button.I thought this feature was already in API but I guess not...
October 13, 201312 yr openTab(Tab.SETTINGS); sleep(random(100, 200)); client.getInterface(261).getChild(0).interact(); sleep(random(218, 721)); That's how you would interact with it, but I'm also stuck at the part on how to call it. If I try something like getRunEnergy() > 30 the bot just turns it on and off everytime the methods called. I think you'd need a boolean variable to turn on and off. Problem is I don't know how to detect if its off or not. Read the interface config # if it's 1 it's enabled and 0 it's disabled, then compare to how much energy you have left and interact with the button. I thought this feature was already in API but I guess not... Just checked the interfaces and they don't change whether its on or off. EDIT: Figured it out If you start the script with run on, and use a message listener to figure out if its been turned off or not, you can then change a variable from true or false to detect whether to call the run function or not. Here it is: boolean runCheck = true; //whether run is or or is not on checking variable //message listener to receive the message you are out of energy public void onMessage(String m) { if (m.toLowerCase().contains("whatever the out of run message is")) { runCheck = false; } } //whether to toggle run energy (add this to your main code when you want to check) if (runCheck == false && client.getRunEnergy() > 30) { toggleRun(); } //toggle run function public void toggleRun() throws InterruptedException { openTab(Tab.SETTINGS); sleep(random(100, 200)); client.getInterface(261).getChild(0).interact(); sleep(random(218, 721)); runCheck = true; } I just made this now so it may not work, but the logic tells me if should. Only problem is there's no failsafe in case the button somehow doesn't get clicked. This would mess it all up. EDIT AGAIN: Theres no message when your run energy turns off. FML Edited October 13, 201312 yr by Swizzbeat
October 14, 201312 yr ^ Lol? So easy just to fetch the config which will display the run button either in red (actived = 1) or (default gray = 0) when disabled.Also if you lose all your run energy you aren't notified in any other matter than run mode/button toggling off, no game message is sent. # L2 clientconfigs/ interface scripting cs1/cs2 if (client.getRunEnergy() > 30 && client.getConfig(173) == 0) { sleep(400, 500); openTab(Tab.SETTINGS); sleep(random(200, 500)); client.getInterface(261).getChild(46).interact(); return 3000; } Edited October 14, 201312 yr by rsdude282
October 14, 201312 yr Author if (client.getRunEnergy() > 30 && client.getConfig(173) == 0) { sleep(400, 500); openTab(Tab.SETTINGS); sleep(random(200, 500)); client.getInterface(261).getChild(46).interact(); return 3000; } Thanks bro if this works will test this later
October 14, 201312 yr Loled at previous posts. To see if your player is running: MethodProvider#isRunning To get the amount of energy your player has left: Client#getRunEnergy To toggle run on/off: setRunning(boolean run);