lisabe96 Posted January 15, 2016 Share Posted January 15, 2016 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. Quote Link to comment Share on other sites More sharing options...
Explv Posted January 15, 2016 Share Posted January 15, 2016 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; } Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted January 15, 2016 Share Posted January 15, 2016 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 Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 15, 2016 Author Share Posted January 15, 2016 (edited) 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 January 15, 2016 by lisabe96 Quote Link to comment Share on other sites More sharing options...
Explv Posted January 15, 2016 Share Posted January 15, 2016 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. Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 15, 2016 Author Share Posted January 15, 2016 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 Quote Link to comment Share on other sites More sharing options...
Joseph Posted January 15, 2016 Share Posted January 15, 2016 Alright thanks, guess I'll have to write it myself after all then ya man, I use to have a enum of the spells and the runes needed Quote Link to comment Share on other sites More sharing options...