Advertisement
Shanoga

Skunk Berry Aliases/Trigger

Jun 11th, 2018
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SKUNK BERRY ALIASES
  2. ---------------------------------------------------------------------------------------------------
  3. Name:
  4.   sberry
  5. ---------------------------------------------------------------------------------------------------
  6. Pattern (JavaScript):
  7.  
  8. // Initialize the current time so we know how much time is left
  9. // until the next time we can eat a berry
  10. var currentTime = new Date().getTime();
  11. currentTime = Math.floor(currentTime/1000);
  12. var timeRemaining = 300 - (currentTime - gwc.userdata.lastberry);
  13. var recentSkunk = 60 - (currentTime - gwc.userdata.lastberry);
  14.  
  15. // If it hasn't been at least a minute since the last skunk berry
  16. // then we don't do anything else
  17. if (recentSkunk >= 0) {
  18.   gwc.output.append("You ate a skunk berry too recently.");
  19.   gwc.output.append("You can eat another skunk berry in " + recentSkunk+ " seconds.");
  20.   return;
  21. }
  22.  
  23.  
  24. // Send the command to eat the berries, unless
  25. // we already have eaten two, then we stop ourselves
  26. if (gwc.userdata.skunks === undefined) gwc.userdata.skunks = 0;
  27. if (gwc.userdata.lastberry === undefined || (currentTime - gwc.userdata.lastberry) >= 300) gwc.userdata.lastberry = currentTime;
  28. if (gwc.userdata.skunks < 2) {
  29.   gwc.connection.send("eat skunk berries");
  30.   gwc.userdata.lastberry = 0;
  31. }
  32. else {
  33.   gwc.output.append("You've already ingested " + gwc.userdata.skunks + " skunk berries.");
  34.   gwc.output.append("You don't want to catch fire, do you?!");
  35.   gwc.output.append("You can eat another skunk berry in " + timeRemaining + " seconds.");
  36. }
  37.  
  38. ---------------------------------------------------------------------------------------------------
  39. ---------------------------------------------------------------------------------------------------
  40. Name:
  41.   sberries
  42. ---------------------------------------------------------------------------------------------------
  43. Pattern (JavaScript):
  44.  
  45. // We start with initializing the variable that contains the number
  46. // of skunk berries that we have eaten. This is a failsafe in case
  47. // we check before actually eating any skunks.
  48. if (gwc.userdata.skunks === undefined) gwc.userdata.skunks = 0;
  49.  
  50. // Initialize the current time so we know how much time is left
  51. // until the next time we can eat a berry
  52. var currentTime = new Date().getTime();
  53. currentTime = Math.floor(currentTime/1000);
  54. if (gwc.userdata.lastberry === undefined || (currentTime - gwc.userdata.lastberry) >= 300) gwc.userdata.lastberry = currentTime;
  55. var timeRemaining = 300 - (currentTime - gwc.userdata.lastberry);
  56.  
  57. // Print the number of berries eaten and how much time until
  58. // you can eat another one
  59. if (gwc.userdata.skunks == 1) {
  60.   gwc.output.append("You have ingested " + gwc.userdata.skunks + " handful of skunk berries.");
  61. } else {
  62.   gwc.output.append("You have ingested " + gwc.userdata.skunks + " handfuls of skunk berries.");
  63. }
  64. gwc.output.color("#671FC4");
  65. if (gwc.userdata.skunks == 0) {
  66.     gwc.output.append("You can eat another skunk berry now.");
  67. } else {
  68.   gwc.output.append("You can eat another skunk berry in " + timeRemaining + " seconds.");
  69. }
  70.  
  71. ---------------------------------------------------------------------------------------------------
  72. ---------------------------------------------------------------------------------------------------
  73. Name:
  74.   sbreset
  75. ---------------------------------------------------------------------------------------------------
  76. Pattern (JavaScript):
  77.  
  78. // Resets the counters for number of skunks ingested as well as
  79. // time since last eating a berry.
  80. //
  81. // DO NOT USE unless you are NOT under the effect of any skunk berry
  82. // healing as it will not track properly until all skunks berries
  83. // have left your system and you use this command again.
  84. //
  85. gwc.userdata.skunks = 0;
  86. gwc.userdata.lastberry = 300;
  87. gwc.output.append("Skunk Berries counters RESET");
  88.  
  89. ===================================================================================================
  90. ===================================================================================================
  91. ===================================================================================================
  92. ===================================================================================================
  93.  
  94. SKUNK BERRY TRIGGER:
  95. ---------------------------------------------------------------------------------------------------
  96. Pattern (Regex):
  97.   ^(?:> )?As you eat the purple berries\, a terrible bitter taste fills your mouth\.$
  98. ---------------------------------------------------------------------------------------------------
  99. Script (JavaScript):
  100.  
  101. // This trigger will keep a counter of the number of skunk berries
  102. // that you have eaten as well as the amount of time since
  103. // you last ate a handful of skunk berries. Feel free to mess
  104. // around with or eliminate the gwc.output.append lines if you
  105. // don't like them.
  106.  
  107. // We start with initializing the variable that contains the number
  108. // of skunk berries that we have eaten. This is really only needed
  109. // the first time that the script runs.
  110. if (gwc.userdata.skunks === undefined) gwc.userdata.skunks = 0;
  111.  
  112. // Capture the time that this script runs, when you ate the berries
  113. var currentTime = new Date().getTime();
  114. currentTime = Math.floor(currentTime/1000);
  115. gwc.userdata.lastberry = currentTime;
  116.  
  117. // Increment the number of berries that we've eaten
  118. gwc.userdata.skunks++;
  119.  
  120. // This function decrements the number of skunk berries and tells
  121. // you how many are in your system when it fades.
  122. function fade() {
  123.   gwc.userdata.skunks--;
  124.   gwc.output.append("You have ingested " + gwc.userdata.skunks + " skunk berries.");
  125. }
  126. setTimeout(fade,300001);
  127.  
  128.  
  129. // Lastly, display how many have been eaten in a purple colour
  130. if (gwc.userdata.skunks == 1) {
  131.   gwc.output.append("You have ingested " + gwc.userdata.skunks + " handful of skunk berries.");
  132. }
  133. else {
  134.   gwc.output.append("You have ingested " + gwc.userdata.skunks + " handfuls of skunk berries.");
  135. }
  136. gwc.output.color("#671FC4");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement