Jump to content

jca

Members
  • Posts

    391
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    100%

Posts posted by jca

  1. 57 minutes ago, liverare said:

    Don't worry about that warning. @Alek has said in the past it's used for internal use, so it's not likely to be removed and it's perfectly fine to use.

    Yeah... I’ve heard lots of people saying different things about that. Anyhow, I was just making sure the OP knew that it was deprecated and what that means. 

  2. 2 minutes ago, Ragnar Lothbrok said:

     

    
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.event.WebWalkEvent;
    import org.osbot.rs07.script.MethodProvider;
    import org.osbot.rs07.utility.Condition;
    
    public class WalkingHandler extends MethodProvider {
    
        public void Walk(Position NextStep){
            WebWalkEvent WalkthePath = new WebWalkEvent(NextStep);
            WalkthePath.setBreakCondition(new Condition() {
                @Override
                public boolean evaluate() {
                    return (!isLoggedIn() || isInDanger() || isLowStamina());
                }
            });
            execute(WalkthePath);
        }
    
        private boolean isLoggedIn() {
            return getClient().isLoggedIn();
        }
    
        private boolean isInDanger() {
            return players.closest(p -> p != null && !p.equals(myPlayer()) && (myPosition().getY() > 3522) && p.getPosition().distance(myPosition()) < 20) != null;
        }
    
        private boolean isLowStamina() {
            return settings.getRunEnergy() < 20 && getInventory().contains(item -> item.getName().contains("Stamina") && item != null);
        }
    
    }

    Then:

    
    WalkngHandler w = new WalkingHandler();
    w.exchangeContext(getBot());

     

    Yeah... I prefer exchangeContext(getBot()); 

    However it is deprecated and marked for internal use. If the devs decide to remove it the script will break. 

  3. 21 minutes ago, ryank645 said:

    okay this is my WalkingHandler class now:

    
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.event.WebWalkEvent;
    import org.osbot.rs07.script.MethodProvider;
    import org.osbot.rs07.utility.Condition;
    
    public class WalkingHandler extends MethodProvider{
    
        MethodProvider m;
        public WalkingHandler(MethodProvider m) {m.getBot().getMethods();}
    
        public void Walk(Position NextStep){
            WebWalkEvent WalkthePath = new WebWalkEvent(NextStep);
            WalkthePath.setBreakCondition(new Condition() {
                @Override
                public boolean evaluate() {
                    return (!isLoggedIn() || isInDanger() || isLowStamina());
                }
            });
            execute(WalkthePath);
        }
    
        private boolean isLoggedIn() {
            return getClient().isLoggedIn();
        }
    
        private boolean isInDanger() {
            return players.closest(p -> p != null && !p.equals(myPlayer()) && (myPosition().getY() > 3522) && p.getPosition().distance(myPosition()) < 20) != null;
        }
    
        private boolean isLowStamina() {
            return settings.getRunEnergy() < 20 && getInventory().contains(item -> item.getName().contains("Stamina") && item != null);
        }
    
    }

    Still no luck, have I maybe implemented the Constructor wrong? extending the class from MethodProvider still seams to produce the error. In the other class, the variable m is an instance of the main class. is this correct or should this be replaced?

    
    WalkingHandler w = new WalkingHandler(m);
    

    The npe now points to the execute line of the Walk() method in the WalkingHandler class also if that is any help.

     

    @jca @Ragnar Lothbrok

    Almost... 

    private final MethodProvider mp; 
    
    public WalkingHandler(final MethodProvider mp){
    	this.mp = mp; 
    }

    Doesn't need to extend MethodProvider and that'll give you a false result. 

    Initialise from your onStart in Main 

    new WalkingHandler(getBot().getMethods())

    Then call methods like...

    mp.getClient().isLoggedIn()

    Also the boolean isLowStamina()  I would change to isLowEnergy() 

    getSettings().getRunEnergy() < 20 

    Then you can check for and interact with Stamina potion if the event stops. 

  4. 8 minutes ago, ryank645 said:

    @jca after adding the boolean values to the walk() method, the script will no longer crash on start, however once the script reaches the point when the walk method is called, it again produces the NPE on the first boolean in the list.


    @Ragnar Lothbrok

    like this for example?

    
    boolean loggedIn(){
        return m.getClient().isLoggedIn();
    }

    Probably caused by the getClient() 

    Does Main extend Script? If so instead of doing main = new Main(), you should  pass getBot().getMethods() to a MethodProvider const in the constructor of your WalkingHandler class and then call getClient() on that 

  5. 45 minutes ago, hold it plz said:

    Looking good bro...

    Got some big updates in the works.

    Added Karamja Lobsters, all locations, Karambwan with fairy rings and glory teleport. Working on Minnows, Dark Crabs and Trawler before SDN. 

  6. 6 minutes ago, AsBakedAsCake said:

    Ayeee 100th post ?

    What difference? My members method can only be botted on so many accounts, I have half of my farm in F2P and never experience locks unless what I stated above ?

    It's good you found a method that works for you... however you're the first person I've spoken to in perhaps a year that has being able to avoid locks like this. 

    Out of my experience with many 1000s of accounts this is how it works ?

  7. 8 minutes ago, AsBakedAsCake said:

    I run a bot farm where half the accounts aren't made in the USA and I'm from the US. I never get locks at all? I don't know how accurate this is, but I can make my accounts on proxies from the UK or China and never get locked.

    My only experience with locks were when you switch the creation IP from the one you use to bot tutorial in game. After tutorial I can use any proxy I want and the accounts never get locked.

    The difference between free to play accounts and pay to play.... 

  8. 5 minutes ago, Raguto said:

    I'm sure you guys have read and responded to this many times but, what's the best way I can prevent accounts I sell to other people from being locked? This is not a bot operation, I am not botting. I have noticed accounts I sell that I leave F2P and don't train very much are the ones that get locked, but if I spend a few days training an account and get it members then once it is sold and the other person logs in it doesn't get locked. Thoughts on how to prevent it altogether?

    Where is the IP that you are training them on based? Your customers will need to use an IP from the same location to get around locks. 

  9. 11 minutes ago, DylanSRT said:

    Hi everyone,

    I'm trying to get my farming/birdhouse scripts to logout and sleep for a certain amount of time before re initializing the AutoLogin function. At the current moment I have just been having it chill in bank and change tabs every few minutes.

    So I tried using something like this:

    
    logoutTab.logout();
    sleep(3000000); //3m is 50mins in milliseconds
    

    So right after it logs out, it tries to log back in with the auto logger (before completing the rest of the loop with the sleep). 

    Has anyone done this successfully? Am I missing something?

    Edit: would be great if we could get a logoutSleep(int seconds) method for the logoutTab api. Seems like something that would be useful to most scripters

    You have to override the default login handler with something like this 

    Then use the CLI to launch the script with

    -allow norandoms

     

     

    • Like 3
  10. 4 minutes ago, Mootopia said:

    1) You said that you're creating accounts and they are getting banned. That is due to your proxy. 95% of the time, if you create an account on a regular proxy, the account will get locked/banned. I suggest buying accounts from somewhere like accounts.rs or from @jca or something. (If you create the account on proxy, and do tutorial island, The account will still be lost, even if there is no botting)

    Thanks for the recommendation. 

    Welcome @hank moody as mentioned, if you are creating accounts and not having any luck, check out my tutorial island account shop (link in signature) to buy some accounts that will work. 

    • Like 1
  11. 1 hour ago, Only Nature said:

    In my experience, when I have created the accounts myself from my home I.P, and allowed somebody else to use them, who lives in the same city, they do not get locked. 

    I purchased several tutorial island accounts before, and I had no idea when and where the accounts were created. These accounts were locked within 5 minutes sometimes, 30 minutes sometimes, and sometimes would even be days before getting locked randomly.

    Locks are solely based on IP, it’s not random. 

  12. 1 hour ago, Mootopia said:

    To get accounts that get past them being locked, you need to create them on a residential ip. I suggest getting something like this: http://stormproxies.com/residential_proxy.html you need to create the account on them and do tutorial island on them. No matter what. after that rest the account for about a week. you then need to run the accounts on ips that are in the same country as where you created the account. Doing stuff other than this will result in a lock. 95% of the time, doing stuff other than this will lock the account.

    I wouldn’t waste your money on this unless you’re going to automate everything, which it doesn’t sound like you are. Even then Storm Proxies suck. Instead just buy accounts, and begin understanding the fundamentals of farming. 

  13. 2 hours ago, will_of_fire said:

    how does someone even get that many at once? 

    Does it become tireless creating that many accounts/ keeping up with them and then having to login to all of them and start script and monitor them? 

    Much less trying replace them and keep all that data somewhere for every acc created/banned and which ones have membership? 

    Automation

  14. 2 minutes ago, Dot said:

    I'm writing an AIO fighter and I want my script to open doors if the closest attackable NPC is behind one (eg: Al-Kharid Warriors, some cunt closes a door in my face). Is there a better method for this than webwalking to the NPC's position?

    
    target = npcs.closest(n -> n.getName().equals(targetName) && n.exists()
    					&& n.getHealthPercent() > 0 && !myPlayer().isInteracting(n)
    					&& !n.isUnderAttack() && n != null);
    if (!map.canReach(target)) getWalking().webWalk(target.getPosition());
    else {
    	// do combat stuff
    }

    ^^ that's sort of what I'm using but webWalk is heavy on resources and I feel this is a really sloppy use of it.

    Is there a better way that is universal?

    getDoorHandler().handleNextObstacle(target)

    • Like 1
  15. 12 hours ago, heervangrijsburg said:

    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

    There's a few things to address here... 

    1. Try not to use static IDs, as these could change and it could break the script. Instead use a string literal to retrieve items 

    if ( getInventory().contains("Logs") ) {}

    2. Null check NPCs to avoid NullPointerExceptions, and move interactions to a conditional statement. This is so you can better deal with the success and failure events (true / false). 

    NPC exchangeClerk = getNpcs().closest("Grand Exchange Clerk");
    
    if ( exchangeClerk != null && exchangeClerk.interact("Exchange") ) {
    
    	new ConditionalSleep(MethodProvider.random(2000, 2500)) {
    		@Override
    		public boolean condition() throws InterruptedException {
    			return getGrandExchange().isOpen();
    		}
    	}.sleep();
    
    }

    3. Avoid while() statements, they are blocking the script onLoop(). The game environment is changing constantly and if the conditional for the while statement is unreachable your script will be unable to proceed. Instead write better conditionals. 

    ---

    Spoiler Alert - if you want to use an event to handle this, here is my snippet. As you can see I need to remove the static IDs for Addy and Mith axe, I can do this using an API for the items and dynamically fill item IDs. 

    Spoiler
    
    package events;
    
    import org.osbot.rs07.api.Bank;
    import org.osbot.rs07.api.GrandExchange;
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.api.map.constants.Banks;
    import org.osbot.rs07.api.model.Item;
    import org.osbot.rs07.api.model.NPC;
    import org.osbot.rs07.event.Event;
    import org.osbot.rs07.script.MethodProvider;
    import org.osbot.rs07.utility.ConditionalSleep;
    
    import java.util.Arrays;
    import java.util.List;
    
    public class BuyAxesEvent extends Event {
    
        @Override
        public int execute() {
            if ( getInventory().contains("Adamant axe") && getInventory().contains("Mithril axe") ) {
                setFinished();
            } else if (!Banks.GRAND_EXCHANGE.contains(myPosition())) {
                getWalking().webWalk(Banks.GRAND_EXCHANGE);
            } else {
    
                Item logs = getInventory().getItem("Logs");
    
                if ( logs != null && !logs.isNote() ) {
    
                    withdrawNotes(logs);
    
                    return 1000;
    
                }
    
                sellLogs();
    
    
            }
    
            return 200;
    
        }
    
        private void withdrawNotes(Item item) {
    
            if ( getBank().isOpen() ) {
    
                if (getBank().getWithdrawMode() != Bank.BankMode.WITHDRAW_NOTE)
                    getBank().enableMode(Bank.BankMode.WITHDRAW_NOTE);
    
                if (getBank().depositAll(item.getName())) {
    
                    new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return !getInventory().contains(item.getName());
                        }
                    }.sleep();
    
                getBank().withdrawAll(item.getName());
    
                }
    
            } else {
    
                NPC banker = getNpcs().closest("Banker");
    
                if ( banker != null && banker.interact("Bank") ) {
    
                    new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return getBank().isOpen();
                        }
                    }.sleep();
    
                }
    
            }
    
        }
    
        private void sellLogs(){
    
            if ( getBank().isOpen() )
                getBank().close();
    
            if ( ! getGrandExchange().isOpen() ) {
    
                NPC exchangeClerk = getNpcs().closest("Grand Exchange Clerk");
    
                if ( exchangeClerk != null && exchangeClerk.interact("Exchange") ) {
    
                    new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return getGrandExchange().isOpen();
                        }
                    }.sleep();
    
                }
    
            } else {
    
                if ( getInventory().contains("Logs") ) {
    
                    Item logs = getInventory().getItem("Logs");
    
                    if ( getGrandExchange().sellItem(logs.getId(), 1, logs.getAmount()) ) {
    
                        new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                            @Override
                            public boolean condition() throws InterruptedException {
                                return getGrandExchange().getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_SALE;
                            }
                        }.sleep();
    
                    }
    
                } else if ( getGrandExchange().getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_SALE && getGrandExchange().collect() ) {
    
                    new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return getInventory().contains("Coins");
                        }
                    }.sleep();
    
                } else if ( getInventory().contains("Coins") ) {
    
                    if ( getGrandExchange().getStatus(GrandExchange.Box.BOX_1).equals(GrandExchange.Status.EMPTY) && !getInventory().contains("Mithril axe")) {
    
                        if ( getGrandExchange().buyItem(1355, "Mithril axe", 1000, 1) ) {
    
                            new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                                @Override
                                public boolean condition() throws InterruptedException {
                                    return getGrandExchange().getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_BUY;
                                }
                            }.sleep();
    
                        }
    
                    }
    
                    if ( getGrandExchange().getStatus(GrandExchange.Box.BOX_2).equals(GrandExchange.Status.EMPTY) && !getInventory().contains("Adamant axe")) {
    
                        if ( getGrandExchange().buyItem(1357, "Adamant axe", 1000, 1) ) {
    
                            new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                                @Override
                                public boolean condition() throws InterruptedException {
                                    return getGrandExchange().getStatus(GrandExchange.Box.BOX_2) == GrandExchange.Status.PENDING_BUY;
                                }
                            }.sleep();
    
                        }
    
                    }
    
                    if ( getGrandExchange().getStatus(GrandExchange.Box.BOX_1).equals(GrandExchange.Status.FINISHED_BUY)|| getGrandExchange().getStatus(GrandExchange.Box.BOX_2).equals(GrandExchange.Status.FINISHED_BUY) ) {
    
                        if ( getGrandExchange().collect() ) {
    
                            new ConditionalSleep(MethodProvider.random(2000, 2500)) {
                                @Override
                                public boolean condition() throws InterruptedException {
                                    return !getGrandExchange().isBuyOfferOpen();
                                }
                            }.sleep();
    
                        }
    
                    }
    
                }
    
            }
    
        }
    
    }

    Run with 

    
    import events.BuyAxesEvent;
    
    private final BuyAxesEvent buyAxes = new BuyAxesEvent();
    
    if (!getInventory().contains("Adamant axe")) {
    
    	execute(buyAxes);
    
    }

     

     

    • Like 1
  16. 1 hour ago, Glaciation96 said:

    Sorry, I initially thought exchangeContext() was a java method not associated with botting! I managed to research into and understand how to implement it as you've suggested. But exchangeContext() has been deprecated, so no Javadoc could be found. Is there a new or updated approach? I was hoping suppressing the warnings would be a magical way out lol. 

    Thanks!

    EDIT: Also, I've seen from Explv that it's marked for internal use only, but still fine to use? How do I make it so it's "fine to use"? There is a horizontal line going straight through 'exchangeContext(getBot)'

    It’s fine, a horizontal line through the method is a notification to you that it is deprecated rather than an error that will stop it compiling. So you can use it as normal, as far as I’m aware it is the best practice. 

    • Like 1
×
×
  • Create New...