rallostar Posted July 16, 2017 Share Posted July 16, 2017 (edited) Hi guys, its me again. Making some progress on my first script but i ran into an issue. I am trying to make the script check if i'm wearing a ring (to check if there are still duelling ring charges). This is my code but it doesn't seem to work if (!equipment.isWearingItem(EquipmentSlot.RING)) { log("no ring"); status = "Withdrawing ring of duelling"; getBank().withdraw("Ring of duelling(8)", 1); new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return inventory.contains("Ring of duelling(8)"); } }.sleep(); bank.close(); sleep(random(500,700)); inventory.getItem("Ring of duelling(8)").interact("Wear"); new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return getEquipment().isWearingItem(EquipmentSlot.RING); } }.sleep(); } I believe the issue is in the first if statement of isWearingItem Edited July 16, 2017 by rallostar Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted July 16, 2017 Share Posted July 16, 2017 (edited) Not on an IDE but probs something like if (!equipment.isWearingItem(EquipmentSlot.RING, duelring -> duelring.getName().contains("Ring of duelling"))){ // no ring Edit: Thinking about it, isn't there isWearingItemThatContains? Edited July 16, 2017 by HeyImJamie 1 Quote Link to comment Share on other sites More sharing options...
rallostar Posted July 16, 2017 Author Share Posted July 16, 2017 (edited) 15 minutes ago, HeyImJamie said: Not on an IDE but probs something like if (!equipment.isWearingItem(EquipmentSlot.RING, duelring -> duelring.getName().contains("Ring of duelling"))){ // no ring Edit: Thinking about it, isn't there isWearingItemThatContains? Yes that's true but can't I just check if ring is empty? Would be a smaller code too. I'll try it with isWearingItemThatContains tho to see if that works. EDIT: It worked and logged the No Ring string, but then it logged this error: [ERROR][Bot #1][07/17 01:34:37 AM]: Error in script executor! java.lang.NullPointerException at Main.onLoop(Main.java:190) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(vj:152) at java.lang.Thread.run(Thread.java:745) this error comes after sleeping for 10000 ms dunno where its coming from Edited July 16, 2017 by rallostar Quote Link to comment Share on other sites More sharing options...
Abysm Posted July 16, 2017 Share Posted July 16, 2017 Maybe because its "Ring of dueling" with 1 "L" and not 2? 1 Quote Link to comment Share on other sites More sharing options...
rallostar Posted July 16, 2017 Author Share Posted July 16, 2017 1 minute ago, Abysm said: Maybe because its "Ring of dueling" with 1 "L" and not 2? Lol wtf.. I googled it but in RS3 it's duelling and osrs its dueling. Thanks mate ! Quote Link to comment Share on other sites More sharing options...
Abysm Posted July 16, 2017 Share Posted July 16, 2017 (edited) 5 minutes ago, rallostar said: Lol wtf.. I googled it but in RS3 it's duelling and osrs its dueling. Thanks mate ! Even the smallest mistakes make your script fail You might want to use the filter @HeyImJamie provided you so the bot can use ring of dueling no matter how much charges it has Edited July 16, 2017 by Abysm Quote Link to comment Share on other sites More sharing options...
rallostar Posted July 16, 2017 Author Share Posted July 16, 2017 5 minutes ago, Abysm said: Even the smallest mistakes make your script fail You might want to use the filter @HeyImJamie provided you so the bot can use ring of dueling no matter how much charges it has Yes I'm using that now! Thanks @Abysm & @HeyImJamie 1 Quote Link to comment Share on other sites More sharing options...