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
  • Code for player im area


    henrique190

    Recommended Posts

    Posted

    hi good night for all, how can i use the code for player im area, sorry for my bad english but i traying this:

     

     

    private final Area SPOT = new Area(3199, 3191, 3248,3240);

     

     

    SPOT.contains(getLocalPlayer())

     

     

    Posted

    getLocalPlayer().getTile()

    This.

    private final Area SPOT = new Area(3199, 3191, 3248,3240);
    SPOT.contains(getPlayers().myPlayer().getTile());

    E: Don't forget the semicolons lol

    Posted

    This.

    private final Area SPOT = new Area(3199, 3191, 3248,3240);
    SPOT.contains(getPlayers().myPlayer().getTile());

    E: Don't forget the semicolons lol

    His original code works fine. You don't need to do that extra shit. SPOT.contains(getLocalPlayer()) works fine.

    Posted

    His original code works fine. You don't need to do that extra shit. SPOT.contains(getLocalPlayer()) works fine.

    It won't work if he doesn't check the tile, per my understanding

    Posted

    It won't work if he doesn't check the tile, per my understanding

    local player most likely inherits the tile info by default, so getLocalPlayer() would be fine

    Posted

    Thanks all for the greatest support, with your help I did my first script! thank you all

     

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    @ScriptManifest(author = "henrique", name = "BR Chopper", version = 1.0, description = "Corta Arvores", category = Category.WOODCUTTING)
    public class main extends AbstractScript {
    
        private final Tile Fugir = new Tile(3000, 3000, 0);
    
        public boolean EmAtaque() {
            return getLocalPlayer().isInCombat();
        }
    
        public boolean Correr() {
            // if (getWalking().isRunEnabled())
            // return getWalking().walk(Fugir);
            // else {
            // getWalking().toggleRun();
            return getWalking().walk(Fugir);
            // }
        }
    
        String Axe[] = { "Rune axe", "Bronze axe", "Iron axe", "Steel Axe",
                "Black axe", "Mithril axe", "Adamant axe" };
    
        private final Tile IR_SPOT = new Tile(3177, 3250, 0);
        private final Area Spot = new Area(3177, 3178, 3250, 3254, 0);
    
        public boolean maldito() {
            GameObject Tree = getGameObjects().closest("Tree");
            return Tree.distance() <= 5;
        }
    
        public Boolean movendo() {
            return getLocalPlayer().isMoving();
        }
    
        public boolean Anima() {
            return getLocalPlayer().getAnimation() == -1;
        }
    
        public boolean invcheio() {
            return (getInventory().isFull());
        }
    
        public boolean podecortar() {
            GameObject Tree = getGameObjects().closest("Tree");
            return (Tree != null && Tree.isOnScreen());
    
        }
    
        public boolean lugar() {
            return Spot.contains(getLocalPlayer().getTile());
        }
    
        private enum State {
            IR, CORTAR, DROPAR, ESPERAR;
        };
    
        private State getState() {
    
            if (lugar()) {
                log("lugar");
    
                if (invcheio()) {
                    log("inv");
                    return State.DROPAR;
                } else if (podecortar() && Anima() && !movendo() && lugar()) {
                    log("pode cortar");
                    return State.CORTAR;
    
                }
    
                return State.ESPERAR;
            } else {
                log("IR");
    
                return State.IR;
            }
        }
    
        public void onStart() {
            log("Iniciando");
            log("Vamos");
        }
    
        public void onExit() {
            log("Iniciando");
            log("Obrigado por usar, volte sempre!!");
        }
    
        @Override
        public int onLoop() {
    
            switch (getState()) {
    
            case IR:
                getWalking().walk(IR_SPOT);
                break;
    
            case CORTAR:
    
                if (maldito()) {
    
                    GameObject Tree = getGameObjects().closest("Tree");
                    Tree.interact("Chop down");
                    sleepUntil(new Condition() {
                        public boolean verify() {
                            return getLocalPlayer().getAnimation() == -1;
                        }
                    }, Calculations.random(1800, 2400));
                }
    
                break;
            case DROPAR:
                getInventory().dropAllExcept(Axe);
                break;
    
            case ESPERAR:
                Calculations.random(500, 600);
                break;
    
            }
    
            return Calculations.random(500, 600);
        }
    
    }
     
    
    Posted

     

    Thanks all for the greatest support, with your help I did my first script! thank you all

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    @ScriptManifest(author = "henrique", name = "BR Chopper", version = 1.0, description = "Corta Arvores", category = Category.WOODCUTTING)
    public class main extends AbstractScript {
    
        private final Tile Fugir = new Tile(3000, 3000, 0);
    
        public boolean EmAtaque() {
            return getLocalPlayer().isInCombat();
        }
    
        public boolean Correr() {
            // if (getWalking().isRunEnabled())
            // return getWalking().walk(Fugir);
            // else {
            // getWalking().toggleRun();
            return getWalking().walk(Fugir);
            // }
        }
    
        String Axe[] = { "Rune axe", "Bronze axe", "Iron axe", "Steel Axe",
                "Black axe", "Mithril axe", "Adamant axe" };
    
        private final Tile IR_SPOT = new Tile(3177, 3250, 0);
        private final Area Spot = new Area(3177, 3178, 3250, 3254, 0);
    
        public boolean maldito() {
            GameObject Tree = getGameObjects().closest("Tree");
            return Tree.distance() <= 5;
        }
    
        public Boolean movendo() {
            return getLocalPlayer().isMoving();
        }
    
        public boolean Anima() {
            return getLocalPlayer().getAnimation() == -1;
        }
    
        public boolean invcheio() {
            return (getInventory().isFull());
        }
    
        public boolean podecortar() {
            GameObject Tree = getGameObjects().closest("Tree");
            return (Tree != null && Tree.isOnScreen());
    
        }
    
        public boolean lugar() {
            return Spot.contains(getLocalPlayer().getTile());
        }
    
        private enum State {
            IR, CORTAR, DROPAR, ESPERAR;
        };
    
        private State getState() {
    
            if (lugar()) {
                log("lugar");
    
                if (invcheio()) {
                    log("inv");
                    return State.DROPAR;
                } else if (podecortar() && Anima() && !movendo() && lugar()) {
                    log("pode cortar");
                    return State.CORTAR;
    
                }
    
                return State.ESPERAR;
            } else {
                log("IR");
    
                return State.IR;
            }
        }
    
        public void onStart() {
            log("Iniciando");
            log("Vamos");
        }
    
        public void onExit() {
            log("Iniciando");
            log("Obrigado por usar, volte sempre!!");
        }
    
        @Override
        public int onLoop() {
    
            switch (getState()) {
    
            case IR:
                getWalking().walk(IR_SPOT);
                break;
    
            case CORTAR:
    
                if (maldito()) {
    
                    GameObject Tree = getGameObjects().closest("Tree");
                    Tree.interact("Chop down");
                    sleepUntil(new Condition() {
                        public boolean verify() {
                            return getLocalPlayer().getAnimation() == -1;
                        }
                    }, Calculations.random(1800, 2400));
                }
    
                break;
            case DROPAR:
                getInventory().dropAllExcept(Axe);
                break;
    
            case ESPERAR:
                Calculations.random(500, 600);
                break;
    
            }
    
            return Calculations.random(500, 600);
        }
    
    }
     
    

    Dat Portuguese :P Nice job henrique

    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.