Jump to content

heervangrijsburg

Members
  • Posts

    19
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by heervangrijsburg

  1. Every time i start a script in the cmd and use the parameter nointerface or low resource mode osbot stops after 1 - 2 minutes.

    Someone who knows why and how i can solve this problem.

    Thanks in advance.

    
    what have I tested so far :

    Run the script without the parameter nointerface or low resource mode -> works fine.

    Run a different script in cmd with the parameter nointerface or low resource mode -> osbot stops.

    Run the script in cmd with the parameter nointerface or low resource mode on a different pc -> osbot stops.

    Run the script in cmd with the parameter nointerface or low resource mode on ubunto -> osbot stops.

     

    Some information

    I'm running java 1.8.0_181.

    The cmd code that i use :

    cd C:\Program Files\Java\jre1.8.0_181\bin
    java -jar C:\Users\Desktop\OSBot2.5.51.jar -login osbotname:osbotpassword -bot runescapeaccount:runescapepassword:1234 -debug 12740 -allow nointerface -world 379 -script \"JugFillerHeervangrijsburg\":none

    The error that i'm getting in cmd :

    Capture.thumb.PNG.d7b87efe98054c12a4e329802e11d48b.PNG

  2. Spoiler
    
    private void withdrawCoinsAndLogs() throws InterruptedException {
            while (!inventory.contains(995) || !inventory.contains(1511)) {
                if (bank.isOpen()) {
                    bank.withdrawAll("Logs");
                    new ConditionalSleep(5000) {
                        @Override
                        public boolean condition() {
                            return inventory.contains("Logs");
                        }
                    }.sleep();
                    bank.withdrawAll(995);
                    new ConditionalSleep(5000) {
                        @Override
                        public boolean condition() {
                            return inventory.contains(995);
                        }
                    }.sleep();
                } else {
                    bank.open();
                    new ConditionalSleep(5000) {
                        @Override
                        public boolean condition() {
                            return bank.isOpen();
                        }
                    }.sleep();
                }
            }
        }
    
        public void sellLogs() throws InterruptedException {
            while (inventory.contains(1511)) {
                if (grandExchange.isOpen()) {
                    grandExchange.sellItem(1511, 1, Math.toIntExact(inventory.getAmount(1511)));
                    while (grandExchange.getAmountRemaining(GrandExchange.Box.BOX_1) != 0) {
                        new ConditionalSleep(5000) {
                            @Override
                            public boolean condition() {
                                return grandExchange.getAmountRemaining(GrandExchange.Box.BOX_1) == 0;
                            }
                        }.sleep();
                    }
                    grandExchange.collect();
                } else {
                    NPC grandExchangClerk = npcs.closest(2148);
                    grandExchangClerk.interact("Exchange");
                    new ConditionalSleep(5000) {
                        @Override
                        public boolean condition() {
                            return grandExchange.isOpen();
                        }
                    }.sleep();
                }
            }
        }
    
        public void buyaxe() throws InterruptedException {
            while (!inventory.contains(axe.axeToUseID())) {
                if (grandExchange.isOpen()) {
                    grandExchange.buyItem(axe.axeToUseID(), axe.axeToUseName(), Math.toIntExact(inventory.getAmount(995)), 1);
                    while (grandExchange.getAmountRemaining(GrandExchange.Box.BOX_1) != 0) {
                        new ConditionalSleep(5000) {
                            @Override
                            public boolean condition() {
                                return grandExchange.getAmountRemaining(GrandExchange.Box.BOX_1) == 0;
                            }
                        }.sleep();
                    }
                    grandExchange.collect();
                } else {
                    NPC grandExchangClerk = npcs.closest(2148);
                    grandExchangClerk.interact("Exchange");
                    new ConditionalSleep(5000) {
                        @Override
                        public boolean condition() {
                            return grandExchange.isOpen();
                        }
                    }.sleep();
                }
            }
        }
    
        @Override
        public int onLoop() throws InterruptedException {
            if (grandexchange_Area.contains(myPlayer())) {
                withdrawCoinsAndLogs();
                if (Math.toIntExact(inventory.getAmount(995)) >= 850) {
                    buyaxe();
                } else {
                    sellLogs();
                }
            } else {
                getWalking().webWalk(grandexchange_Area);
                new ConditionalSleep(5000) {
                    @Override
                    public boolean condition() {
                        return grandexchange_Area.contains(myPlayer());
                    }
                }.sleep();
            }
            return 600;
        }
    }

     

    As the title says, I try to learn how to work with the GE. What I'm trying to do with this bot is that it gets coins and logs from the bank sells the logs at the GE (currently the logs can be sold at 1 gp later I will try to get the right prices from osbuddy).

     

    then the bot would have to buy a steel axe at the GE (currently all coins in the inventory can be used for this later I will also try to get the right prices from osbuddy).

    Unfortunately, the bot clicks randomly succeeds to get the coins and logs from the bank than he opens the GE to start clicking all over the place. Would anyone be able to look at my code and maybe give me a quick tutorial on how to work with the GE (preferably with a few examples)

    thank you in advance
    heervangrijsburg

     

     

  3. Hello everyone, I'm working on a script and I have to go from place A to B because the 2 places are not far from each other and therefore I want to use "walkingEvents".
    There is a gate between those two places. My script goes to the place in front of the gate, but I can not get him to open the gate.
    Could someone look at my code and tell me what I'm doing wrong?
    Still learning the basics so it can be a stupid mistake :)
    Thanks in advance.

    Spoiler
    
    if (myPlayer().getPosition() == new Position( 3110,9518,0)){
                    Entity secondGate = objects.closest(9719);
                    secondGate.interact("Open");
                } else if (myPlayer().getPosition() == new Position(3111,9511,0)){
                    walkAndTalk();
                } else {
                    WalkingEvent event = new WalkingEvent(new Position(3110,9518,0));
                    event.setMinDistanceThreshold(0);
                    execute(event);
                }

     

     

     

  4. hello,

    thanks @Steel Poster but I now use "grandExchange.buyItem".

    Now I´m getting this error and i don´t know how to fix it :

    222336162_Screenshot(325).thumb.png.4d3808f8c8cf7f166c4687494c007c4c.png

    this is the part of the code I think the problem is in but like I said I don´t know how to fig it

    Main class

    Spoiler
    
    package script;
    
    import items.Axe;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import tasks.*;
    
    @ScriptManifest(author = "Heervangrijsburg", logo = "", info ="Cuts trees" , version = 1.2 , name = "Tree chopper")
    public final class Main extends Script {
        private final GoChopTree goChopTree = new GoChopTree();
        private final GoBank goBank = new GoBank();
        private final Axe axe = new Axe();
        private final GoGetAxe gogetaxe = new GoGetAxe();
    
    
    
        @SuppressWarnings("deprecation")
        @Override
        public void onStart() {
            goChopTree.exchangeContext(getBot());
            goBank.exchangeContext(getBot());
            axe.exchangeContext(getBot());
            gogetaxe.exchangeContext(getBot());
        }
    
        @Override
        public void onExit() {
    
        }
    
        @Override
        public int onLoop() throws InterruptedException {
            log("start oke");
            if (inventory.isEmptyExcept(1511, 1353,1361,1355,1357,1359,1351)) {
                log ("section 2");
                if (!inventory.isFull()) {
                    log ("section 3");
                    if (inventory.contains(axe.AxeToUseName())) {
                        log ("section 4");
                        goChopTree.choptree();
                    } else {
                        gogetaxe.getsrightaxe();
                    }
                } else {
                    log ("section 2,1");
                    goBank.bankafterchopptingtrees();
                }
            } else {
                log ("section 1,1");
                goBank.bankinventoryjunk();
            }
            return 1000;
        }
    }

     

     

    GoGetAxe class :

    Spoiler
    
    package tasks;
    
    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.model.NPC;
    import org.osbot.rs07.script.MethodProvider;
    import org.osbot.rs07.utility.ConditionalSleep;
    import items.Axe;
    import pricege.*;
    
    public final class GoGetAxe extends MethodProvider {
        private Axe axe = new Axe();
        private Area bank_area = new Area(
                new int[][]{
                        { 3092, 3246 },
                        { 3092, 3240 },
                        { 3097, 3240 },
                        { 3097, 3246 }
                }
        );
        private Area grandexchange_Area = new Area(
                new int[][]{
                        {3162, 3486},
                        {3168, 3486},
                        {3168, 3493},
                        {3161, 3492}
                }
        );
    
        public void getsrightaxe() throws InterruptedException {
            if (bank_area.contains(myPlayer())) {
                if (bank.isOpen()){
                    if (bank.contains(axe.AxeToUseName())){
                        bank.withdraw(axe.AxeToUseName(), 1);
                    } else {
                        buyrightaxe();
                    }
                    bank.close();
                    new ConditionalSleep(5000){
                        public boolean condition() throws InterruptedException {
                            return !bank.isOpen();
                        }
                    }.sleep();
                } else {
                    bank.open();
                    new ConditionalSleep(5000){
                        public boolean condition() throws InterruptedException {
                            return bank.isOpen();
                        }
                    }.sleep();
                }
            } else {
                getWalking().webWalk(bank_area);
                new ConditionalSleep(5000) {
                    public boolean condition() throws InterruptedException {
                        return bank_area.contains(myPlayer());
                    }
                }.sleep();
            }
        }

     

    Axe class

    Spoiler
    
    package items;
    
    import org.osbot.rs07.api.ui.Skill;
    import org.osbot.rs07.script.MethodProvider;
    
    public class Axe extends MethodProvider {
        public String AxeToUseName() {
            if (skills.getDynamic(Skill.WOODCUTTING) <= 10) {
                return "Steel axe";
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 20) {
                return "Black axe";
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 30) {
                return "Mithril axe";
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 40) {
                return "Adamant axe";
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 99) {
                return "Rune axe";
            } else {
                return "bronze axe";
            }
        }
        public int AxeToUseID() {
            if (skills.getDynamic(Skill.WOODCUTTING) <= 10) {
                return 1353;
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 20) {
                return 1361;
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 30) {
                return 1355;
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 40) {
                return 1357;
            } else if (skills.getDynamic(Skill.WOODCUTTING) <= 99) {
                return 1359;
            } else {
                return 1351;
            }
        }
    }

     

     

  5. Axe was in the bank and i had already added the if statement to look if the axe was
    in the bank but thanks anyway Now I´m trying to create the script that if the axe isn´t in the bank he will sell the logs you harvested and buy the axe but I can't figure out how to open the offer slot in the ge (note i'm already in the ge ).

     RS2Widget Openbuymenu = getWidgets().get(465, 7, 26);
                                    if(Openbuymenu != null) {
                                        Openbuymenu.interact("Buy");
                                        new ConditionalSleep(5000) {
                                            public boolean condition() throws InterruptedException {
                                                return grandExchange.isOfferScreenOpen();
                                            }
                                        }.sleep();
                                    }
                                    keyboard.typeString(AxeToUse());
                                    int Offerprice = grandExchange.getOfferPrice();
                                    grandExchange.setOfferPrice( 2 * Offerprice );

     

  6. Hi so i used ´else if´ statements but now my bot is not able to withdraw anything from the bank could someone take a look at my code ?

    thanks by the way for all the support.

    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.ui.Skill;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.utility.ConditionalSleep;
    import task.Woodcutting;
    
    
    @ScriptManifest(author = "Heervangrijsburg", logo = "", info ="Will cut trees" , version = 1.2 , name = "WC tree")
    public class Main extends Script {
        private Area Bank = new Area(3180, 3446, 3183, 3435);
        private String Axetouse = "";
        @Override
    
        public void onStart() {
    
        }
    
        public void onExit() {
    
        }
    
        public int onLoop() throws InterruptedException {
            int Woodcuttinglevel = skills.getDynamic(Skill.WOODCUTTING);
            if (Woodcuttinglevel <= 5){
                Axetouse = "Bronze axe";
                sleep(200);
            } else if (Woodcuttinglevel <= 10){
                Axetouse = "Steel axe";
                sleep(200);
            } else if (Woodcuttinglevel <= 20){
                Axetouse = "Black axe";
                sleep(200);
            } else if (Woodcuttinglevel <= 30){
                Axetouse = "Mithril axe";
                sleep(200);
            } else if (Woodcuttinglevel <= 40){
                Axetouse = "Adamant axe";
                sleep(200);
            } else if (Woodcuttinglevel <= 99){
                Axetouse = "Rune axe";
                sleep(200);
            }
            if (inventory.contains(Axetouse)){
                new Woodcutting(this);
            } else {
                if (Bank.contains(myPlayer())) {
                        if (bank.isOpen()) {
                                bank.withdraw(Axetouse, 1);
                                    bank.close();
                                        sleep(200);
                        } else {
                            bank.open();
                            sleep(200);
                        }
                } else {
                    getWalking().webWalk(Bank);
                        new ConditionalSleep(5000) {
                            public boolean condition() throws InterruptedException {
                                return Bank.contains(myPlayer());
                        }
                    }.sleep();
                }
            }
            return 1000;
        }
    }

     

  7. Hi, I'm trying to make the script that it changes from axe´s when he gets to a certain level. For this I use the switch statement, but in any case i get the error message "Constant expression required". can someone pls tell me what I´m doing wrong?

    int Woodcuttinglevel = skills.getDynamic(Skill.WOODCUTTING);
                switch (true) {
                    case (Woodcuttinglevel >= 5):
                        break;
                    case (Woodcuttinglevel >= 10):
                        break;
                    case (Woodcuttinglevel >= 20):
                        break;
                    case (Woodcuttinglevel >= 30):
                        break;
                    case (Woodcuttinglevel >= 40):
                        break;
                    default:
                        break;

     

  8. Hi guys, I think I did almost everything you guys suggested. the script does not get stuck anymore and I can start the script with a complete inventory.
    However, I have not made any methods yet, but maybe someone already wants to take a look at the script and tell me what I can improve on it.
    Special thx to @JioMy for his detailed report on everthing I could improve on every line.

    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.model.Entity;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.utility.ConditionalSleep;
    
    
    
    
    @ScriptManifest(author = "Heervangrijsburg", logo = "", info ="Will cut trees" , version = 1.2 , name = "WC tree")
    public class Main extends Script {
        private Area Woodcutting = new Area(3088, 3262, 3070, 3273);
        private Area Bank = new Area(3092, 3241, 3093, 3242);
    
        @Override
    
        public void onStart() {
    
        }
    
        public void onExit() {
    
        }
    
        public int onLoop() throws InterruptedException{
            if (!getInventory().isFull()){
                if (Woodcutting.contains(myPlayer())){
                    Entity Tree = objects.closest("tree");
                        if (Tree != null && Woodcutting.contains(Tree)){
                                Tree.interact("Chop Down");
                                    new ConditionalSleep(5000){
                                        public boolean condition() throws InterruptedException{
                                            return !myPlayer().isAnimating() && !myPlayer().isMoving();
                                    }
                                }.sleep();
    
                        }else{
                            sleep(200);
                        }
                }else{
                    getWalking().webWalk(Woodcutting);
                        new ConditionalSleep(5000){
                            public boolean condition() throws InterruptedException{
                                return Woodcutting.contains(myPlayer());
                            }
                        }.sleep();
                }
    
            }else{
                if (Bank.contains(myPlayer())){
                    if (bank.isOpen()){
                            bank.depositAll("Logs");
                                bank.close();
                                    sleep(200);
                } else {
                    bank.open();
                        sleep(200);
                }
                } else {
                    getWalking().webWalk(Bank);
                    new ConditionalSleep(5000){
                        public boolean condition() throws InterruptedException{
                            return Bank.contains(myPlayer());
                        }
                    }.sleep();
                }
    
                }return 0;
        }
    }
    
     

     

  9. Hey guys,

    I'm trying to learn how to make scripts.

    The first script that I'm trying to make is a woodcutting script and this is what I have so far :

    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.model.Entity;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    
    
    
    
    @ScriptManifest(author = "Heervangrijsburg", logo = "", info ="Will cut trees" , version = 1.0 , name = "WC tree")
    public class Main extends Script {
    
        @Override
    
        public void onStart(){
    
        }
        public void onExit(){
    
        }
        public int onLoop() throws InterruptedException {
            if(!getInventory().isFull()){
                Area woodcutting = new Area(3086, 3263, 3074, 3272);
                Entity tree = objects.closest("tree");
                if(!woodcutting.contains(myPlayer())){
                    getWalking().walk(woodcutting);
                }else{
                    if(tree != null) {
                        if(!myPlayer().isAnimating()) {
                            if(!myPlayer().isMoving()) {
                                tree.interact("Chop Down");
                            }
                        }
                    }
                }
            }else{
                    Area Bank = new Area(3092, 3241, 3093, 3242);
                        if(!Bank.contains(myPlayer())){
                            getWalking().walk(Bank);
                                }else if(!bank.isOpen()){
                                            bank.open();
                                        }else{
                                            bank.depositAll("Logs");
                                                bank.close();
                                    }
            }return 1000;
    
        }
    }

    But sometimes it seems to get stuck and when I start the script when the inventory is full the script doesn't work at all.

    So my questiopn is whether someone who has more experience with this could take a look at it  and give me some tips?

     

     

×
×
  • Create New...