xkalibur13
-
Posts
3 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Articles
Store
Posts posted by xkalibur13
-
-
I've tested this and it works
private void dealWithRandomEvent() { NPC npc = npcs().query().results().nearest(); if (npc == null) return; if (!npc.hasAction("Dismiss")) return; mouse().moveRandomly(random(500,4000)); npc.interact("Dismiss"); System.out.println(npc.getName() + " dismissed"); mouse().moveOffScreen(); }
- 1
-
I haven't been able to test this, nor have I looked into handling randomevents until now. but this would be my first stab at it:
private boolean handleRandomEvent() { LocatableEntityQueryResult<NPC> results = getAPIContext().npcs().query().actions("Dismiss").results(); if(results.isEmpty()) return false; try { results.nearest().interact("Dismiss"); } catch (Exception e) { // print message for debugging purposes getLogger().debug("Caught error: " + e.getMessage()); } return true; } }
lmk if you make any progress
[Open Source] Cowhide Collector FSM
in Resource Gathering
Posted · Edited by xkalibur13
changed `getStatusMsg()` to `toString()` with override annotation
This is an improvement to Zynava's open source project at this link
I hope that this code helps people who are somewhat new to java and the EB API understand an easy way to complete tasks in succession, while practicing good coding style and readability
There is one instance of Time.sleep(int a) to reduce the number of times the cowhide is clicked. Please drop your suggestions for improvements as though I'm familiar with java I am also somewhat new to using the EB API 🙂