Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. package test;
  2.  
  3. import org.tribot.api2007.Equipment;
  4. import org.tribot.api2007.Interfaces;
  5. import org.tribot.api2007.types.RSInterface;
  6. import org.tribot.api2007.GameTab;
  7. import static org.tribot.api2007.GameTab.TABS.MAGIC;
  8. import org.tribot.api2007.Inventory;
  9. import org.tribot.api2007.Login;
  10. import org.tribot.api2007.Magic;
  11. import org.tribot.script.Script;
  12. import org.tribot.script.ScriptManifest;
  13.  
  14. /**
  15. *@author Christian
  16. *Date: 8/2/15
  17. */
  18.  
  19. @ScriptManifest(authors = {"Rag.rs"}, name = "TestScripts", category = "test")
  20.  
  21. public class Test extends Script {
  22. // Creating variable to hold current state
  23. private enum STATE { CLICK_ENCHANT_INTERFACE, CLICK_BOLT_ENCHANT, OPEN_MAGIC_TAB, LOGOUT_OF_ACCOUNT };
  24. STATE state = null;
  25. private boolean status = true;
  26. /**
  27. * @param args the command line arguments
  28. */
  29. public void run() {
  30.  
  31. //While loop to run the script
  32. while(status) {
  33. // Updating/checking state
  34. CheckState();
  35. switch(state) {
  36. case OPEN_MAGIC_TAB:
  37. GameTab.open(MAGIC);
  38. break;
  39. case CLICK_BOLT_ENCHANT:
  40. RSInterface.click(<Enchant Bolts>);
  41. break;
  42. case CLICK_ENCHANT_INTERFACE:
  43. Magic.selectSpell("Enchant Crossbow Bolt");
  44. break;
  45. case LOGOUT_OF_ACCOUNT:
  46. Login.logout();
  47. break;
  48. }
  49. sleep(100, 300); //Use a random number as an anti-ban measure.
  50. }
  51. }
  52. public STATE CheckState() {
  53. // Checking if player has correct items in inventory
  54. if(Inventory.getCount("Diamond bolts") >= 10 && Inventory.getCount("Cosmic rune") >= 1 && Inventory.getCount("Law rune") > 2 && Equipment.isEquipped(1385)) {
  55. // Checking to see if magic tab is open
  56. if(MAGIC.isOpen()) {
  57. //checking to see if enchant bolt interface is open
  58. if(Interfaces.isInterfaceValid(80)) {
  59. return state.CLICK_BOLT_ENCHANT;
  60. }
  61. // if enchant bolt interface is not open then state will be to open it
  62. } else {
  63. return state.CLICK_ENCHANT_INTERFACE;
  64. }
  65. }
  66. return state.LOGOUT_OF_ACCOUNT;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement