Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Help a nub with walking...


    Daskie

    Recommended Posts

    So i'm brand new to dreambot scripting, but not to Java. With the help of the tutorials I found on the forums, and the API, I got right into things fairly smoothly, which is exciting. However, I ran into an issue when It came time to experiment with walking that I have failed to find a solution for.

     
    Essentially the walk() function doesn't seem to be working properly. It fails every time I've tried to use it or similar functions like walkExact() or walkOnScreen(). Occasionally the mouse will move across the screen, but that's it.
     
    For example, the simple code below will log "walk unsuccessful" every time:

    (Using IntelliJ)

     

     

     

    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    
    @ScriptManifest(category = Category.MISC, name = "Testing", author = "Yours Truly", version = 1.0
    public class TestBot extends AbstractScript {
    
        private Area testArea;
    
        @Override
        public void onStart() {
            log("starting...");
            int x = getLocalPlayer().getX();
            int y = getLocalPlayer().getY();
            testArea = new Area(x - 1, y - 1, x + 1, y + 1, 0);
        }
    
        @Override
        public int onLoop() {
            if (getWalking().walk(testArea.getRandomTile())) {
                log("walk successful");
            }
            else {
                log("walk unsuccessful");
            }
    
            return 5000;
        }
    
        @Override
        public void onExit() {
            
        }
    } 

     

     

     

    I should note however that most of what I've tried has been successful, such as...

     

     

     

    private void printGameObjects() {
        GameObject[] gos = getGameObjects().getObjectsOnTile(getLocalPlayer().getTile());
        if (gos != null) {
            for (GameObject go : gos) {
                log(go.getName() + ", ");
            }
        }
    }
    

     

     

     

     

    private void printNearestNPC() {
        NPCs npcs = getNpcs();
        NPC npc = npcs.closest(n -> n != null);
        if (npc != null) {
            log(npc.getName() + " (" + npc.distance() + ")");
        }
    }

     

     

     

     

    private void printDistanceToNearestBank() {
        BankLocation bank = getBank().getClosestBankLocation();
        log(bank.name() + " (" + bank.getCenter().distance() + ")");
    }
    

     

     

     

    I've tried directly copy pasting the BasicWoodcutter tutorial code, which fails to walk. Additionally, I've tried running a few free scripts, which all run fine, but never actually move.

     

    Hopefully i'm just being dumb and missing something obvious, but any assistance would be welcome.

    Link to comment
    Share on other sites

     

    private Area newArea = new Area(x1,y1x2,y2, 0);


    getWalking().walk(newArea.getCenter());

    sleepUntil(() -> getWalking().getDestination().distance() < Calculations.random(5, 7) , Calculations.random(3400, 4250));

     

     

    you get get your coördinates using your dreambot client -> Tools -> Debugging -> Position player

    Link to comment
    Share on other sites

    Alright, so I boiled my code down to an extremely simple walking instruction.

    Using the debug tool, my player's coordinates are (3079, 3250).

    This code should cause the player to walk one tile diagonally...

     

     

    @Override
    public int onLoop() {
        Tile tile = new Tile(3079 + 1, 3250 + 1);
        getWalking().walk(tile);
        sleepUntil(() -> getWalking().getDestinationDistance() == 0, 5000);
        return 5000;
    }
    

     

     

    Here is a video of what happened instead.

    As you can see, the cursor moved from where it was to the right side of the screen. After that, nothing happened.

     

    I decided to test another simple free script.

    Here is a video of my client running Fran's Chicken Destruction script.

    Again, i'm only getting subtle mouse movements and a small change in camera angle, similar to what I've seen in other testing.

     

    I suspect I'm missing some small crucial thing, having never done this before, but i'm at a loss as to wtf is going on...

    Link to comment
    Share on other sites

    Alright, so I boiled my code down to an extremely simple walking instruction.

    Using the debug tool, my player's coordinates are (3079, 3250).

    This code should cause the player to walk one tile diagonally...

     

     

    @Override
    public int onLoop() {
        Tile tile = new Tile(3079 + 1, 3250 + 1);
        getWalking().walk(tile);
        sleepUntil(() -> getWalking().getDestinationDistance() == 0, 5000);
        return 5000;
    }
    

     

    Here is a video of what happened instead.

    As you can see, the cursor moved from where it was to the right side of the screen. After that, nothing happened.

     

    I decided to test another simple free script.

    Here is a video of my client running Fran's Chicken Destruction script.

    Again, i'm only getting subtle mouse movements and a small change in camera angle, similar to what I've seen in other testing.

     

    I suspect I'm missing some small crucial thing, having never done this before, but i'm at a loss as to wtf is going on...

     

    Your game needs to be in fixed video mode with default zoom to work properly.

    Link to comment
    Share on other sites

    Your game needs to be in fixed video mode with default zoom to work properly.

     

    Damn, that was it. Thank you!!

    So for future reference, fixed video mode, default zoom, anything else? Does camera angle affect anything? Also, is there a source for this sort of need-to-know information, or is it just common rs botting knowledge?

    Link to comment
    Share on other sites

    Damn, that was it. Thank you!!

    So for future reference, fixed video mode, default zoom, anything else? Does camera angle affect anything? Also, is there a source for this sort of need-to-know information, or is it just common rs botting knowledge?

    camera angle doesnt change anything. The only things that you need are default zoom and fixed. 

    I personally had this problem as well. I think dreambot should do a better job of when you frist download the client, making sure this information is right in your face. 

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.