abouhanafy87 4 Posted February 3, 2023 hellow every body my SleepUntil condition didn't work with me > this is my code can any one try it . in the mother load mining area. nodefilter = g-> g!=null && g.exists() && Mining_area.contains(g) && g.getName().equals("Ore vein"); currentNode = GameObjects.closest(nodefilter); if (currentNode.interactForceLeft("Mine")) { Sleep.sleepUntil(()-> !currentNode.exists() || Inventory.isFull(), 25000);//didn't work here and sleep for 25 s every time. } what's about you ? Are this happen with any one of you ? @Pandemic
hashbang 8 Posted February 3, 2023 Try logging the output of those two statements to see their values, you may realise the predicate is never true. if (currentNode.interactForceLeft("Mine")) { Sleep.sleepUntil(()-> { Logger.log("currentNode.exists(): " + currentNode.exists()); Logger.log("Inventory.isFull(): " + Inventory.isFull()); return !currentNode.exists() || Inventory.isFull() }, 25000); }
prechcik 33 Posted February 4, 2023 GameObject.closest() can return null, so make sure You check if it's null, then if exists i.e Sleep.sleepUntil(() -> currentNode == null || !currentNode.exists() || Inventory.isFull(), 25000)
Aeglen 352 Posted February 5, 2023 On 2/3/2023 at 8:13 AM, abouhanafy87 said: hellow every body my SleepUntil condition didn't work with me > this is my code can any one try it . in the mother load mining area. nodefilter = g-> g!=null && g.exists() && Mining_area.contains(g) && g.getName().equals("Ore vein"); currentNode = GameObjects.closest(nodefilter); if (currentNode.interactForceLeft("Mine")) { Sleep.sleepUntil(()-> !currentNode.exists() || Inventory.isFull(), 25000);//didn't work here and sleep for 25 s every time. } what's about you ? Are this happen with any one of you ? @Pandemic the node probably never stops existing, maybe its actions change and you can tell from that
una_maquina 35 Posted February 5, 2023 (edited) On a sidenote, never use fixed sleeping times. Change that 25000 into Calculations.random(25000,35000) Edited February 5, 2023 by una_maquina
abouhanafy87 4 Author Posted February 5, 2023 On 2/4/2023 at 8:43 AM, prechcik said: GameObject.closest() can return null, so make sure You check if it's null, then if exists i.e Sleep.sleepUntil(() -> currentNode == null || !currentNode.exists() || Inventory.isFull(), 25000) nodefilter check this . nodefilter = g-> g!=null && g.exists() && Mining_area.contains(g) && g.getName().equals("Ore vein");
abouhanafy87 4 Author Posted February 5, 2023 On 2/3/2023 at 9:06 PM, hashbang said: Try logging the output of those two statements to see their values, you may realise the predicate is never true. if (currentNode.interactForceLeft("Mine")) { Sleep.sleepUntil(()-> { Logger.log("currentNode.exists(): " + currentNode.exists()); Logger.log("Inventory.isFull(): " + Inventory.isFull()); return !currentNode.exists() || Inventory.isFull() }, 25000); } i try this and the result : currentNode.exists(): false Inventory.isFull(): false and still sleep to 25 s. i try to check it by name if (currentNode.interactForceLeft("Mine")) { Sleep.sleepUntil(()-> { Logger.log("currentNode.isOrevein: " + currentNode.getName.equal("Ore vein")); Logger.log("Inventory.isFull(): " + Inventory.isFull()); return !currentNode.exists() || Inventory.isFull(); }, 25000); } the result : currentNode.isOrevein:true // when the currentNode name is " Depleted vein" Inventory.isFull(): false
prechcik 33 Posted February 5, 2023 I would recommend either to check the veins by their ids as they change, or look for another way of waiting until certain condition finished. As to the mining, is there anything stopping you from executing the left click only if Player is not animating? Afaik mining animation doesnt flicker so You could sleep while animating - that would prevent it from clicking again when already mining. Your name comparison is kind of weird, you said you used currentNode.getName() .equals("Ore vein") and then when the vein had name Depleted vein it still returned true, that would point out that you are comparing the wrong object. abouhanafy87 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now