HunterRS Posted September 22, 2017 Share Posted September 22, 2017 so I have this code: case ALCH: if(getMagic().canCast(NormalSpells.HIGH_LEVEL_ALCHEMY)){ if(!myPlayer().isAnimating()){ if(getMagic().castSpell(NormalSpells.HIGH_LEVEL_ALCHEMY)){ status = "Alching"; if(getInventory().interact("Cast", "Maple longbow")){ new ConditionalSleep(3000) { @Override public boolean condition() { return myPlayer().isAnimating(); } }.sleep(); } } } } break; ?and I am geting a freaking NPE on declarin the ConditionalSleep, any idea why Quote Link to comment Share on other sites More sharing options...
Quotations Posted September 22, 2017 Share Posted September 22, 2017 why not just do sleep(random(2800, 3200)); or something? why not just do sleep(random(2800, 3200)); or something? Quote Link to comment Share on other sites More sharing options...
ThatGamerBlue Posted September 22, 2017 Share Posted September 22, 2017 18 minutes ago, Quotations said: why not just do sleep(random(2800, 3200)); or something? why not just do sleep(random(2800, 3200)); or something? because thats unreliable. @HunterRS you can use Explv's sleep class here: https://hastebin.com/izebukinep.java (drop it under your main class) and use Sleep.sleepUntil(() -> !myPlayer().isAnimating(), 3000); as an alternative to using ConditionalSleep, it makes the code more readable imo Quote Link to comment Share on other sites More sharing options...
Alek Posted September 22, 2017 Share Posted September 22, 2017 51 minutes ago, Quotations said: why not just do sleep(random(2800, 3200)); or something? why not just do sleep(random(2800, 3200)); or something? Please don't troll here, we have a SPAM section for troll posts. 28 minutes ago, 3qTQlBnsOsyfetvA said: because thats unreliable. @HunterRS you can use Explv's sleep class here: https://hastebin.com/izebukinep.java (drop it under your main class) and use Sleep.sleepUntil(() -> !myPlayer().isAnimating(), 3000); as an alternative to using ConditionalSleep, it makes the code more readable imo Not sure how that solves his problem. Conditional sleeping is working on other scripts, so it must be something wrong. @HunterRS Post the stack trace/error Quote Link to comment Share on other sites More sharing options...
HunterRS Posted September 22, 2017 Author Share Posted September 22, 2017 (edited) 46 minutes ago, Alek said: Please don't troll here, we have a SPAM section for troll posts. Not sure how that solves his problem. Conditional sleeping is working on other scripts, so it must be something wrong. @HunterRS Post the stack trace/error Error in script executor! java.lang.NullPointerException at Main.onLoop(Main.java:385) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(xe:49) at java.lang.Thread.run(Unknown Source). EDIT: it is no longer in the condition sleep Line 385: if(getMagic().castSpell(NormalSpells.HIGH_LEVEL_ALCHEMY)){ Edited September 22, 2017 by HunterRS Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted September 22, 2017 Share Posted September 22, 2017 if(getInventory().interact("Cast", "Maple longbow")){ I may not know what I am talking about but this looks odd to me. Is interact a boolean? How do you "if" an interact? Or does that me if I am currently interacting with cast and the target is maple longbow? Quote Link to comment Share on other sites More sharing options...
HunterRS Posted September 23, 2017 Author Share Posted September 23, 2017 6 hours ago, sudoinit6 said: if(getInventory().interact("Cast", "Maple longbow")){ I may not know what I am talking about but this looks odd to me. Is interact a boolean? How do you "if" an interact? Or does that me if I am currently interacting with cast and the target is maple longbow? http://prntscr.com/goke1u Quote Link to comment Share on other sites More sharing options...
Alek Posted September 23, 2017 Share Posted September 23, 2017 Is it spamming null pointer a lot? If so you have to stop the script instantly and scroll all the way up to the original stack trace, which is what I suspect is happening. Quote Link to comment Share on other sites More sharing options...
HunterRS Posted September 23, 2017 Author Share Posted September 23, 2017 4 hours ago, Alek said: Is it spamming null pointer a lot? If so you have to stop the script instantly and scroll all the way up to the original stack trace, which is what I suspect is happening. Nope, I know what you mean and it isn't doing that.... Gives the error once every couple of seconds Quote Link to comment Share on other sites More sharing options...