Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 15th, 2012  |  syntax: None  |  size: 1.62 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. import com.kbotpro.scriptsystem.interfaces.Looped;
  3. import com.kbotpro.scriptsystem.runnable.Script;
  4. import com.kbotpro.scriptsystem.wrappers.Item;
  5. /*
  6.  * To change this template, choose Tools | Templates
  7.  * and open the template in the editor.
  8.  */
  9.  
  10. /**
  11.  *
  12.  * @author bluefirecorp
  13.  */
  14. public class BonesBeGone extends Script {
  15.  
  16.     enum state {BANK, BURY};
  17.     boolean run = true;
  18.     final int BONE_ID = 532;
  19.     @Override
  20.     public void registerWorkers() {
  21.         createWorker(new Looped() {
  22.             public int loop() {
  23.                 State();
  24.                 return -1;
  25.             }
  26.         });
  27.     }
  28.     public void State() {
  29.         switch(currentState()) {
  30.             case BANK:
  31.                 bank();
  32.                 break;
  33.             case BURY:
  34.                 bury();
  35.                 break;
  36.         }
  37.         if(run) State();
  38.     }
  39.     void bank() {
  40.         bank.withdrawAll(BONE_ID);
  41.         if(!bank.contains("Big bones")) run = false;
  42.     }
  43.     void bury() {
  44.         for(Item g:inventory.getItems()) {
  45.             if(g.getName().contains("Big bones")) {
  46.                 g.doClick();
  47.             }
  48.         }
  49.     }
  50.     public state currentState() {
  51.         if(inventory.contains("Big bones")) return state.BURY;
  52.         return state.BANK;
  53.     }
  54.     @Override
  55.     public void stop() {
  56.         log("Thanks for using my script..");
  57.     }
  58.  
  59.     @Override
  60.     public void onStart() {
  61.         log("Starting now..hope it works");
  62.     }
  63.     public double getVersion() {
  64.         return 0.1;
  65.     }
  66.     @Override
  67.     public String getName() {
  68.         return "Bones be gone";
  69.     }
  70.  
  71. }