Jump to content

Working with Autocasting


roguehippo

Recommended Posts

Autocast config is getConfigs().get(108)

Not sure if the 108 is related to what staff you are carrying or it's just static, I've done this with a staff of air

 

Value 0 is no spell selected

Value 3 is air strike

5 is water strike and so on

 

smile.png

Here is a snippet that does a spell change based on levels

private int getSpellChange()
{
    int currentSpell = self.getConfigs().get(108);
    int currentLevel = self.getSkills().getStatic(Skill.MAGIC);
    if (currentLevel >= 13) {
        if (currentSpell != 9) {
            return 4;
        } else{ 
            return 0;
        }
    } else if (currentLevel >= 9) {
        if (currentSpell != 7) {
            return 3;
        } else{ 
            return 0;
        }
    } else if (currentLevel >= 5) {
        if (currentSpell != 5) {
            return 2;
        } else{ 
            return 0;
        }
    } else if (currentLevel >= 1) {
        if (currentSpell != 3) {
            return 1;
        } else{ 
            return 0;
        }
    } 
    return 0;
}


private void changeSpell()
{
    if (self.getTabs().open(Tab.ATTACK)) {
        RS2Widget castWidget = self.getWidgets().get(593, 25);
        if (castWidget != null && castWidget.isVisible()) {
            if (castWidget.interact()) {
                new ConditionalSleep(MethodProvider.random(2000,5000), MethodProvider.random(100,200)) {
                    @[member=Override]
                    public boolean condition() throws InterruptedException {
                        return !castWidget.isVisible();
                    }
                }.sleep();
            }
        } else {
            RS2Widget spellWidget = self.getWidgets().get(201, 0 , getSpellChange());
            if (spellWidget != null && spellWidget.isVisible() && spellWidget.interact()) {
                new ConditionalSleep(MethodProvider.random(2000,5000), MethodProvider.random(100,200)) {
                    @[member=Override]
                    public boolean condition() throws InterruptedException {
                        return getSpellChange() == 0;
                    }
                }.sleep();
                if (MethodProvider.random(0, 1) == 0) {
                    self.getTabs().open(Tab.INVENTORY);
                }
            }
        }
    }
}   


Edited by Abuse
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

 

Autocast config is getConfigs().get(108)

Not sure if the 108 is related to what staff you are carrying or it's just static, I've done this with a staff of air

 

Value 0 is no spell selected

Value 3 is air strike

5 is water strike and so on

 

smile.png

Here is a snippet that does a spell change based on levels

private int getSpellChange()
{
    int currentSpell = self.getConfigs().get(108);
    int currentLevel = self.getSkills().getStatic(Skill.MAGIC);
    if (currentLevel >= 13) {
        if (currentSpell != 9) {
            return 4;
        } else{ 
            return 0;
        }
    } else if (currentLevel >= 9) {
        if (currentSpell != 7) {
            return 3;
        } else{ 
            return 0;
        }
    } else if (currentLevel >= 5) {
        if (currentSpell != 5) {
            return 2;
        } else{ 
            return 0;
        }
    } else if (currentLevel >= 1) {
        if (currentSpell != 3) {
            return 1;
        } else{ 
            return 0;
        }
    } 
    return 0;
}


private void changeSpell()
{
    if (self.getTabs().open(Tab.ATTACK)) {
        RS2Widget castWidget = self.getWidgets().get(593, 25);
        if (castWidget != null && castWidget.isVisible()) {
            if (castWidget.interact()) {
                new ConditionalSleep(MethodProvider.random(2000,5000), MethodProvider.random(100,200)) {
                    @[member='Override']
                    public boolean condition() throws InterruptedException {
                        return !castWidget.isVisible();
                    }
                }.sleep();
            }
        } else {
            RS2Widget spellWidget = self.getWidgets().get(201, 0 , getSpellChange());
            if (spellWidget != null && spellWidget.isVisible() && spellWidget.interact()) {
                new ConditionalSleep(MethodProvider.random(2000,5000), MethodProvider.random(100,200)) {
                    @[member='Override']
                    public boolean condition() throws InterruptedException {
                        return getSpellChange() == 0;
                    }
                }.sleep();
                if (MethodProvider.random(0, 1) == 0) {
                    self.getTabs().open(Tab.INVENTORY);
                }
            }
        }
    }
}   


sorry for the late reply but thanks so much! this will definitely come in handy. 

Try autocast api made by botre in the snippets section

i saw that but i dont really know how to add like a function like that into my script :(

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