Jump to content

Welcome to DreamBot

VIP Enhancement

Want to upgrade your DreamBot experience? Consider signing up for VIP!
VIP allows you to run as many accounts as you want, view the forums ad-free, receive 10% off all script purchases, and so much more!
Visit the store to learn about all of these great features!

Upgrade to VIP Now
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java 8 installed
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
Download the DreamBot client today!
codercal

Web walking not working from Lumbridge Castle

Recommended Posts

I am currently trying to create a bot for the Rune Mysteries Quest. I was able to use web walking to get to the room where the quest is started in Lumbridge Castle. Using code like below.

 

        
private Area loc = new Area(3209, 3220,  3212,3224, 1); 

while (!loc.contains(getLocalPlayer())){
  log("Head to " + STATE);
  getWalking().walk(loc.getRandomTile());
  sleepUntil(() -> getLocalPlayer().isStandingStill(), Calculations.random(1000, 2000));
}

 

 

I am now trying to leave this room (image at bottom) to head to the Wizard's Tower, however, after trying multiple new Area's my character will not move. From reading other posts i believe this is because it can't find a path?

I then tried using localPath, even just to move 2 tiles towards  the door, however it gives me a warning that the "Local path list is empty! Cannot proceed!" even though I can see there are tiles in it when printed originally. Console output is attached at bottom.

Below is all of my code so far! I have written some simple rune-crafting and cow killing scripts and haven't run into an issue like this moving around the world. Ideally I would just be able to use the web walker. Any help would be appreciated!

 

package main;

import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.map.Area;
import org.dreambot.api.methods.map.Tile;
import org.dreambot.api.methods.walking.path.impl.LocalPath;
import org.dreambot.api.script.AbstractScript;
import org.dreambot.api.script.Category;
import org.dreambot.api.script.ScriptManifest;
import org.dreambot.api.wrappers.interactive.NPC;

@ScriptManifest(category = Category.QUEST, name = "Rune Mysteries", author = "Codercal", version = 3)
public class Main extends AbstractScript {

    private State STATE = State.GO_WIZARD_TOWER;
    private Area dukeHoracio = new Area(3209, 3220,  3212,3224, 1); // coordinates for duke horacio
    private Area sedridor = new Area(3102, 9569,3107,9574, 0); // coordinates in Wizard's Tower

    LocalPath<Tile> localPath = new LocalPath<>(this);

    @Override
    public void onStart() {
        log("Start Rune Mysteries");
        getSkillTracker().start();

        localPath.add(new Tile(3208,3222, 1));
        localPath.add(new Tile(3206,3226, 1));
        localPath.add(new Tile(3215,3221));
        localPath.add(new Tile(3203,3214));

    }


    private enum State{
        START_QUEST,
        GO_WIZARD_TOWER,

    }

    @Override
    public int onLoop() {
        if (STATE == State.START_QUEST) {
            goTo(dukeHoracio);
            NPC duke = getNpcs().closest("Duke Horacio");

            //Get through all dialogue
            while (!getDialogues().canContinue()) {
                duke.interact();
            }
            getDialogues().continueDialogue();
            sleep(1000);
            if (getWidgets().getWidgetChild(219, 1) != null) {
                getWidgets().getWidgetChild(219, 1, 1).interact();
                sleep(1000);
            }
            while (getDialogues().canContinue()) {
                getDialogues().continueDialogue();
                sleep(1000);
            }
            if (getWidgets().getWidgetChild(219, 1) != null) {
                getWidgets().getWidgetChild(219, 1, 1).interact();
                sleep(1000);
            }
            while (getDialogues().canContinue()) {
                getDialogues().continueDialogue();
                sleep(1000);
            }


            STATE = State.GO_WIZARD_TOWER;
        }
        if (STATE == State.GO_WIZARD_TOWER) {
            log(localPath.toString());
            localPath.walk();
            sleep(2000);
            STATE = State.GO_WIZARD_TOWER;
        }

        return 0;
    }

    // Runs to a given area
    public void goTo(Area loc){
        while (!loc.contains(getLocalPlayer())){
            log("Head to " + STATE);
            getWalking().walk(loc.getRandomTile());
            sleepUntil(() -> getLocalPlayer().isStandingStill(), Calculations.random(1000, 2000));
        }
    }
}

 

lum1.PNG

console.PNG

Edited by codercal

Share this post


Link to post
Share on other sites

o.O why the while loops?? :o 

Don't you know that the script as a whole is inside a loop called the "onLoop"? You can just use if statement..

also instead of all this crap:

  sleepUntil(() -> getLocalPlayer().isStandingStill(), Calculations.random(1000, 2000));

use the shouldWalk method..

ex:

if(!exampleArea.contains(getLocalPlayer()) {

if(getWalking().shouldWalk(7)) getWalking().walk(exampleArea.getRandomTile());

}

Also, since this is quest script.. I advise you to use PlayerSettings configs..  checkout Articron's guide on them..

Also for WidgetChildren.. I strongly advise you to create a WC Object.. null check it then execute.. 

ex:

WidgetChild wc = getWidgets().getWidgetChild(int widget, int widgetChild);
if(wc != null && wc.isVisible()) wc.interact("...");

Also an advice on Areas with different tile levels..

Area area = new Area(new TIle(x,y,z), new Tile(x,y,z));

 

Also keep your onLoop tidy.. this is hard to read through

Edited by Defiled

Share this post


Link to post
Share on other sites

The basement of the wizard tower isn't within the web, so you'll need to walk to the ladder on the overworld level of the tower, then go down the ladder yourself. Once down the ladder it's local so you can use walk to get to the wizard himself.

Share this post


Link to post
Share on other sites

Well, I can see that you're going from floor 1 to floor 0 in your four tiles on the local path, when you're doing local path specifically it does not check for new obstacles within the path, it just tries to walk directly to those. I'm wondering if it's seeing the 4th tile as being able to walk to it because of no obstacles, but then not walking to it because on floor 0

Try removing the last two tiles and running that, see if it'll walk just the two tiles on floor 1.

That is mostly the correct way to use local paths, but when we generate a local path it's every tile between you and your destination, so you can accurately find where you are and where you should be walking next.

 

Edit: just checked, it should have ignored the last 2 tiles since you can't walk to them (different z) and walked to the second tile in the path anyway. I'd still suggest maybe trying to remove the floor 0 tiles and adding more into your floor 1 tiles

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...