Jump to content

Shortening code


Rumple

Recommended Posts

So I am working on agility script. I am using positioning in order to go through the course but its so much code. Is there a faster way for me to have just 1 Function.

And this is without fail checking to see if i crossed the obstacle. 

my loop right now.

public int onLoop() throws InterruptedException {
        RS2Object block1 = getObjects().closest(FB1, "Pyramid block");
        RS2Object block2 = getObjects().closest(FB2, "Pyramid block");
        RS2Object rockWall = getObjects().closest(CRA, "Climbing rocks");
        RS2Object topRockWall = getObjects().closest(climbTopRock,"Climbing rocks");
        RS2Object stairs = getObjects().closest("Stairs");
        RS2Object obsticle = getObjects().closest(3550);
        RS2Object lWall = getObjects().closest("Low wall");
        RS2Object ledge = getObjects().closest("Ledge");
        RS2Object gap = getObjects().closest(10863); // Jump/Cross
        RS2Object gap1 = getObjects().closest(10859);
        RS2Object plank = getObjects().closest("Plank"); // Cross
        RS2Object door = getObjects().closest("Doorway");
        NPC Simon = getNpcs().closest("Simon Templeton");
        Position myPos = myPosition();
        int starting = getExperienceTracker().getGainedXP(Skill.AGILITY);

        if (myPos.equals(endA) || myPos.equals(endB) && getInventory().contains(6970)) {
            getWalking().webWalk(ClimbRock);
            sleep(random(1500));
        }

        if (rockWall != null && myPos.equals(ClimbRock) && getInventory().contains(6970)) {
            rockWall.interact("Climb");
            sleep(random(250));
        }

        if(topRockWall != null && myPos.equals(topClimb) || myPos.equals(topClimbB) && !getInventory().contains(6970)){
            topRockWall.interact("Climb");
            sleep(random(250));
        }

        if (myPos.equals(topHillSimonA) || myPos.equals(topHillSimonB) || myPos.equals(topHillSimonC) && getInventory().contains(6970)) {
            if (Simon != null) {
                log("found Simon");
                getInventory().interact("Use", "Pyramid top");
                Simon.interact("Use");
            }
        }

        //Low Wall
        if (lWall != null && myPos.equals(LWA1) || myPos.equals(LWB1)){
            lWall.interact("Climb-over");
            sleep(random(1500));
        }
        if (lWall != null && myPos.equals(LW2)){
            lWall.interact("Climb-over");
            sleep(random(1500));
        }
        if (lWall != null && myPos.equals(LWA3) || myPos.equals(LWB3)){
            lWall.interact("Climb-over");
            sleep(random(1500));
        }
        if (lWall != null && myPos.equals(LWA4) || myPos.equals(LWB4)){
            lWall.interact("Climb-over");
            sleep(random(1500));
        }
        if (lWall != null && myPos.equals(LWA5) || myPos.equals(LWB5)){
            lWall.interact("Climb-over");
            sleep(random(1500));
        }
        //Gap there is gap after block 2
        if (gap != null && myPos.equals(CGA1) || myPos.equals(CGB1)){
            gap.interact("Cross");
            sleep(random(1500));
        }
        if (gap != null && myPos.equals(CGA2) || myPos.equals(CGB2)){
            gap.interact("Cross");
            sleep(random(1500));
        }
        if (gap != null && myPos.equals(CGA3) || myPos.equals(CGB3)){
            gap.interact("Cross");
            sleep(random(1500));
        }
        //Jump Gap
        if (gap1 != null && myPos.equals(JGA1) || myPos.equals(JGB1)){
            gap1.interact("Jump");
            sleep(random(1500));
        }
        if (gap1 != null && myPos.equals(JGA2) || myPos.equals(JGB2)){
            gap1.interact("Jump");
            sleep(random(1500));
        }
        if (gap1 != null && myPos.equals(JGA3) || myPos.equals(JGB3)){
            gap1.interact("Jump");
            sleep(random(1500));
        }
        if (gap1 !=null && myPos.equals(ABA2)){
            gap1.interact("Jump");
            sleep(random(1500));
        }
        if (gap1 != null && myPos.equals(JGA4) || myPos.equals(JGB4)){
            gap1.interact("Jump");
            sleep(random(1500));
        }
        if (gap1 != null && myPos.equals(JG5)){
            gap1.interact("Jump");
            sleep(random(1500));
        }
        //Plank
        if (plank != null && block1 != null && myPos.equals(BBB1) || myPos.equals(BBA1)){
            sleep(random(2500,3500));
            plank.interact("Cross");
            sleep(random(1500));
        }
        if (plank != null && myPos.equals(CP1)){
            plank.interact("Cross");
            sleep(random(1500));
        }
        //Obsticle
        if(obsticle != null && myPos.equals(RA1) || myPos.equals(RB1)) {
            obsticle.interact();
            sleep(random(1500));
        }
        if(obsticle != null && myPos.equals(R2)) {
            obsticle.interact();
            sleep(random(1500));
        }
        if(obsticle != null && myPos.equals(RA3) || myPos.equals(RB3)) {
            obsticle.interact();
            sleep(random(1500));
        }
        if(obsticle != null && myPos.equals(R4)) {
            obsticle.interact();
            sleep(random(1500));
        }
        if(obsticle != null && myPos.equals(R5)) {
            obsticle.interact();
            sleep(random(1500));
        }
        //Stairs
        if(stairs != null && myPos.equals(SSA1) || myPos.equals(SSB1) && !getInventory().contains(6970)){
            stairs.interact("Climb-up");
            sleep(random(1500));
        }

        if(stairs != null && myPos.equals(SS2)){
            stairs.interact("Climb-up");
            sleep(random(1500));
        }
        if(stairs != null && myPos.equals(SS3)){
            stairs.interact("Climb-up");
            sleep(random(1500));
        }
        if(stairs != null && myPos.equals(SS4)){
            stairs.interact("Climb-up");
            sleep(random(1500));
        }
        if(stairs != null && myPos.equals(SS5)){
            stairs.interact("Climb-up");
            sleep(random(1500));
        }
        //Doorway
        if(door != null && myPos.equals(ED1)){
            door.interact("Enter");
            sleep(random(1500));
        }
        //Ledge
        if (ledge != null && myPos.equals(CLA1) || myPos.equals(CLB1)){
            ledge.interact("Cross");
            sleep(random(1500));
        }

        if (ledge != null && myPos.equals(ABA2) || myPos.equals(ABB2)){
            ledge.interact("Cross");
            sleep(random(1500));
        }

        if (ledge != null && myPos.equals(CL2)){
            ledge.interact("Cross");
            sleep(random(1500));
        }
        if (ledge != null && myPos.equals(CLA3) || myPos.equals(CLB3)){
            ledge.interact("Cross");
            sleep(random(1500));
        }
        if (ledge != null && myPos.equals(CLA4) || myPos.equals(CLB4)){
            ledge.interact("Cross");
            sleep(random(1500));
        }
        //Pyramid Block
        if(myPos.equals(AL1)){
            getWalking().webWalk(BBA1);
            sleep(random(1500));
        }
        if(myPos.equals(AL2)){
            getWalking().webWalk(BBA2);
            sleep(random(1500));
        }

        if(block2 != null && myPos.equals(BBA2) || myPos.equals(BBB2)){
            sleep(random(2000,3000));
            getWalking().webWalk(ABA2);
        }


        return random(5000);
    }

 

Link to comment
Share on other sites

dont use position, what if ur script missclicks or random event gets in the way(low chance but possible)?

u can use for loops, but u need checks like canReach /distance/plane checks

havent done agility pyramid, but sometimes all the conditions return true for unreachable object, so u need exception cases

u could also update a set to avoid previous obstacle but not suer how reliable would be

dont use static sleeps for agility- its really bizarre, use conditional sleep until your player is not animating

since ur going to use conditional sleeps alot, look up live templates in case ur using intellij IDE

https://gyazo.com/b4800615a57ea2c786a027ac0a3e6507

get full template by typing "cond" if ur lazy like me

 

good luck :)

 

 

 

 

Link to comment
Share on other sites

6 hours ago, extatus said:

dont use position, what if ur script missclicks or random event gets in the way(low chance but possible)?

u can use for loops, but u need checks like canReach /distance/plane checks

havent done agility pyramid, but sometimes all the conditions return true for unreachable object, so u need exception cases

u could also update a set to avoid previous obstacle but not suer how reliable would be

dont use static sleeps for agility- its really bizarre, use conditional sleep until your player is not animating

since ur going to use conditional sleeps alot, look up live templates in case ur using intellij IDE

https://gyazo.com/b4800615a57ea2c786a027ac0a3e6507

get full template by typing "cond" if ur lazy like me

 

good luck :)

 

 

 

 

I wish i can do something like previous but then there is obstacle that does not have name or action just id and u have to click on it. and then there are 2 pyramid blocks that move.

It would make my code 10x shorter if I can incorporate the pyramid block that spins and moves.

Link to comment
Share on other sites

1 hour ago, Rumple said:

I wish i can do something like previous but then there is obstacle that does not have name or action just id and u have to click on it. and then there are 2 pyramid blocks that move.

It would make my code 10x shorter if I can incorporate the pyramid block that spins and moves.

no orientation & object info when u hover the spinning obstacle with entity debugger?

and moving blocks move with fixed interval? if so

u need to address a timing problem; u cant step on too late

not sure how you would go about it

 

 

 

Edited by extatus
Link to comment
Share on other sites

5 hours ago, extatus said:

no orientation & object info when u hover the spinning obstacle with entity debugger?

and moving blocks move with fixed interval? if so

u need to address a timing problem; u cant step on too late

not sure how you would go about it

 

 

 

Yea the rolling block does not have name or action just has ID, that i can left click on. so it wont work as a previous obstacle as it has no name or action.

the moving block is easy to get past.

I made an area where the block moves into on the path. And i set a timer when the blocks moves into the area it becomes visible and random sleeps 2-3.5 seconds for block to move back into original spot off the path.

Link to comment
Share on other sites

1 hour ago, Rumple said:

Also i am wondering if there is a command that will end a function in loop as soon as it completes and and wont click it again. because even though i passed the obstacle it tends to turn the camera around and clicks it again. 

wdym

for(;;) {

if(cond){

break;

   }
}

use break to get out loop, and checks to begin for loop ofc

Edited by extatus
Link to comment
Share on other sites


    @Override
    public int onLoop() throws InterruptedException {
        RS2Object block1 = getObjects().closest(FB1, "Pyramid block");
        RS2Object block2 = getObjects().closest(FB2, "Pyramid block");
        RS2Object block2B = getObjects().closest(FB2B, "Pyramid block");
        RS2Object rockWall = getObjects().closest(CRA, "Climbing rocks");
        RS2Object rockWallB = getObjects().closest(CRB, "Climbing rocks");
        RS2Object topRockWall = getObjects().closest(climbTopRock,"Climbing rocks");
        RS2Object stairs = getObjects().closest("Stairs");
        RS2Object obsticle = getObjects().closest(3550);
        RS2Object lWall = getObjects().closest("Low wall");
        RS2Object ledge = getObjects().closest("Ledge");
        RS2Object gap = getObjects().closest(10863); // Jump/Cross
        RS2Object gap1 = getObjects().closest(10859);
        RS2Object plank = getObjects().closest("Plank"); // Cross
        RS2Object door = getObjects().closest("Doorway");
        NPC Simon = getNpcs().closest(SimonA,5786);
        Position myPos = myPosition();
        int starting = getExperienceTracker().getGainedXP(Skill.AGILITY);

        //end of agility walking to Simon
        if (myPos.equals(endA) || myPos.equals(endB) && getInventory().contains(6970)) {
            getWalking().webWalk(ClimbRock);
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Climbing rock to Simon with pyramid top
        if (rockWall != null && myPos.equals(ClimbRock) && getInventory().contains(6970)) {
            rockWall.interact("Climb");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && myPos.equals(SimonA));
                }
            }.sleep();
        }
        //climbing at top of agility pyramid for pyaramid top
        if(topRockWall != null && !getInventory().contains(6970) && myPos.equals(topClimb) || myPos.equals(topClimbB)){
            topRockWall.interact("Climb");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && getInventory().contains(6970));
                }
            }.sleep();
        }
        // Using pyramid top on Simon
        if (myPos.equals(topHillSimonA) || myPos.equals(topHillSimonB) || myPos.equals(topHillSimonC) && getInventory().contains(6970)) {
            if (Simon != null) {
                log("found Simon");
                getInventory().interact("Use", "Pyramid top");
                Simon.interact("Use");
            }
        }
        //climbing down rock wall without pyramid top
        if(!getInventory().contains(6970) && rockWallB != null && myPos.equals(SimonA)){
            rockWallB.interact("Climb");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && myPos.equals(CRA));
                }
            }.sleep();
        }
        //
        if(!getInventory().contains(6970) && myPos.equals(CRA)){
            getWalking().webWalk(SSA1);
                new ConditionalSleep(10000, 250){
                    @Override
                    public boolean condition() throws InterruptedException{
                        return (!myPlayer().isMoving() && !myPlayer().isAnimating() && myPos.equals(SSA1));
                    }
                }.sleep();
        }
        //Low Wall
        if (lWall != null && myPos.equals(LWA1) || myPos.equals(LWB1)){
            lWall.interact("Climb-over");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (lWall != null && myPos.equals(LW2)){
            lWall.interact("Climb-over");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (lWall != null && myPos.equals(LWA3) || myPos.equals(LWB3)){
            lWall.interact("Climb-over");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (lWall != null && myPos.equals(LWA4) || myPos.equals(LWB4)){
            lWall.interact("Climb-over");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (lWall != null && myPos.equals(LWA5) || myPos.equals(LWB5)){
            lWall.interact("Climb-over");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Gap
        if (gap != null && myPos.equals(CGA1) || myPos.equals(CGB1)){
            gap.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap != null && myPos.equals(CGA2) || myPos.equals(CGB2)){
            gap.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap != null && myPos.equals(CGA3) || myPos.equals(CGB3)){
            gap.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Jump Gap
        if (gap1 != null && myPos.equals(JGA1) || myPos.equals(JGB1)){
            gap1.interact("Jump");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap1 != null && myPos.equals(JGA2) || myPos.equals(JGB2)){
            gap1.interact("Jump");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap1 != null && myPos.equals(JGA3) || myPos.equals(JGB3)){
            gap1.interact("Jump");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap1 !=null && myPos.equals(ABA2)){
            gap1.interact("Jump");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap1 != null && myPos.equals(JGA4) || myPos.equals(JGB4)){
            gap1.interact("Jump");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (gap1 != null && myPos.equals(JG5)){
            gap1.interact("Jump");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Plank
        if (plank != null && block1 != null && myPos.equals(BBB1) || myPos.equals(BBA1)){
            new ConditionalSleep(2000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (block1 == null);
                }
            }.sleep();
            plank.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (plank != null && myPos.equals(CP1)){
            plank.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Obsticle
        if(obsticle != null && myPos.equals(RA1) || myPos.equals(RB1)) {
            obsticle.interact();
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && lWall != null);
                }
            }.sleep();
        }
        if(obsticle != null && myPos.equals(R2) && !myPos.equals(CGB1) && !myPos.equals(CGA1)) {
            obsticle.interact();
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && gap != null);
                }
            }.sleep();
        }
        if(obsticle != null && myPos.equals(RA3) || myPos.equals(RB3) && !myPos.equals(CLA3) && !myPos.equals(CLB3)) {
            obsticle.interact();
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && ledge != null);
                }
            }.sleep();
        }
        if(obsticle != null && myPos.equals(R4) && !myPos.equals(JGA4) && !myPos.equals(JGB4)) {
            obsticle.interact();
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating() && gap1 != null);
                }
            }.sleep();
        }
        if(obsticle != null && getInventory().contains(6970) && !myPos.equals(JG5)) {
            obsticle.interact();
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Stairs
        if(stairs != null && myPos.equals(SSA1) || myPos.equals(SSB1)  || myPos.equals(CRA) && !getInventory().contains(6970)){
            stairs.interact("Climb-up");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }

        if(stairs != null && myPos.equals(SS2)){
            stairs.interact("Climb-up");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if(stairs != null && myPos.equals(SS3)){
            stairs.interact("Climb-up");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if(stairs != null && myPos.equals(SS4)){
            stairs.interact("Climb-up");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if(stairs != null && myPos.equals(SS5)){
            stairs.interact("Climb-up");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Doorway
        if(door != null && myPos.equals(ED1)){
            door.interact("Enter");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Ledge
        if (ledge != null && myPos.equals(CLA1) || myPos.equals(CLB1)){
            ledge.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
    /*
        if (ledge != null && myPos.equals(ABA2) || myPos.equals(ABB2)){
            ledge.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
    */
        if (ledge != null && myPos.equals(CL2)){
            ledge.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (ledge != null && myPos.equals(CLA3) || myPos.equals(CLB3)){
            ledge.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if (ledge != null && myPos.equals(CLA4) || myPos.equals(CLB4)){
            ledge.interact("Cross");
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        //Pyramid Block
        if(myPos.equals(AL1)){
            getWalking().webWalk(BBA1);
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }
        if(myPos.equals(AL2)){
            getWalking().webWalk(BBA2);
            new ConditionalSleep(10000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (!myPlayer().isMoving() && !myPlayer().isAnimating());
                }
            }.sleep();
        }

        if(block2 != null && myPos.equals(BBA2) || myPos.equals(BBB2)){
            new ConditionalSleep(2000, 250){
                @Override
                public boolean condition() throws InterruptedException{
                    return (block2B != null);
                }
            }.sleep();
            getWalking().webWalk(ABA2);
        }


        return random(5000);
    }

 

Link to comment
Share on other sites

2 hours ago, someguy69 said:

https://osbot.org/forum/topic/145029-10-minute-scripts-make-an-aio-agility-script-in-10-minutes/
 

This is what you're looking for, I think. You will want to add your own special touches of course, like using cammy tp if you have it unlocked for seers. Good luck!

Like stated previously this will not work as I have an object without name or action plus I have a moving pyramid. I wish I could use this method it is the first thing I tried before moving on to my new method/strategy.

Link to comment
Share on other sites

On 3/9/2019 at 9:16 AM, Rumple said:

Like stated previously this will not work as I have an object without name or action plus I have a moving pyramid. I wish I could use this method it is the first thing I tried before moving on to my new method/strategy.

Well It looks cleaner if u use two arrays for rest of the obstacles. Very pseudo but u might get the idea:

if(insert code){ //condition(s) moving block occurs

moveBlock();

} else if (insert code) { // something else occurs that cant be normally dealt with

clickObject();

} else {

methodFromEliotsGuide();

}

Eliots guide works but:

1) make sure that its impossible to fall during 2nd obstacle(which probably is)

2) what if an obstacle occurs more than once in sequence? Then wouldnt work at all

3) make sure to stop conditional sleep after you fell from course

--

should be more readable and atleast 75% less code

Edited by extatus
Link to comment
Share on other sites

On 3/8/2019 at 6:17 PM, Rumple said:

Also i am wondering if there is a command that will end a function in loop as soon as it completes and and wont click it again. because even though i passed the obstacle it tends to turn the camera around and clicks it again. 

Not sure what you meant by that. You dont use any loops in your script. (not onloop)

If you dont want the method to occur again,use area before obstacle ? Therefore if youve passed the obstacle, it cannot click again. 

Idk how thats even happening, ur code uses similar principle with myPosition().equals condition. Maybe i just dont see it, kinda hard to read xd

Definetly try to keep the code more organized & compact.

 

Edited by extatus
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...