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.

Check runes for magic spell

Featured Replies

I'm trying to check if the bot has the required runes to cast a spell.

Right now I'm using 

getMagic().canCast(Spell spell)

However this clicks the magic tab every time it checks.

I figured there's code that checks for the requirements behind "cancast" somewhere but I can't find it in the API docs.

Any help?

 

tldr; How do I check if I have the required runes for a spell without using getMagic().canCast() as that open the magic tab every time.

I'm trying to check if the bot has the required runes to cast a spell.

Right now I'm using 

getMagic().canCast(Spell spell)

However this clicks the magic tab every time it checks.

I figured there's code that checks for the requirements behind "cancast" somewhere but I can't find it in the API docs.

Any help?

 

tldr; How do I check if I have the required runes for a spell without using getMagic().canCast() as that open the magic tab every time.

 

Check if your inventory contains the runes...

private boolean canTeleportToVarrock(){
  return getInventory().contains("Fire rune") && 
         getInventory().contains("Law rune") &&
         getInventory().getAmount("Air rune") >= 3; 
}

Try this;

private boolean isSupplied(){
                	 if(inventory.getAmount(YOUR RUNES HERE) > Required amount of runes for the spell -1) {
                         return true;
                	 
                 }else{
                         return false;
                 }
             }

then you could do something like -->

if (isSupplied()==true);
    //do shit here
  • Author

 

Check if your inventory contains the runes...

private boolean canTeleportToVarrock(){
  return getInventory().contains("Fire rune") && 
         getInventory().contains("Law rune") &&
         getInventory().getAmount("Air rune") >= 3; 
}

 

 

 

Try this;

private boolean isSupplied(){
                	 if(inventory.getAmount(YOUR RUNES HERE) > Required amount of runes for the spell -1) {
                         return true;
                	 
                 }else{
                         return false;
                 }
             }

then you could do something like -->

if (isSupplied()==true);
    //do shit here

 

Yeah well.. that was the obvious solution, I was hoping at first that the spells enum from the API would contain the information on what runes each spell requires

and would take such approach.

 

Since it didn't find the spells enum containing the required runes data I searched the API for another solution and found getMagic().canCast().

That one works but keeps opening my magic tab.

So since the code must be available somewhere in the API I'd like to figure out where so I can use it rather than having to write it all myself.

Edited by lisabe96

Yeah well.. that was the obvious solution, I was hoping at first that the spells enum from the API would contain the information on what runes each spell requires

and would take such approach.

 

Since it didn't find the spells enum containing the required runes data I searched the API for another solution and found getMagic().canCast().

That one works but keeps opening my magic tab.

So since the code must be available somewhere in the API I'd like to figure out where so I can use it rather than having to write it all myself.

 

It will most likely be based on the widgets in the spell tab. The spells will have different widget values when they are highlighted (can cast) and when they are not. Therefore using this method you need to change to the spell tab to check it. The only other alternative is to check your supplies in the inventory & equipment.

  • Author

It will most likely be based on the widgets in the spell tab. The spells will have different widget values when they are highlighted (can cast) and when they are not. Therefore using this method you need to change to the spell tab to check it. The only other alternative is to check your supplies in the inventory & equipment.

Alright thanks, guess I'll have to write it myself after all then VSuShjF.gif

Alright thanks, guess I'll have to write it myself after all then VSuShjF.gif

 

ya man, I use to have a enum of the spells and the runes needed

Create an account or sign in to comment

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.