Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import org.tribot.api2007.Equipment;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.types.RSInterface;
- import org.tribot.api2007.GameTab;
- import static org.tribot.api2007.GameTab.TABS.MAGIC;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Login;
- import org.tribot.api2007.Magic;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- /**
- *@author Christian
- *Date: 8/2/15
- */
- @ScriptManifest(authors = {"Rag.rs"}, name = "TestScripts", category = "test")
- public class Test extends Script {
- // Creating variable to hold current state
- private enum STATE { CLICK_ENCHANT_INTERFACE, CLICK_BOLT_ENCHANT, OPEN_MAGIC_TAB, LOGOUT_OF_ACCOUNT };
- STATE state = null;
- private boolean status = true;
- /**
- * @param args the command line arguments
- */
- public void run() {
- //While loop to run the script
- while(status) {
- // Updating/checking state
- CheckState();
- switch(state) {
- case OPEN_MAGIC_TAB:
- GameTab.open(MAGIC);
- break;
- case CLICK_BOLT_ENCHANT:
- RSInterface.click(<Enchant Bolts>);
- break;
- case CLICK_ENCHANT_INTERFACE:
- Magic.selectSpell("Enchant Crossbow Bolt");
- break;
- case LOGOUT_OF_ACCOUNT:
- Login.logout();
- break;
- }
- sleep(100, 300); //Use a random number as an anti-ban measure.
- }
- }
- public STATE CheckState() {
- // Checking if player has correct items in inventory
- if(Inventory.getCount("Diamond bolts") >= 10 && Inventory.getCount("Cosmic rune") >= 1 && Inventory.getCount("Law rune") > 2 && Equipment.isEquipped(1385)) {
- // Checking to see if magic tab is open
- if(MAGIC.isOpen()) {
- //checking to see if enchant bolt interface is open
- if(Interfaces.isInterfaceValid(80)) {
- return state.CLICK_BOLT_ENCHANT;
- }
- // if enchant bolt interface is not open then state will be to open it
- } else {
- return state.CLICK_ENCHANT_INTERFACE;
- }
- }
- return state.LOGOUT_OF_ACCOUNT;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement