Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Magic API

Featured Replies

After letting Muffins do a test run of my AIO Magic script; he found that "String Jewellery" would not click the spell. He shared his screen on Skype, and while the script was correctly set up it would spam

[INFO][Bot #1][07/29 11:29:07 AM]: Failed to cast spell [STRING_JEWELLERY -> [ITEM] [Gold amulet (u)]]
[INFO][Bot #1][07/29 11:29:08 AM]: Attempting to cast spell [STRING_JEWELLERY -> [ITEM] [Gold amulet (u)]]
[INFO][Bot #1][07/29 11:29:08 AM]: Failed to cast spell [STRING_JEWELLERY -> [ITEM] [Gold amulet (u)]]
[INFO][Bot #1][07/29 11:29:09 AM]: Attempting to cast spell [STRING_JEWELLERY -> [ITEM] [Gold amulet (u)]]
 
Other spells in the script work; though they are handled slightly differently. I process the spell depending on what type of spell it is, as follows;
                switch (targetType) {
                    case NONE:
                        return context.getMagic().castSpell(spell);
                    case ITEM:
                        if (context.getMagic().castSpell(spell)) {
                            return context.getMouse().click(new InventorySlotDestination(context.getBot(), context.getInventory().getSlot((Item) target)));
                        }
                        break;
                    case AUTOCAST_NPC:
                        return target.interact("Attack");
                    case NPC:
                        return context.getMagic().castSpellOnEntity(spell, (Entity) target);
                } 

Either I'm doing something completely retarded with the Magic class, or there's some inconsistency in the API (Or at least, that's my deduction).

  • 2 weeks later...

Have you tried clicking the spell then using InteractionEvent?

 

magic.castSpell(Spell);

inventory.getItem(String).interact("Cast");

From what I could understand from Muffins; using castSpell(Spells.LunarSpells.STRING_JEWELLERY) just wouldn't click the spell. Perhaps a wrong ID or something; other spells work fine.

Edited by FrostBug

From what I could understand from Muffins; using castSpell(Spells.LunarSpells.STRING_JEWELLERY) just wouldn't click the spell. Perhaps a wrong ID or something; other spells work fine.

 

Other Lunar spells is what I'm assuming. Well if you get an account with Lunar's on it please let me know. If he/she does not want to share that info with me, we can work some debugging stuff out.

 

-Alek

Other Lunar spells is what I'm assuming. Well if you get an account with Lunar's on it please let me know. If he/she does not want to share that info with me, we can work some debugging stuff out.

 

-Alek

 

 

From what I could understand from Muffins; using castSpell(Spells.LunarSpells.STRING_JEWELLERY) just wouldn't click the spell. Perhaps a wrong ID or something; other spells work fine.

 

I took it upon myself to make my own script (With help from @Khaleesi , with .isAnimating issues) And the code works as i got 82-94 mage with it in 2 days, Source is below.

 

public int onLoop() throws InterruptedException {

        checkForMessage();

        if(myPlayer().isAnimating())

            latestAnimation = System.currentTimeMillis();

        

        if (getInventory().contains("Astral rune") && getInventory().contains("Gold amulet (u)")) {

            // got resources

            if (!getBank().isOpen()) {

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

                    if (latestAnimation - System.currentTimeMillis() <= -1250) {

                        if (tabs.getOpen() != null && tabs.getOpen() == Tab.MAGIC) {

                            // magic tab is open

                            status = "Clicking Spell";

                            RS2Widget stringspell = getWidgets().get(218, 115);

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

                                if (stringspell.interact("Cast"))

                                    sleep(random(1000, 1500));

                            }

                        } else {

                            status = "Opening Magic Tab";

                            if (tabs.open(Tab.MAGIC))

                                sleep(random(100, 250));

                        }

                    }

                } else {

                    status = "Stringing Amulets";

                }

            } else {

                status = "Closing Bank";

                if (getBank().close())

                    sleep(random(250, 500));

            }

        } else {

            if (getBank().isOpen()) {

                if (getInventory().contains("Gold amulet")) {

                    status = "Depositing Amulets";

                    getBank().depositAllExcept("Astral rune");

                } else {

                    status = "Withdrawing Gold Amulets (u)";

                    if (getBank().contains("Gold amulet (u)")) {

                        if (getBank().withdraw("Gold amulet (u)", Bank.WITHDRAW_ALL))

                            sleep(random(250, 500));

                    } else {

                        // logout?

                    }

                }

            } else {

                getBank().open();

            }

        }

        return random(100, 250);

    }

Edited by Muffins

@Muffins We don't use static ids, they break very easily. Are you having an issue with just LunarSpells String spell or all Lunar spells? Would you be willing to provide an account with Lunar's activated?

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.