- Joined
- Dec 18, 2014
- Messages
- 398
- Thread Author
- #1
I'm sorry if this is basic, but I'm getting very frustrated because something that should be absurdly simple is not working out.
For some reason, with the following code, the mouse would have an approximately 1/3 chance of not pulling the second click off and skipping directly to that last part of the code. The mouse always moves right next to the actual SpriteItem, without getting to it.
SpriteItem arrowShafts;
SpriteItem feathers;
if(Inventory.containsAllOf(ARROW_SHAFT_ID, FEATHER_ID))
{
arrowShafts = Inventory.getItems(ARROW_SHAFT_ID).first();
feathers = Inventory.getItems(FEATHER_ID).first();
}
arrowShafts.click();
// Execution.delay(56, 256, 128);
feathers.click();
// Execution.delay(56, 256, 128);
Execution.delayUntil(() -> someInterface.isVisible(), 400, 800);
Keyboard.typeKey(" ");
I tried amending this with various constructs, such as
Execution.delay,
surrounding the clicks with if statements,
clicking the interactable bounds instead of the SpriteItem itself,
delayUntil() -> feathers.click().
None of them made any difference except the last one, which caused problems by clicking more than once every time. Is the mouse is clicking on the edge of the inventory slot without clicking on the SpriteItem itself? Is there a way to ascertain that the second click will happen?
For some reason, with the following code, the mouse would have an approximately 1/3 chance of not pulling the second click off and skipping directly to that last part of the code. The mouse always moves right next to the actual SpriteItem, without getting to it.
SpriteItem arrowShafts;
SpriteItem feathers;
if(Inventory.containsAllOf(ARROW_SHAFT_ID, FEATHER_ID))
{
arrowShafts = Inventory.getItems(ARROW_SHAFT_ID).first();
feathers = Inventory.getItems(FEATHER_ID).first();
}
arrowShafts.click();
// Execution.delay(56, 256, 128);
feathers.click();
// Execution.delay(56, 256, 128);
Execution.delayUntil(() -> someInterface.isVisible(), 400, 800);
Keyboard.typeKey(" ");
I tried amending this with various constructs, such as
Execution.delay,
surrounding the clicks with if statements,
clicking the interactable bounds instead of the SpriteItem itself,
delayUntil() -> feathers.click().
None of them made any difference except the last one, which caused problems by clicking more than once every time. Is the mouse is clicking on the edge of the inventory slot without clicking on the SpriteItem itself? Is there a way to ascertain that the second click will happen?
Last edited: