Jump to content

[10 Minute Scripts] Make an AIO Agility Script in 10 Minutes???


Eliot

Recommended Posts

Cool, thanks! Can you elaborate on this line?

Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) &&
                Arrays.asList(actions).contains(obj.getActions()[0]) &&
                (getMap().canReach(obj) || obj.getName().equals("Crate")) &&
                !obj.equals(previous));

Why .contains(obj.getActions()[0])? Why the [0], that's got me stuck. What is it's purpose here?

Link to comment
Share on other sites

1 hour ago, Athylus said:

Cool, thanks! Can you elaborate on this line?


Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) &&
                Arrays.asList(actions).contains(obj.getActions()[0]) &&
                (getMap().canReach(obj) || obj.getName().equals("Crate")) &&
                !obj.equals(previous));

Why .contains(obj.getActions()[0])? Why the [0], that's got me stuck. What is it's purpose here?

so you begin from the first object from the array. that's how agility courses work

Link to comment
Share on other sites

2 hours ago, Athylus said:

Cool, thanks! Can you elaborate on this line?


Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) &&
                Arrays.asList(actions).contains(obj.getActions()[0]) &&
                (getMap().canReach(obj) || obj.getName().equals("Crate")) &&
                !obj.equals(previous));

Why .contains(obj.getActions()[0])? Why the [0], that's got me stuck. What is it's purpose here?

An object has some set of actions, for example: ["Jump-up", "Walk here", "Examine"]. For agility, we always want to do the first interaction which in most programming languages is the 0 element. So I check my list of actions contains the first action in the object's list of actions, if it does, then I know it is an agility obstacle and I should interact with it.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Hi I am struggling a little bit with compiling.

I want this to pump indefinntly until I stop getting str xp witch should be every 5 mins, then it should continue to the next object which is the coke and fill up until it recieves a message to continue (which mean all spades full x 28) then should move on to fill the stove with coke and wait for another message to continue, once it sees the message it should go back to pumping until the xp stop and loop again.

 

public int onLoop() throws InterruptedException {
        int starting = getExperienceTracker().getGainedXP(Skill.STRENGTH);
        Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) &&
                Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj)) && !obj.equals(previous));
        if (nextObj != null && myPlayer().getInteracting() == null && !getDialogues().isPendingContinuation()) {
            if (nextObj.interact(nextObj.getActions()[0])) {
                new ConditionalSleep(10000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return getExperienceTracker().getGainedXP(Skill.STRENGTH) < starting;
                    }
                }.sleep();
            } if (getExperienceTracker().getGainedXP(Skill.STRENGTH) > starting){
                previous = nextObj;
            }
        }
        return 250;
    }

Please help.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

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...