Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. $${
  2.  
  3. // Macro by Roflicide, made for slayermarth101
  4.  
  5. // The type of button you're pressing (either wooden_button or stone_button)
  6. &button = "wooden_button";
  7. // Change this (if necessary) to the name of your timer file
  8. &timer = "Timer.txt";
  9.  
  10. // Prompt variables
  11. &question = "Do you wish to continue?";
  12. &yes = "Yes! I want to continue!";
  13. &no = "No! Back to safety!";
  14.  
  15. // Macro variables
  16. &enabled = "&6&l[MACRO] &r&aEnabled.";
  17. &disabled = "&6&l[MACRO] &r&aDisabled.";
  18. &declined = "&6&l[MACRO] &r&aAction declined.";
  19. &accepted = "&6&l[MACRO] &r&aAction accepted. You have 5 seconds to press it.";
  20. &timedout = "&6&l[MACRO] &r&aAction timed out.";
  21. &nextscript = "&6&l[MACRO] &r&aStarting part 2. Button can be pressed again in 5s.";
  22.  
  23. IF(flag);
  24. UNSET(flag);
  25. LOG(%&disabled%);
  26. STOP;
  27. ELSE;
  28. SET(flag);
  29. LOG(%&enabled%);
  30. DO;
  31. // @timesup is set true when 5s has gone by
  32. UNSET(@timesup);
  33. // timeroff is set true when user presses the button twice
  34. UNSET(timeroff);
  35. // #hits ensures the button isn't overflowed with multiple requests
  36. UNSET(#hits);
  37.  
  38. // If you're looking at the button and click right-mouse
  39. IF((%HITID% = %&button%) && (RMOUSE));
  40. PROMPT(&capture,"$$[[%&yes%,%&no%]]",%&question%,true);
  41. // Case where user says yes
  42. IFMATCHES(%&capture%,"%&yes%");
  43. LOG(%&accepted%);
  44. // Start the timer in a separate task
  45. EXEC(%&timer%);
  46. DO;
  47. IF((%HITID% = %&button%) && (RMOUSE) && (#hits < 1));
  48. INC(#hits,1);
  49. LOG(%&nextscript%);
  50. SET(timeroff);
  51. // EXEC(YourScript.txt) / Your code here
  52. ENDIF;
  53. WHILE(!@timesup);
  54. IF(!timeroff && @timesup);
  55. LOG(%&timedout%);
  56. ENDIF;
  57. // Case where user says no or bad input
  58. ELSE;
  59. LOG(%&declined%);
  60. ENDIF;
  61. ENDIF;
  62. LOOP;
  63. ENDIF;
  64.  
  65. }$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement