TheScrub Posted August 24, 2013 Share Posted August 24, 2013 (edited) import org.osbot.script.Script; public class Spec_Attacks { Script script = Context.script; enum SpecWeapon { DragonDagger("Dragon dagger", 1215, 25), DragonScim("Dragon scimitar", 4587, 55), Whip("Abyssal whip", 4151, 50), Magic_Shortbow( "Magic shortbow", 861, 55), DragonDaggerP("Dragon dagger(p)", 1231, 25), DragonBattleaxe("Dragon battleaxe", 1377, 100); private final int id; private final int specpercent; private final String name; SpecWeapon(String name, int id, int specpercent) { this.name = name; this.id = id; this.specpercent = specpercent; } public String getName() { return name; } public int getId() { return id; } public int getSpecPercent() { return specpercent; } } public static int possibleSpecsForSpecBar(SpecWeapon Spec) { int remanningspec = Context.script.combat.getSpecialPercentage(); double d = remanningspec / Spec.getSpecPercent(); long l = Math.round(d); String s = String.valueOf(l); int specsforafullbar = Integer.parseInt(s); return specsforafullbar; } public static void SwitchWeaponTo(String name, Integer timeout) throws InterruptedException { String g[] = { "Wear", "Wield" }; long t = System.currentTimeMillis(); if (!Context.script.equipmentTab.isWieldingWeapon(name)) { for (String option : g) { Context.script.client.getInventory().interactWithName(name, option); } while (!Context.script.equipmentTab.isWieldingWeapon(name) && System.currentTimeMillis() - t < timeout) { Context.script.sleep(50); } } } } import org.osbot.script.Script; public class Context extends Script { public static Script script; } use in your script you will need to do this i'm using the context class as i got several class's that use api methods so it's easier. @Override public void onStart() { Context.script=this; } the first parameter is the name of the weapon or could have an Armour wouldn't matter and the 2nd parameter is for the dynamic sleep type thing in the spec attacks class i like 3000ms before it will retry if (Spec_Attacks.possibleSpecsForSpecBar(SpecWeapon.DragonDagger)>0){ Spec_Attacks.SwitchWeaponTo(SpecWeapon.DragonDagger.getName(), 3000); } Edited August 25, 2013 by TheScrub Link to comment Share on other sites More sharing options...
TheScrub Posted August 24, 2013 Author Share Posted August 24, 2013 Still needs more Weapons please post the infomation in this order "Name",Item ID,SpecPercent (the spec percent it uses) Link to comment Share on other sites More sharing options...
lolmanden Posted August 24, 2013 Share Posted August 24, 2013 Thank you very much. It will be so useful for me in the future. Noted down. Link to comment Share on other sites More sharing options...
Pseudo Posted August 24, 2013 Share Posted August 24, 2013 (edited) 3 weapons, wat. Beast calculation though. Because obviously specPercent / percentNeeded is too main stream. Edited August 24, 2013 by Pseudo 1 Link to comment Share on other sites More sharing options...
TheScrub Posted August 24, 2013 Author Share Posted August 24, 2013 3 weapons, wat. Beast calculation though. Because obviously specPercent / percentNeeded is too main stream. lol so true haha you know it! Link to comment Share on other sites More sharing options...
TheScrub Posted August 25, 2013 Author Share Posted August 25, 2013 upgrading this to a full working api class by the end of the week, Link to comment Share on other sites More sharing options...