Advertisement
Guest User

Clicking

a guest
Oct 3rd, 2015
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. package scripts.Decanter;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api.Timing;
  5. import org.tribot.api.types.generic.Condition;
  6. import org.tribot.api.util.ABCUtil;
  7. import org.tribot.api2007.Game;
  8. import org.tribot.api2007.Inventory;
  9. import org.tribot.api2007.types.RSItem;
  10.  
  11. public class Clicking{
  12.  
  13. static ABCUtil abc = new ABCUtil();
  14.  
  15. public static boolean clickUsePotion(String potionName) {
  16. RSItem[] potions = Decanter.getPotionsWithout(potionName, 1,false);
  17.  
  18. if (potions.length > 0) {
  19. RSItem p = potions[0];
  20.  
  21. if (p != null) {
  22. String itemAction = "Use";
  23.  
  24. if (!Game.isUptext(itemAction)) {
  25. p.click(itemAction);
  26. return Timing.waitCondition(new Condition()
  27. {
  28. @Override
  29. public boolean active()
  30. {
  31. General.sleep(100,200);
  32. return Game.isUptext("Use");
  33. }
  34. }, General.random(3000, 4000));
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40.  
  41. public static boolean usePotionOnVial() {
  42. RSItem[] vials = Inventory.find("Vial");
  43.  
  44. if (vials.length > 0) {
  45. RSItem v = vials[0];
  46.  
  47. if (v != null) {
  48. String itemAction = "Use";
  49.  
  50. if (Game.isUptext(itemAction)) {
  51. v.click(itemAction);
  52. General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next() );
  53. return Timing.waitCondition(new Condition()
  54. {
  55. @Override
  56. public boolean active()
  57. {
  58. General.sleep(100,200);
  59. return !Game.isUptext("Use");
  60.  
  61. }
  62. }, General.random(3000, 4000));
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement