todamach Posted June 23, 2014 Share Posted June 23, 2014 if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { // click } } it will still click every animation reset. How can i fix this? Link to comment Share on other sites More sharing options...
Mysteryy Posted June 23, 2014 Share Posted June 23, 2014 if (!myPlayer().isAnimating()) { if (!myPlayer().isMoving()) { // click } } it will still click every animation reset. How can i fix this? What are you trying to do? Do you not understand the code here, or what is the issue? With those two conditional statements, any time that your player is not doing anything, and not moving, that //click code will execute. What are you wanting it to do? Let me know so I can help you out. ^_^ Link to comment Share on other sites More sharing options...
todamach Posted June 23, 2014 Author Share Posted June 23, 2014 I completely understand the code. Let's say I'm mining. I'm standing still, and not animating. It will click on the rock. It will start animating. But animation isn't endless. It is looping, but between every loop, it stops for a short time. And in that momment it clicks again on the rock. Link to comment Share on other sites More sharing options...
Botre Posted June 23, 2014 Share Posted June 23, 2014 (edited) While (animating) { sleep for the duration of one animation cycle; } The time of a full cycle will always be a multiple of 600 (in ms). Another way of doing it would be to start a timer once you are not animating anymore, and if this timer exceeds the animation rest time -> re-click rock. Edited June 23, 2014 by Botrepreneur Link to comment Share on other sites More sharing options...
todamach Posted June 23, 2014 Author Share Posted June 23, 2014 Thanks for such informative answer. I don't think sleeping for a full cycle is an option, because mining animation is probobly close to 6 seconds, so it way too long to sleep. I'll try to do the timer thing. Also, what I was doing myself, but for some reason it doesn't work right for me: while(ore.exists(){ sleep(150); } So basically, it should be stuck in this loop while ore exists, but for some reason it exits after about 10 seconds. Link to comment Share on other sites More sharing options...
Botre Posted June 23, 2014 Share Posted June 23, 2014 Thanks for such informative answer. I don't think sleeping for a full cycle is an option, because mining animation is probobly close to 6 seconds, so it way too long to sleep. I'll try to do the timer thing. Also, what I was doing myself, but for some reason it doesn't work right for me: while(ore.exists(){ sleep(150); } So basically, it should be stuck in this loop while ore exists, but for some reason it exits after about 10 seconds. If you stay near the object in question it shouldn't cease existing. Objects change reference when the game reloads (walking away to far / logging out) unless you use their unique hash value as explained by Laz here: http://osbot.org/forum/topic/54215-object-reference-becomes-irrelevant-when-reloading-how-to/ Or is the object you are trying to mine dynamic ? Does it have multiple states? In that case you might need to revisit its declaration. Link to comment Share on other sites More sharing options...
todamach Posted June 23, 2014 Author Share Posted June 23, 2014 Well, I'm mining it, so I'm standing in front of it. Not sure what dynamic or multiple states exactly is, but I don't think so. I'm mining Pay-dirt from Ore veins in motherlode. When ore veins are mined (depleted) it changes to other object with different id. So, I think, that's where my loop should exit. But it constantly exits even if ore vein is still there - not depleted, not changed to other object. Link to comment Share on other sites More sharing options...
Mysteryy Posted June 23, 2014 Share Posted June 23, 2014 Well, I'm mining it, so I'm standing in front of it. Not sure what dynamic or multiple states exactly is, but I don't think so. I'm mining Pay-dirt from Ore veins in motherlode. When ore veins are mined (depleted) it changes to other object with different id. So, I think, that's where my loop should exit. But it constantly exits even if ore vein is still there - not depleted, not changed to other object. So what you are saying is that when you do the mining animation, then it stops for a second between animations, and the script clicks the rock again even though it doesnt need to click the rock because you are still mining correct? Link to comment Share on other sites More sharing options...
Botre Posted June 23, 2014 Share Posted June 23, 2014 Well, I'm mining it, so I'm standing in front of it. Not sure what dynamic or multiple states exactly is, but I don't think so. I'm mining Pay-dirt from Ore veins in motherlode. When ore veins are mined (depleted) it changes to other object with different id. So, I think, that's where my loop should exit. But it constantly exits even if ore vein is still there - not depleted, not changed to other object. Motherlode ore veins are dynamic / have multiple states. Get its depleted id or model and use that reference to check if the vein is depleted instead (the depleted state, contrary to the undepleted state, is static). Link to comment Share on other sites More sharing options...
todamach Posted June 23, 2014 Author Share Posted June 23, 2014 Motherlode ore veins are dynamic / have multiple states. Get its depleted id or model and use that reference to check if the vein is depleted instead (the depleted state, contrary to the undepleted state, is static). Thanks. This will make my script run much smoother. I'll try to implement it tomorrow (today..... -.-), because it's very late (early -.-) now. I hope you won't mind if I will PM you with a question or two. Link to comment Share on other sites More sharing options...
Joseph Posted June 23, 2014 Share Posted June 23, 2014 Thanks. This will make my script run much smoother. I'll try to implement it tomorrow (today..... -.-), because it's very late (early -.-) now. I hope you won't mind if I will PM you with a question or two. use a timer class determine how long the sleep is between the two animation. create two if statements. If your not animating, then mine. if your animating. create a new methods within the methos, create a while loop, check the timer, and see if it has passed the time between animation. within the while loop, add a if statement, is animating if its true just reset the timer. Link to comment Share on other sites More sharing options...
todamach Posted June 23, 2014 Author Share Posted June 23, 2014 use a timer class determine how long the sleep is between the two animation. create two if statements. If your not animating, then mine. if your animating. create a new methods within the methos, create a while loop, check the timer, and see if it has passed the time between animation. within the while loop, add a if statement, is animating if its true just reset the timer. What if someone else gets the last ore, and you are left animating at the depleted one? Link to comment Share on other sites More sharing options...
Khaleesi Posted June 23, 2014 Share Posted June 23, 2014 You can also keep checking the ore you are mining, so while the ore isn't mined, don't interact with it. I guess there a lot of ways to fix this Link to comment Share on other sites More sharing options...
todamach Posted June 23, 2014 Author Share Posted June 23, 2014 You can also keep checking the ore you are mining, so while the ore isn't mined, don't interact with it. I guess there a lot of ways to fix this Apparently, ores I try to mine are dynamic/has multiple states. So this method doesn't quite work. Botrepreneur suggested to track it's depleted model/id instead. I'll try that in the evening today. I'll be busy all day. Link to comment Share on other sites More sharing options...
Khaleesi Posted June 23, 2014 Share Posted June 23, 2014 Apparently, ores I try to mine are dynamic/has multiple states. So this method doesn't quite work. Botrepreneur suggested to track it's depleted model/id instead. I'll try that in the evening today. I'll be busy all day. Ya you could use the modelID's ... just check out the different options What ores are u trying to mine? Link to comment Share on other sites More sharing options...