Jump to content

Spam-ish Interacting?


Deceiver

Recommended Posts

As some of u know, I put out a little powerminer for the WWF area, it works all dandy and well besides the spam clicking for object interaction:

 

https://vid.me/ZXMF

 

And code:

  if (MINING.contains(this.myPlayer())) {
            final Entity rock = objects.closest("Pile of rock");
            if (rock != null && rock.isVisible() && !this.myPlayer().isAnimating()) {
                rock.interact("Mine");
               ConditionalSleep(2000);
            } else {
                camera.toEntity(rock);

Could anyone provide insight on to why it spam clicks?

Link to comment
Share on other sites

When you are mining, like cooking, there are breaks in animations while you are still mining. 

If you are only using isAnimating, then even though you are still mining, there will be a split second where isAnimating will return false, i.e. a break in the animation. 

Even though your player will continue mining after that split second break, the script will only know that the player is not animating, and it will try to interact again. 

 

You need to have some tracker to see how long you have been idle for. 

 

For example, only interact if you are idle for > 300 ms. 

Then if a animation break last 100 ms, the animation break will not trigger another interaction.

 

If that makes sense. 

  • Like 1
Link to comment
Share on other sites

When you are mining, like cooking, there are breaks in animations while you are still mining. 

If you are only using isAnimating, then even though you are still mining, there will be a split second where isAnimating will return false, i.e. a break in the animation. 

Even though your player will continue mining after that split second break, the script will only know that the player is not animating, and it will try to interact again. 

 

You need to have some tracker to see how long you have been idle for. 

 

For example, only interact if you are idle for > 300 ms. 

Then if a animation break last 100 ms, the animation break will not trigger another interaction.

 

If that makes sense. 

 

I didn't know that actually, thanks for the info! (I haven't run into this problem in my cooking script, although that's probably cause I test multiple conditions, I'll look into this more) 

 

@OP Use normal sleep as mentioned above or properly implement conditional sleep 

Edited by Omicron
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...