July 18, 20178 yr Is there any way to check how long the bot has been in Idle for? Say that i want my bot to do certain things, but in case it idles for say 7sec+ for etc, i want it to move position?
July 18, 20178 yr Seems like you are doing something wrong or need to improve your script. Why would you need to detect if you are idle for 7 seconds? Makes no sense to me Edited July 18, 20178 yr by Explv
July 18, 20178 yr 11 minutes ago, Explv said: Seems like you are doing something wrong or need to improve your script. Why would you need to detect if you are idle for 7 seconds? Makes no sense to me I think like a failsafe or something. But 7 secs seems too low. E.g some scripts auto stops the script if no xp has been gained over a period of 7-10 minutes. In case it fucked up somewhere
July 18, 20178 yr 8 minutes ago, Visty said: I think like a failsafe or something. But 7 secs seems too low. E.g some scripts auto stops the script if no xp has been gained over a period of 7-10 minutes. In case it fucked up somewhere You should probably aim for your script to not fuck up then
July 18, 20178 yr 2 minutes ago, Explv said: You should probably aim for your script to not fuck up then True father
July 18, 20178 yr @slazter if you really have to do it, then you can probably make use of the isAnimating and isMoving methods in the Character class, in combination with some kind of timer. Edited July 18, 20178 yr by Explv
July 18, 20178 yr Check plague doctor's cannonball maker he has something like that done for the sleep I think?
July 18, 20178 yr Author Managed to solve it with something kind of what @Explv suggested, if(myPlayer().isMoving() || myPlayer().isAnimating()){ time = System.currentTimeMillis(); } else if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ timeToMove=System.currentTimeMillis(); if(timeToMove>time+5000){ //Code } } } Mabye not the most elegant solution, but i gets the job done while i think of a better Solution
July 19, 20178 yr It's a good solution, just be clear on how you write it so you don't get confused later (variable naming). time variables have to be global. private boolean idleFor(int millis){ if(myPlayer().isAnimating() || myPlayer.isMoving()) { timeSinceAction = System.currentTimeMillis(); } else { timeSinceIdle = System.currentTimeMillis(); } return timeSinceAction + millis < timeSinceIdle; } Edited July 19, 20178 yr by dreameo
July 19, 20178 yr Author 17 hours ago, dreameo said: It's a good solution, just be clear on how you write it so you don't get confused later (variable naming). time variables have to be global. private boolean idleFor(int millis){ if(myPlayer().isAnimating() || myPlayer.isMoving()) { timeSinceAction = System.currentTimeMillis(); } else { timeSinceIdle = System.currentTimeMillis(); } return timeSinceAction + millis < timeSinceIdle; } Hmm this was actually very neat, im gonna go ahead and save this snippet, thanks!
July 20, 20178 yr Yeah, there will be a lot of methods that you use often, keep them clean and separate. Reduces code duplication and makes life easier. Ex: a timer class
Create an account or sign in to comment