September 22, 20178 yr 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
September 22, 20178 yr why not just do sleep(random(2800, 3200)); or something? why not just do sleep(random(2800, 3200)); or something?
September 22, 20178 yr 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
September 22, 20178 yr 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
September 22, 20178 yr Author 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, 20178 yr by HunterRS
September 22, 20178 yr 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?
September 23, 20178 yr Author 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
September 23, 20178 yr 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.
September 23, 20178 yr Author 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
Create an account or sign in to comment