import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.rs2.model.NPC; import org.osbot.script.rs2.ui.Prayer; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.net.URL; import java.util.LinkedList; /** * User: Cory * Date: 20/06/13 * Time: 22:06 */ @ScriptManifest(name = "JadPrayerSwitch", author = "Cory", version = 1, info="Switches Prayer At Jad") public class JadPrayerSwitch extends Script { private int lastJadAnimation = -1; @Override public int onLoop() throws InterruptedException { NPC npc = closestNPCForName("Jad Name"); if(npc.getAnimation() != lastJadAnimation) { lastJadAnimation = npc.getAnimation(); if(lastJadAnimation != -1) animationChange(); } return 0; } public void animationChange() throws InterruptedException { switch(lastJadAnimation) { case 0: //jad range anim if(prayerTab.isPrayerOn(Prayer.PROTECT_FROM_MISSILES)) return; prayerTab.setPrayer(Prayer.PROTECT_FROM_MISSILES, true); break; case 1: //jad mage anim if(prayerTab.isPrayerOn(Prayer.PROTECT_FROM_MAGIC)) return; prayerTab.setPrayer(Prayer.PROTECT_FROM_MAGIC, true); break; } } }