Jump to content

clicking issues


iTz EcLiPsE

Recommended Posts

ok so im using apaecs tea thiever and ive been rewriting it myself or at least trying to and only using bits and pieces of his tut code the issue im running into and what im wondering how to get rid of is when it clicks the tea stall to thief it clicks 4 times instead of once and in different locations is there a way i can change that so it clicks in 1 spot so it doesnt end up running off and getting stuck behind the stall?

Link to comment
Share on other sites

You could add a check for where your character stands before thieving. So it makes sure it's standing at those coordinates before it thieves. And if it isn't you can make it walk to that tile. Also you need to have a sleep after clicking otherwise it will try to spamclick the thieving stall because it checks for the stall multiple times before it is actually thieved. Because the tea stall doesn't become empty right at the moment you click it right?

Edited by September
Link to comment
Share on other sites

You could add a check for where your character stands before thieving. So it makes sure it's standing at those coordinates before it thieves. And if it isn't you can make it walk to that tile. Also you need to have a sleep after clicking otherwise it will try to spamclick the thieving stall because it checks for the stall multiple times before it is actually thieved. Because the tea stall doesn't become empty right at the moment you click it right?

 

yea it spam clicks but it clicks all the points on the stall that have the "Steal-from" option but yea that would prolly do it to add a sleep after the first click.. u thing 1000 is long enough or should i made it a little longer? and im not entirely sure where to put the sleep in the code

the sleep worked lol idk if its codes the prettiest but it works lmao thank you :)

Link to comment
Share on other sites

yea it spam clicks but it clicks all the points on the stall that have the "Steal-from" option but yea that would prolly do it to add a sleep after the first click.. u thing 1000 is long enough or should i made it a little longer? and im not entirely sure where to put the sleep in the code

the sleep worked lol idk if its codes the prettiest but it works lmao thank you smile.png

 

I have rewritten it slightly. I put the onLoop code inside if(!myPlayer().isAnimating())  so that it will not click the Tea stall if it is already thieving. Then I added a ConditionalSleep after the interaction, which stops sleeping when the player has begun animating.

 

(untested)

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 = "You", info = "My first script", name = "Tea thiever", version = 1.0, logo = "")
public class TeaStealer extends Script {

    private enum State { STEAL, DROP }

    @Override
    public int onLoop() throws InterruptedException {

        if(!myPlayer().isAnimating()) {

            switch (getState()) {

                case STEAL:
                    steal();
                    break;
                case DROP:
                    drop();
                    break;
            }
        }
        return random(200, 300);
    }

    private State getState() {

        if(getInventory().isFull()) return State.DROP;
        return State.STEAL;
    }

    private void steal(){

        Entity stall = getObjects().closest("Tea stall");
        if (stall != null) {

            stall.interact("Steal-from");
            new ConditionalSleep(2000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return myPlayer().isAnimating();
                }
            }.sleep();
        }
    }

    private void drop(){

        getInventory().dropAll();
    }
}
Edited by Explv
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...