Jump to content

Interact vs. Hover-Click


Recommended Posts

Posted

In my scripts, I have found that hover-clicking is much more reliable than interact when you want to use a left click action (primarily for an item in the inventory). I was just curious if anyone else has noticed this or knows why this happens. For example, let's say we are making a script for repeatedly using pestle and mortar on an Herblore secondary. 

 

inventory.interact("Use","Pestle & mortar");
inventory.interact("Use","Chocolate bar");

The code above, which seems the most straightforward will eventually misclick. The only way to stop it from misclicking is to put an unnecessarily long sleep in between (somewhere around 500ms).

Whereas the code below never misclicks (even without sleeps) and runs extremely fast.

inventory.getItem("Pestle & mortar").hover();
mouse.click(false);
inventory.getItem("Chocolate bar").hover();
mouse.click(false);

I was just curious as to why hover-click is more reliable? I would assume the interact method is derived from some sort of hover + click. 

Posted (edited)

Your correct, hover, then click ensures proper sleep within the hover itself.

However, does mouse.click(false) doesnt that mean dont click? True = click yes?

 

*

inventory.getItem("Pestle & mortar").hover();
mouse.click(false);

 

The transition from hover to click is the sleep.

Edited by z10n
Posted

It will misclick because you're not checking if the item is selected before clicking next...

if (!itemIsSelected) {
    inventory.interact("Use","Pestle and mortar");

       sleepCondition 

           return itemIsSelected();

} else {

     inventory.interact("Use","Pestle and mortar");

       sleepCondition 

           return inDialogue();

}


This is the proper way to do it so that you won't misclick or bugs won't occur. If you don't check and have sleeps then it will misclick

Posted
38 minutes ago, z10n said:

Your correct, hover, then click ensures proper sleep within the hover itself.

However, does mouse.click(false) doesnt that mean dont click? True = click yes?

 

*


inventory.getItem("Pestle & mortar").hover();
mouse.click(false);

 

The transition from hover to click is the sleep.

The boolean value represents whether it should right-click or not.

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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