Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved Divination harvesting wisps

Joined
Jan 20, 2017
Messages
8
Hey,

I'm making a Divination bot, and i've done everything but i'm stuck on the harvesting of wisps. Could somebody point me in the right direction? I've looked all over but found nothing.
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
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.");
      }
  }
}
 
Joined
Jan 20, 2017
Messages
8
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.");
      }
  }
}

Hmmm that's strange because I did exactly that, and it wasn't working.

Oh, and I'm writing a Cursed Wisp collector so I have to take into consideration banking, paths, other players and how to deal with them etc. :)
 
Joined
Jan 20, 2017
Messages
8
Show me your code and i can help you.

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);
              
            }
        }
      
    }
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
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?
 
Joined
Jan 20, 2017
Messages
8
THis part of the code looks fine. Show me the rest. Where do you call the gather method?

I 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)
dywg6c


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();
                      
                    }
                }
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
I 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)
dywg6c


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
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
Code:
    if(Inventory.getItems("Cursed energy", "Cursed Energy").first().getQuantity() >= 10) {

That's line 183.
Code:
SpriteItem energies = Inventory.newQuery().names("Cursed energy").results().first();

if(energies != null){
    System.out.println('We have: ' + energies.getQuantity());
}

Lesson: always null check.
 
Joined
Jan 20, 2017
Messages
8
Code:
SpriteItem energies = Inventory.newQuery().names("Cursed energy").results().first();

if(energies != null){
    System.out.println('We have: ' + energies.getQuantity());
}

Lesson: always null check.

Ahhh man I feel stupid, I forgot to do that. Thanks anyway brother! Lesson learnt.
 
Top