DeadmanVlei 1 Share Posted November 20, 2018 I'm not sure what's up with getLocalPlayer().isAnimating() but it returns false way more often than it should. I'm trying to make a decent course runner for agility training but I can't avoid multi-clicking on objects. If I delay enough time for the animation to complete, but you haven't started the animation yet, there's a long delay before the next click, the player seems to suck at the agility course. If I don't delay, it wants to keep clicking on objects as I'm doing the obstacle, which, if jagex are getting those mouseclicks, looks like a superhuman who can track stuff at any speed while the camera is rotating to click on it, and do that 100 times without ever missing a click. How can I tell when I'm doing an obstacle? In general this has been my biggest problem with Dreambot. No matter what script I want to write, it always seems I have to do something hacky to detect if my player is actually doing something. I know I can detect the players area and go by that, and I already do that so when they leave the area it stops clicking on that thing, but many objects like tightropes are inside the area, so there is animation playing long before you've left the area, and I don't want 4 or 5 clicks during that time. Link to comment Share on other sites More sharing options...
jamess 0 Share Posted November 20, 2018 I'm not a good programmer but I have dealt with this problem too (all scripters have). All bot clients have this problem. I think it is just how the game is designed. If you want to know if you are on an obstacle you can do: obstacle.interact(); sleepUntil(() -> getLocalPlayer().isAnimating(), 7000); make sure you aren't clicking obstacles while animating as well. You can also try using xp drops in agility to know when an obstacle is done. You must also use isMoving() to fight this problem. Runescape has awkward delays in ticks so scripting is a constant battle against these delays and stuff. You can also make variable delay for each action without increasing the delay for all actions eg: @Override public int onLoop() { int delay = Calculations.random(400, 600); Player me = getLocalPlayer(); if (!me.isMoving() && !me.isAnimating()) { //this makes sure you arent clicking while on a obstacle nor when running to one obstacle.interact(); sleepUntil(() -> me.isAnimating(), 7000); delay = Calculations.random(2000, 2500); //not much point doing this here with the return after it but it can control delay return Calculations.random(2000,2500); //you can also do this to control delay. } return delay; } It can be easier to just up the general delay in many cases. You often wont lose as much xp or gold as you think. Link to comment Share on other sites More sharing options...
Pseudo 179 Share Posted November 21, 2018 Another way of handling it is by: When you detect that the player is animating (and so completing an obstacle), store that previously interacted object (most likely by tile, in case the next one is identified by the same name) to a blacklist/factor it into the condition for interacting with the next obstacle. Link to comment Share on other sites More sharing options...
ozeki6 32 Share Posted November 21, 2018 23 hours ago, DeadmanVlei said: I'm not sure what's up with getLocalPlayer().isAnimating() but it returns false way more often than it should. I'm trying to make a decent course runner for agility training but I can't avoid multi-clicking on objects. If I delay enough time for the animation to complete, but you haven't started the animation yet, there's a long delay before the next click, the player seems to suck at the agility course. If I don't delay, it wants to keep clicking on objects as I'm doing the obstacle, which, if jagex are getting those mouseclicks, looks like a superhuman who can track stuff at any speed while the camera is rotating to click on it, and do that 100 times without ever missing a click. How can I tell when I'm doing an obstacle? In general this has been my biggest problem with Dreambot. No matter what script I want to write, it always seems I have to do something hacky to detect if my player is actually doing something. I know I can detect the players area and go by that, and I already do that so when they leave the area it stops clicking on that thing, but many objects like tightropes are inside the area, so there is animation playing long before you've left the area, and I don't want 4 or 5 clicks during that time. Check if player is animating or moving. I remember that at gnome agility course the character was moving and not animating in some situations like when walking on a log. this code handles all obstacles in my gnome agility script. void doObstacle() { if (!context.getLocalPlayer().isMoving()) { context.getGameObjects().closest(obstacleName).interact(interaction); MethodProvider.sleepUntil(()->context.getLocalPlayer().getAnimation() == 828 , 4500); if (context.getLocalPlayer().getAnimation() == 828) { Tile currentTile = context.getLocalPlayer().getTile(); MethodProvider.sleepUntil(() -> !currentTile.equals(context.getLocalPlayer().getTile()), 5000); } else MethodProvider.sleepUntil(() -> !context.getLocalPlayer().isMoving(), 15000); } } This will only work well for gnome agility. I think 828 is the animation for the character when it climbs the net and I think that's the only animation in a gnome agility trip. So, if player is not moving it will interact with an obstacle then it will wait 4.5 seconds or until character animation equals 828. Most of the time it will wait 4.5 seconds and all interactions (excluding the ones that use 828 animation) take more than that. While interacting with the obstacle player will move so it will not click on the obstacle anymore. I'll let you figure out the rest. Link to comment Share on other sites More sharing options...
DeadmanVlei 1 Author Share Posted November 21, 2018 Thanks, but that still doesn't catch it for most agility courses. I've got working rounds on <redacted> now. The code works fine, but even though I do !(p.isAnimating() || p.isMoving()) or (!p.isAnimating && !p.isMoving()) or something similar, it still clicks while i'm climbing onto obstacles, which would seem to use an animation. Link to comment Share on other sites More sharing options...
ozeki6 32 Share Posted November 21, 2018 57 minutes ago, DeadmanVlei said: Thanks, but that still doesn't catch it for most agility courses. I've got working rounds on Draynor, Al-kharid, Canifis, and Fally rooftops. I'm working on the werewolf agility course now. The code works fine, but even though I do !(p.isAnimating() || p.isMoving()) or (!p.isAnimating && !p.isMoving()) or something similar, it still clicks while i'm climbing onto obstacles, which would seem to use an animation. No. Your script logic is most likely bad. You need to figure it out, it's not that hard. If it's not animating then it's most likely moving. Link to comment Share on other sites More sharing options...
DeadmanVlei 1 Author Share Posted November 21, 2018 I'm a game developer, I understand in a scripting website it's easy to write people off, but my script logic is not bad. There are animations and movements not being caught by those two functions. if (!getLocalPlayer().isAnimating && !getLocalPlayer().isMoving) { gm.interact(); } Is not a complicated section of code. It works, it's getting to the interaction, and interacting, it's just also doing it while the player is animating and or moving on certain movements and animations. Also there was no yes or no question, so starting a post with "No", when what you actually mean is, "You're wrong because I read your post and my first thought was that you were wrong", is kinda pretentious. Link to comment Share on other sites More sharing options...
ozeki6 32 Share Posted November 21, 2018 40 minutes ago, DeadmanVlei said: I'm a game developer, I understand in a scripting website it's easy to write people off, but my script logic is not bad. There are animations and movements not being caught by those two functions. if (!getLocalPlayer().isAnimating && !getLocalPlayer().isMoving) { gm.interact(); } Is not a complicated section of code. It works, it's getting to the interaction, and interacting, it's just also doing it while the player is animating and or moving on certain movements and animations. Also there was no yes or no question, so starting a post with "No", when what you actually mean is, "You're wrong because I read your post and my first thought was that you were wrong", is kinda pretentious. Yep, it's not that simple, lol. Sometimes the character stops animating or moving while trying to interact with an obstacle. Use Tools -> Entity hover to check if the animations stops at some point and if it doesn't use an animation in the first place then it means the character stops from moving at some point. You will need to write custom methods from certain obstacles. When that happens you could write a method that sleeps until the character reached the destination (the end of the obstacle) or something else. Link to comment Share on other sites More sharing options...
DeadmanVlei 1 Author Share Posted November 22, 2018 So in other words what you're saying is... that some visible animations aren't actually running animations, and that therefor isAnimating() wont return true. So isAnimating does not actually represent whether or not an animation is happening... Yet my script logic is at fault, even though that was exactly my point? Quote When you detect that the player is animating (and so completing an obstacle), store that previously interacted object (most likely by tile, in case the next one is identified by the same name) to a blacklist/factor it into the condition for interacting with the next obstacle. I'm gonna do this. Probably by ID, and use it to make a more inside-out approach to the courses, using movement beginnings as markers instead of animation and movement endings, thanks for the suggestion, Pseudo. Link to comment Share on other sites More sharing options...
jamess 0 Share Posted November 22, 2018 The isAnimating() method is not broken. It works like this on all bot clients i've tried. It's how the game works. Go to tools, then settings, then activate Player: animation. You'll see the animation reach -1 (not animating) when you think it wouldn't. The character stops animating for small periods in between actions and a low delay catches these small windows much more often. An example of what happens when you try to do things with low delay is: (!getLocalPlayer.isMoving()) gameObject.interact(); //this will often double click at low delay if you werent moving beforehand because your character wont move until tick ends. (!getLocalPlayer.isMoving() && !getLocalPlayer.isAnimating()) gameObject.interact(); //same problem as above, also when you reach the object to interact with, you will often both stop animating and moving, causing multiple clicks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.