roguehippo Posted August 29, 2017 Share Posted August 29, 2017 private void castReanimateSpell(MagicSpell spellToCast) throws InterruptedException { ArrayList<RS2Widget> allWidgets= new ArrayList<RS2Widget>(); allWidgets.addAll(widgets.getAll()); String spellNameFixer = spellToCast.toString(); //the string starts out all caps. we want only first letter of each word to be caps. spellNameFixer = spellNameFixer.toLowerCase(); //now we replace the underscore with a space spellNameFixer = spellNameFixer.replace('_', ' '); String[] storageArray = spellNameFixer.split(" "); String finalName = ""; //build the final string out of the string array. while capatalizing the first // letter of each word for(String s : storageArray) { char temp = s.charAt(0); temp = Character.toUpperCase(temp); s = Character.toString(temp) + s.substring(1); finalName = finalName + s + " "; } //remove the last white space. //for some reason all the widget names start with this sequence. String temp = finalName.trim(); finalName = "<col=00ff00>" + temp; //log("looking for spell " + finalName); if(magic.canCast(spellToCast)) { //log("we can cast the spell"); if(getTabs().getOpen() != Tab.MAGIC) { log("opening magic tab"); getTabs().open(Tab.MAGIC); sleep(random(400,600)); } ArrayList<RS2Widget> spellWidgetList = new ArrayList<RS2Widget>(); spellWidgetList.addAll( widgets.getAll()); for(RS2Widget rw : allWidgets) { if(rw != null && rw.isVisible() && rw.getSpellName().length() > 1) { if(rw.getSpellName().equals(finalName)) { //log("selecting spell: " + finalName); rw.interact("Reanimate"); sleep(random(50,80)); break; } sleep(random(10,20)); } } } } hey guys, i noticed that it wasn't really possible to use the current cast spell function with the reanimation spells in the arceuus spell book so i made a function that would select the spell. please let me know if this helps, if my code is disgusting , or if its already been done and i just haven't found it yet. thanks! Quote Link to comment Share on other sites More sharing options...