Bug NullpointerException

Discussion in 'Developer Support' started by itzDot, Sep 2, 2015.

  1. itzDot

    Joined:
    Sep 1, 2015
    Messages:
    9
    Likes Received:
    3
    Hi, I tried converting one of my scripts bots from a different api onto runemate api and when I try to run the script bot I get this error
    java.lang.NullPointerException
    at com.itzDot.bots.AdvWineGrabber.tasks.WalkToLocation.execute(WalkToLocation.java:22)
    at com.runemate.game.api.script bot.framework.task.TaskScript.onLoop(spb:231)
    at com.runemate.game.api.script bot.framework.LoopingScript.run(gwb:14)
    at com.runemate.game.api.script bot.framework.AbstractScript.start(jpb:51)
    at app.TM.run(znb:227)
    --- Double Post Merged, Sep 2, 2015, Original Post Date: Sep 2, 2015 ---
    and the line 22 i'm using the webpath which looks like
    final WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(new Coordinate(2931, 3515, 0));
    path.step();
     
  2. Derk

    Joined:
    Jan 8, 2015
    Messages:
    1,662
    Likes Received:
    603
    Check the path for null.

    finalWebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(new Coordinate(2931, 3515, 0));

    if(path != null) {
    path.step();
    }
     
  3. itzDot

    Joined:
    Sep 1, 2015
    Messages:
    9
    Likes Received:
    3
    that did help stop giving me a null error but my script bot seems to not run, i'm extending the mainclass off taskscript and on my onStart() i have this
    public void onStart(String... args){
    iniTime = System.currentTimeMillis();
    iniXp = Skill.MAGIC.getExperience();
    setLoopDelay(450, 600);
    add(new TeleGrab(), new Bank(), new TeleportToFally(), new WalkToBank(), new WalkToLocation());}

    am I missing anything else in order for the taskscript to loop through?
     
  4. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,507
    Likes Received:
    1,031
    @Cloud under what conditions does the path return null?
     
  5. Cloud

    Cloud The Developer

    Joined:
    Jul 28, 2013
    Messages:
    2,319
    Likes Received:
    744
    It returns null whenever it cannot generate a path that is reasonably accurate. That's usually because the area isn't mapped.
     

Share This Page

Loading...