Jump to content

Interact vs. Hover-Click


DylanSRT

Recommended Posts

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. 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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