Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • How do I auto cast spell?


    AsBakedAsCake

    Recommended Posts

    Title? I just figured I'd post this in the spam section since I ask so many questions lmfao, sorry guys I'm not completely sure how everything works yet.

     

    so far I've tried: getMagic().castSpellOn(Normal.FIRE_STRIKE, FORTRESS_GUARD); but just uses normal spell book. If I can't figure out auto cast, I'll just make a fully automated curser or something.

     

    Thanks for any help, once again sorry i ask so much questions but I just wanna have a sick release.

     

    Should I use widgets? I tried earlier but I couldn't get it to work o.O

    Link to comment
    Share on other sites

    There's no method in the API for autocast. You will need to use widgets and configs to make your own

    Thanks for the answer, when I used widgets earlier I could get the spells open, but the widgetchild for firestrike had no action, can I still use a widget with no action listed in the debugger?

    Link to comment
    Share on other sites

    Get the widget to open the autocast selection, the get the widget for the spell. Interact with the widget.

    So I tried this:

     

    WidgetChild chooseSpellWidg = getWidgets().getWidgetChild(593,24);

    if(chooseSpellWidg != null && chooseSpellWidg.isVisible()){

    chooseSpellWidg.interact("Choose spell");

     

    Doesn't work :/ fml

     

    Edit: The above widget is correct, if someone can leave me an example line, that would be great. It's literally my last step from full automation.

    Link to comment
    Share on other sites

    Here's some data:

    public enum AutocastData {
    
        WIND_STRIKE(108, 3, Normal.WIND_STRIKE, new int[]{201, 0, 1}),
        WATER_STRIKE(108, 5, Normal.WATER_STRIKE, new int[]{201, 0, 2}),
        EARTH_STRIKE(108, 7, Normal.EARTH_STRIKE, new int[]{201, 0, 3}),
        FIRE_STRIKE(108, 9, Normal.FIRE_STRIKE, new int[]{201, 0, 4}),
        WIND_BOLT(108, 11, Normal.WIND_BOLT, new int[]{201, 0, 5}),
        WATER_BOLT(108, 13, Normal.WATER_BOLT, new int[]{201, 0, 6}),
        EARTH_BOLT(108, 15, Normal.EARTH_BOLT, new int[]{201, 0, 7}),
        FIRE_BOLT(108, 17, Normal.FIRE_BOLT, new int[]{201, 0, 8}),
        WIND_BLAST(108, 19, Normal.WIND_BLAST, new int[]{201, 0, 9}),
        WATER_BLAST(108, 21, Normal.WATER_BLAST, new int[]{201, 0, 10}),
        EARTH_BLAST(108, 23, Normal.EARTH_BLAST, new int[]{201, 0, 11}),
        FIRE_BLAST(108, 25, Normal.FIRE_BLAST, new int[]{201, 0, 12}),
        WIND_WAVE(108, 27, Normal.WIND_WAVE, new int[]{201, 0, 13}),
        WATER_WAVE(108, 29, Normal.WATER_WAVE, new int[]{201, 0, 14}),
        EARTH_WAVE(108, 31, Normal.EARTH_WAVE, new int[]{201, 0, 15}),
        FIRE_WAVE(108, 33, Normal.FIRE_WAVE, new int[]{201, 0, 16}),
    
        SMOKE_RUSH(108, 63, Ancient.SMOKE_RUSH, new int[]{201, 0, 31}),
        SHADOW_RUSH(108, 65, Ancient.SHADOW_RUSH, new int[]{201, 0, 32}),
        BLOOD_RUSH(108, 67, Ancient.BLOOD_RUSH, new int[]{201, 0, 33}),
        ICE_RUSH(108, 69, Ancient.ICE_RUSH, new int[]{201, 0, 34}),
        SMOKE_BURST(108, 71, Ancient.SMOKE_BURST, new int[]{201, 0, 35}),
        SHADOW_BURST(108, 73, Ancient.SHADOW_BURST, new int[]{201, 0, 36}),
        BLOOD_BURST(108, 75, Ancient.BLOOD_BURST, new int[]{201, 0, 37}),
        ICE_BURST(108, 77, Ancient.ICE_BURST, new int[]{201, 0, 38}),
        SMOKE_BLITZ(108, 79, Ancient.SMOKE_BLITZ, new int[]{201, 0, 39}),
        SHADOW_BLITZ(108, 81, Ancient.SHADOW_BLITZ, new int[]{201, 0, 40}),
        BLOOD_BLITZ(108, 83, Ancient.BLOOD_BLITZ, new int[]{201, 0, 41}),
        ICE_BLITZ(108, 85, Ancient.ICE_BLITZ, new int[]{201, 0, 42}),
        SMOKE_BARRAGE(108, 87, Ancient.SMOKE_BARRAGE, new int[]{201, 0, 43}),
        SHADOW_BARRAGE(108, 89, Ancient.SHADOW_BARRAGE, new int[]{201, 0, 44}),
        BLOOD_BARRAGE(108, 91, Ancient.BLOOD_BARRAGE, new int[]{201, 0, 45}),
        ICE_BARRAGE(108, 93, Ancient.ICE_BARRAGE, new int[]{201, 0, 46}),;
    
        int configID;
        int configValue;
        Spell spell;
        int[] widgetIds;
    
        AutocastData(int configID, int configValue, Spell spell, int[] widgetIds) {
            this.configID = configID;
            this.configValue = configValue;
            this.spell = spell;
            this.widgetIds = widgetIds;
        }
    
        public int getConfigID() {
            return configID;
        }
    
        public int getConfigValue() {
            return configValue;
        }
    
        public Spell getSpell() {
            return spell;
        }
    
        public int[] getWidgetIds() {
            return widgetIds;
        }
    
    public class AutocastNode extends ScriptNode {
    
        public AutocastData autocastData;
    
        public AutocastNode(NMZScript s, AutocastData autocastData) {
            super(s);
            this.autocastData = autocastData;
        }
    
        @Override
        public int priority() {
            return 19;
        }
    
        @Override
        public boolean accept() {
            return getPlayerSettings().getConfig(autocastData.getConfigID()) != autocastData.getConfigValue();
        }
    
        @Override
        public int execute() {
            WidgetChild w = getWidgets().getWidgetChild(autocastData.getWidgetIds());
            if (w != null && w.isVisible()) {
                if (w.interact())
                    return 500;
            } else {
                w = getWidgets().getWidgetChild(593, 24);
                if (w != null && w.isVisible()) {
                    if (w.interact())
                        return 500;
                } else if (getTabs().open(Tab.COMBAT))
                    return 500;
            }
            return 200;
        }
    
    

    With the above code you can build something like this:

    public boolean setAutocast(AutocastData autocastData) {
            if (getPlayerSettings().getConfig(autocastData.getConfigID()) == autocastData.getConfigValue())
                return true;
    
            WidgetChild w = getWidgets().getWidgetChild(autocastData.getWidgetIds());
            if (w != null && w.isVisible()) {
                if (w.interact())
                    sleep(500);
            } else {
                w = getWidgets().getWidgetChild(593, 24);
                if (w != null && w.isVisible()) {
                    if (w.interact())
                        sleep(500);
                } else if (getTabs().open(Tab.COMBAT))
                    sleep(500);
            }
    
            return setAutocast(autocastData);
        }
        
        public boolean autocastOnEntity(Entity e, AutocastData d) {
            return setAutocast(d) && e.interact("Attack");
        }
    
    Link to comment
    Share on other sites

    So I tried this:

     

    WidgetChild chooseSpellWidg = getWidgets().getWidgetChild(593,24);

    if(chooseSpellWidg != null && chooseSpellWidg.isVisible()){

    chooseSpellWidg.interact("Choose spell");

     

    Doesn't work :/ fml

     

    Edit: The above widget is correct, if someone can leave me an example line, that would be great. It's literally my last step from full automation.

     

    .interact(); ?

    Link to comment
    Share on other sites

     

    Here's some data:

    public enum AutocastData {
    
        WIND_STRIKE(108, 3, Normal.WIND_STRIKE, new int[]{201, 0, 1}),
        WATER_STRIKE(108, 5, Normal.WATER_STRIKE, new int[]{201, 0, 2}),
        EARTH_STRIKE(108, 7, Normal.EARTH_STRIKE, new int[]{201, 0, 3}),
        FIRE_STRIKE(108, 9, Normal.FIRE_STRIKE, new int[]{201, 0, 4}),
        WIND_BOLT(108, 11, Normal.WIND_BOLT, new int[]{201, 0, 5}),
        WATER_BOLT(108, 13, Normal.WATER_BOLT, new int[]{201, 0, 6}),
        EARTH_BOLT(108, 15, Normal.EARTH_BOLT, new int[]{201, 0, 7}),
        FIRE_BOLT(108, 17, Normal.FIRE_BOLT, new int[]{201, 0, 8}),
        WIND_BLAST(108, 19, Normal.WIND_BLAST, new int[]{201, 0, 9}),
        WATER_BLAST(108, 21, Normal.WATER_BLAST, new int[]{201, 0, 10}),
        EARTH_BLAST(108, 23, Normal.EARTH_BLAST, new int[]{201, 0, 11}),
        FIRE_BLAST(108, 25, Normal.FIRE_BLAST, new int[]{201, 0, 12}),
        WIND_WAVE(108, 27, Normal.WIND_WAVE, new int[]{201, 0, 13}),
        WATER_WAVE(108, 29, Normal.WATER_WAVE, new int[]{201, 0, 14}),
        EARTH_WAVE(108, 31, Normal.EARTH_WAVE, new int[]{201, 0, 15}),
        FIRE_WAVE(108, 33, Normal.FIRE_WAVE, new int[]{201, 0, 16}),
    
        SMOKE_RUSH(108, 63, Ancient.SMOKE_RUSH, new int[]{201, 0, 31}),
        SHADOW_RUSH(108, 65, Ancient.SHADOW_RUSH, new int[]{201, 0, 32}),
        BLOOD_RUSH(108, 67, Ancient.BLOOD_RUSH, new int[]{201, 0, 33}),
        ICE_RUSH(108, 69, Ancient.ICE_RUSH, new int[]{201, 0, 34}),
        SMOKE_BURST(108, 71, Ancient.SMOKE_BURST, new int[]{201, 0, 35}),
        SHADOW_BURST(108, 73, Ancient.SHADOW_BURST, new int[]{201, 0, 36}),
        BLOOD_BURST(108, 75, Ancient.BLOOD_BURST, new int[]{201, 0, 37}),
        ICE_BURST(108, 77, Ancient.ICE_BURST, new int[]{201, 0, 38}),
        SMOKE_BLITZ(108, 79, Ancient.SMOKE_BLITZ, new int[]{201, 0, 39}),
        SHADOW_BLITZ(108, 81, Ancient.SHADOW_BLITZ, new int[]{201, 0, 40}),
        BLOOD_BLITZ(108, 83, Ancient.BLOOD_BLITZ, new int[]{201, 0, 41}),
        ICE_BLITZ(108, 85, Ancient.ICE_BLITZ, new int[]{201, 0, 42}),
        SMOKE_BARRAGE(108, 87, Ancient.SMOKE_BARRAGE, new int[]{201, 0, 43}),
        SHADOW_BARRAGE(108, 89, Ancient.SHADOW_BARRAGE, new int[]{201, 0, 44}),
        BLOOD_BARRAGE(108, 91, Ancient.BLOOD_BARRAGE, new int[]{201, 0, 45}),
        ICE_BARRAGE(108, 93, Ancient.ICE_BARRAGE, new int[]{201, 0, 46}),;
    
        int configID;
        int configValue;
        Spell spell;
        int[] widgetIds;
    
        AutocastData(int configID, int configValue, Spell spell, int[] widgetIds) {
            this.configID = configID;
            this.configValue = configValue;
            this.spell = spell;
            this.widgetIds = widgetIds;
        }
    
        public int getConfigID() {
            return configID;
        }
    
        public int getConfigValue() {
            return configValue;
        }
    
        public Spell getSpell() {
            return spell;
        }
    
        public int[] getWidgetIds() {
            return widgetIds;
        }
    
    public class AutocastNode extends ScriptNode {
    
        public AutocastData autocastData;
    
        public AutocastNode(NMZScript s, AutocastData autocastData) {
            super(s);
            this.autocastData = autocastData;
        }
    
        @Override
        public int priority() {
            return 19;
        }
    
        @Override
        public boolean accept() {
            return getPlayerSettings().getConfig(autocastData.getConfigID()) != autocastData.getConfigValue();
        }
    
        @Override
        public int execute() {
            WidgetChild w = getWidgets().getWidgetChild(autocastData.getWidgetIds());
            if (w != null && w.isVisible()) {
                if (w.interact())
                    return 500;
            } else {
                w = getWidgets().getWidgetChild(593, 24);
                if (w != null && w.isVisible()) {
                    if (w.interact())
                        return 500;
                } else if (getTabs().open(Tab.COMBAT))
                    return 500;
            }
            return 200;
        }
    
    

    With the above code you can build something like this:

    public boolean setAutocast(AutocastData autocastData) {
            if (getPlayerSettings().getConfig(autocastData.getConfigID()) == autocastData.getConfigValue())
                return true;
    
            WidgetChild w = getWidgets().getWidgetChild(autocastData.getWidgetIds());
            if (w != null && w.isVisible()) {
                if (w.interact())
                    sleep(500);
            } else {
                w = getWidgets().getWidgetChild(593, 24);
                if (w != null && w.isVisible()) {
                    if (w.interact())
                        sleep(500);
                } else if (getTabs().open(Tab.COMBAT))
                    sleep(500);
            }
    
            return setAutocast(autocastData);
        }
        
        public boolean autocastOnEntity(Entity e, AutocastData d) {
            return setAutocast(d) && e.interact("Attack");
        }
    

    Holy shit hashtag, I didn't expect all this. Thank you so much. I'm saving all this now so I can continue on tomorrow :)

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.