By registering with us, you'll be able to discuss, share and private message with other members of our community.
Sign up now!Npc wisp = Npcs.newQuery().names("Pale wisp").results().nearest();
if(wisp != null){
if(wisp.isVisible()){
if(wisp.interact("Harvest")){
System.out.writeln("I wrote this in html editor so pardon any mistakes. Oh and we interacted.");
}
}
}
but divination bot IS harvesting wisps. Its all there has to be.
Lol jk,
so here is an example:
Code:Npc wisp = Npcs.newQuery().names("Pale wisp").results().nearest(); if(wisp != null){ if(wisp.isVisible()){ if(wisp.interact("Harvest")){ System.out.writeln("I wrote this in html editor so pardon any mistakes. Oh and we interacted."); } } }
Show me your code and i can help you.Hmmm that's strange because I did exactly that, and it wasn't working.
Show me your code and i can help you.
public void gathering() {
Npc cursedWisp = Npcs.newQuery().names("Cursed wisp").results().nearest();
if(cursedWisp != null) {
if(cursedWisp.isVisible()) {
cursedWisp.interact("Harvest")
} else {
Camera.turnTo(cursedWisp);
}
}
}
THis part of the code looks fine. Show me the rest. Where do you call the gather method?Code:public void gathering() { Npc cursedWisp = Npcs.newQuery().names("Cursed wisp").results().nearest(); if(cursedWisp != null) { if(cursedWisp.isVisible()) { cursedWisp.interact("Harvest") } else { Camera.turnTo(cursedWisp); } } }
THis part of the code looks fine. Show me the rest. Where do you call the gather method?
java.lang.NullPointerException
at com.jwd1029.bots.testbot.TestBot.gathering(TestBot.java:183)
at com.jwd1029.bots.testbot.TestBot.onLoop(TestBot.java:42)
at com.runemate.game.api.script.framework.LoopingBot.run(ygb:70)
at com.runemate.game.api.script.framework.AbstractBot.start(ggb:156)
at nul.iiiIIIiIiIiI.run(xlb:231)
if(Inventory.getItems("Cursed energy", "Cursed Energy").first().getQuantity() >= 10) {
toEdge = true;
if(toEdge == true) {
if (InterfaceWindows.getEquipment().isOpen()) {
SpriteItem amuletOfGlory = Equipment.newQuery().ids(anyAmulet).results().first();
if(amuletOfGlory != null)
amuletOfGlory.interact("Edgeville");
toEdge = false;
GameObject bank = GameObjects.newQuery().names("Counter", "counter").results().nearest();
Camera.turnTo(bank);
} else {
InterfaceWindows.getEquipment().open();
}
}
What is on line 183 in TestBot.javaI fixed this issue, but now when i'm working on my banking method I have a null pointer exception.
Code:java.lang.NullPointerException at com.jwd1029.bots.testbot.TestBot.gathering(TestBot.java:183) at com.jwd1029.bots.testbot.TestBot.onLoop(TestBot.java:42) at com.runemate.game.api.script.framework.LoopingBot.run(ygb:70) at com.runemate.game.api.script.framework.AbstractBot.start(ggb:156) at nul.iiiIIIiIiIiI.run(xlb:231)
Here's my code:
Code:if(Inventory.getItems("Cursed energy", "Cursed Energy").first().getQuantity() >= 10) { toEdge = true; if(toEdge == true) { if (InterfaceWindows.getEquipment().isOpen()) { SpriteItem amuletOfGlory = Equipment.newQuery().ids(anyAmulet).results().first(); if(amuletOfGlory != null) amuletOfGlory.interact("Edgeville"); toEdge = false; GameObject bank = GameObjects.newQuery().names("Counter", "counter").results().nearest(); Camera.turnTo(bank); } else { InterfaceWindows.getEquipment().open(); } }
What is on line 183 in TestBot.java
if(Inventory.getItems("Cursed energy", "Cursed Energy").first().getQuantity() >= 10) {
Code:if(Inventory.getItems("Cursed energy", "Cursed Energy").first().getQuantity() >= 10) {
That's line 183.
SpriteItem energies = Inventory.newQuery().names("Cursed energy").results().first();
if(energies != null){
System.out.println('We have: ' + energies.getQuantity());
}
Code:SpriteItem energies = Inventory.newQuery().names("Cursed energy").results().first(); if(energies != null){ System.out.println('We have: ' + energies.getQuantity()); }
Lesson: always null check.
We use essential cookies to make this site work, and optional cookies to enhance your experience.