beefsteak 30 Share Posted June 25, 2020 Heyo, working on a simple script that fights mobs on Karamja and banks at Port Sarim depot box. Having some issues with this if statement for paying the seaman/customs officer. I thought I'd just need to add a parentheses, but when I do it makes a ton of other errors pop up. Also, my filter is fucked up, not sure if thats affecting this at all. Line 98 error: "syntax error, insert ") statement" to complete IfStatement" Filter error: "must implement the inherent abstract method Filter<NPC>.match<NPC>" NOOB CODER HERE, PLEASE SHAME ME AND MY LACK OF CODING SKILLS Thanks Link to comment Share on other sites More sharing options...
Xtra 31 Share Posted June 25, 2020 I would highly recommend an IDE such as IntelliJ, as it helps to tell you what's wrong with your code and gives suggestions Why would you want to check if you, the local player is not null? Also that line is missing a ')' after the: getGameObjects().closest("Gangplank") != null) <-- You could use: getGameObjects().closest(plank -> plank != null && plank.hasAction("Cross")); For your dialogue part you could condense it down a bit to this, also a friendly reminder to use the java naming conventions, just makes it easier for others to read when using the standards. This is an adaptation of your second dialogue: if (port2Area.contains(getLocalPlayer()) && sailor2 != null) { if (getDialogues().inDialogue()) { getDialogues().spaceToContinue(); getDialogues().chooseOption("Can I journey on this ship?"); } else { NPC sailor2 = getNpcs().closest("Customs officer"); sailor2.interact("Pay-fare"); sleepUntil(() -> getDialogues().inDialogue(), 8000); } You could condense your entire dialogue into one very similar to this ^ just add the other option from the other sailor dialogue under "Can I journey on this ship?" and it will cycle through until it finds that option. It will skip the irrelevant options. You would also need to probably do something like, if in port1Area OR port2Area, and if the sailors are not null (always null check) then if in dialogue, do the dialogue, if not, initiate conversation and wait until in conversation. There are probably better ways of doing this, but I have found success with this method. Also are you trying to fight the monkeys? What are you trying to script regarding them? Good luck! Link to comment Share on other sites More sharing options...
Auroch 4 Share Posted June 25, 2020 GameObject plank = getGameObjects.closest(p -> p != null && p.hasAction("Cross")); if(plank.exists()){ plank.interact("Cross"); sleepUntil(() -> !getLocalPlayer.isAnimating()); } break; Like ^ said, this should work and is decently formatted Edit: Wanted to add for learning purposes, Your debugger says specifically, syntax error, insert ") statement" to complete ifStatement and the red line shows where it expects a ) to be, or if there's one ) extra, the red line appears where it should not be Also: figured out the other issue, your NPC filter is missing code that needs to be there to use new Filter<foo> This is what a completed Filter<foo> should look like: public static final Filter<Item> HIDE_FILTER = new Filter<Item>() { @Override public boolean match(Item item) { if (item == null) { return false; } return item.getName().equals(COWHIDE); //Checks i item equals Cowhide } } you must include an @Override and the boolean "match(Foo bar){}" Replace "Item" with NPC and it should be fine Link to comment Share on other sites More sharing options...
beefsteak 30 Author Share Posted June 25, 2020 Wow okay thank you this is verrrry helpful. Struggled with streamlining the code, I figured there was a lot of unnecessary stuff in there. Appreciate it! And yes, its going to be a simple monkey killing script, definitely not working at the moment but still trying to fix a few more kinks with the state selection part. Link to comment Share on other sites More sharing options...
Xtra 31 Share Posted June 25, 2020 No problem, let us know how you get on! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.