SHARE
TWEET

basic autosipper

a guest Oct 1st, 2012 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE muclient>
  3. <!-- Saved on Monday, October 01, 2012, 8:13 PM -->
  4. <!-- MuClient version 4.73 -->
  5.  
  6. <!-- Plugin "autosipper" generated by Plugin Wizard -->
  7.  
  8. <muclient>
  9. <plugin
  10.   name="autosipper"
  11.   author="Tanris"
  12.   id="978f776dd727cdfa4b7a7fbb"
  13.   language="PerlScript"
  14.   purpose="Basic autosipper"
  15.   save_state="y"
  16.   date_written="2012-10-01 20:12:36"
  17.   requires="4.73"
  18.   version="1.0"
  19.   >
  20.  
  21. </plugin>
  22.  
  23.  
  24. <!--  Get our standard constants -->
  25.  
  26. <include name="constants.pl"/>
  27.  
  28. <!--  Triggers  -->
  29.  
  30. <triggers>
  31.   <trigger
  32.   enabled="y"
  33.   match="^You may drink another health or mana elixir or tonic\.$"
  34.   regexp="y"
  35.   script="recoveredSip"
  36.   sequence="100"
  37.  >
  38.   </trigger>
  39.   <trigger
  40.   enabled="y"
  41.   keep_evaluating="y"
  42.   match="^Health\:\s+(\d+)\s*\/\s*(\d+)\s+Mana\:\s*(\d+)\s*\/\s*(\d+)$"
  43.   regexp="y"
  44.   send_to="12"
  45.   sequence="100"
  46.  >
  47.   <send>$states{"maxHealth"} = %2;
  48. $states{"maxMana"} = %4;</send>
  49.   </trigger>
  50.   <trigger
  51.   enabled="y"
  52.   match="^Your mind feels stronger and more alert\.$"
  53.   name="sippedMana"
  54.   regexp="y"
  55.   script="sipped"
  56.   sequence="100"
  57.  >
  58.   </trigger>
  59.   <trigger
  60.   enabled="y"
  61.   keep_evaluating="y"
  62.   match="(\d+)h\, (\d+)m\, (\d+)e\, (\d+)w ([cexkdb]*)"
  63.   regexp="y"
  64.   send_to="12"
  65.   sequence="100"
  66.  >
  67.   <send>prompt(%1,%2);</send>
  68.   </trigger>
  69.   <trigger
  70.   enabled="y"
  71.   match="^The elixir flows down your throat without effect\.$"
  72.   name="sip_failure"
  73.   omit_from_output="y"
  74.   regexp="y"
  75.   script="sipFailure"
  76.   sequence="100"
  77.  >
  78.   </trigger>
  79.   <trigger
  80.   enabled="y"
  81.   match="^The elixir heals and soothes you\.$"
  82.   name="sippedHealth"
  83.   regexp="y"
  84.   script="sipped"
  85.   sequence="100"
  86.  >
  87.   </trigger>
  88. </triggers>
  89.  
  90. <!--  Aliases  -->
  91.  
  92. <aliases>
  93.   <alias
  94.   script="toggleSipPriority"
  95.   match="^hh$"
  96.   enabled="y"
  97.   regexp="y"
  98.   sequence="100"
  99.  >
  100.   </alias>
  101. </aliases>
  102.  
  103. <!--  Variables  -->
  104.  
  105. <variables>
  106.   <variable name="maxHealth">6365</variable>
  107.   <variable name="maxMana">8004</variable>
  108. </variables>
  109.  
  110. <!--  Script  -->
  111.  
  112.  
  113. <script>
  114. <![CDATA[
  115. #elixirs
  116. %states = (
  117. "sip" => 1,
  118. "currentHealth" => 0,
  119. "currentMana" => 0,
  120. "sipHealthLevel" => 0.8,
  121. "sipManaLevel" => 0.8,
  122. "sipPriority" => "health",
  123. "maxHealth" => 0,
  124. "maxMana" => 0
  125. );
  126.  
  127. sub prompt {
  128. my ($h, $m) = @_;
  129. $states{"currentHealth"} = $h;
  130. $states{"currentMana"} = $m;
  131. healthMana();
  132. }
  133.  
  134. sub sip {
  135. my $elixir = $_[0];
  136. if($states{"sip"} == 1) {
  137. $world->Send("sip $elixir");
  138. $states{"sip"} = 0.5;
  139. $world->AddTimer("sip_again",0,0,0.65,"",1,"sipAgain");
  140. }
  141. }
  142.  
  143. sub sipAgain {
  144. $world->DeleteTimer("sip_again");
  145. $states{"sip"} = 1;
  146. healthMana();
  147. }
  148.  
  149. sub sipped {
  150. $world->DeleteTimer("sip_again");
  151. $world->DeleteTimer("sip_failsafe");
  152. $world->AddTimer("sip_failsafe",0,0,8.0,"",1,"sipFailsafe");
  153. $states{"sip"} = 0;
  154. }
  155.  
  156. sub sipFailure {
  157. $states{"sip"} = 0;
  158. }
  159.  
  160. sub recoveredSip {
  161. $world->DeleteTimer("sip_failsafe");
  162. $states{"sip"} = 1;
  163. healthMana();
  164. }
  165.  
  166. sub sipFailsafe {
  167. $world->Note("fuck");
  168. recoveredSip();
  169. }
  170.  
  171. sub toggleSipPriority {
  172. if($states{"sipPriority"} eq "health") {
  173. $world->Note("Switched to mana sip priority.");
  174. $states{"sipPriority"} = "mana";
  175. }
  176. elsif($states{"sipPriority"} eq "mana") {
  177. $world->Note("Switched to health sip priority.");
  178. $states{"sipPriority"} = "health";
  179. }
  180. }
  181.                
  182.                 sub healthMana {
  183. my $health = $states{"currentHealth"};
  184. $mana = $states{"currentMana"};
  185.                 if($states{"sipPriority"} eq "health") {
  186.                 if($health <= ($states{"maxHealth"} * $states{"sipHealthLevel"})) {
  187.                                 sip("health");
  188. }
  189.         elsif($mana <= ($states{"maxMana"} * $states{"sipManaLevel"})) {
  190.         sip("mana");
  191.         }
  192.         }
  193.         elsif($states{"sipPriority"} eq "mana") {
  194.                 if($mana <= ($states{"maxMana"} * $states{"sipManaLevel"})) {
  195.                 sip("mana");
  196.         }
  197. elsif($health <= ($states{"maxHealth"} * $states{"sipHealthLevel"})) {         
  198.                 sip("health");
  199.         }
  200.         }
  201.         }
  202.                
  203. ]]>
  204. </script>
  205.  
  206.  
  207. </muclient>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top