Advertisement
amandajean1

Sense Life Timer

Apr 20th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE muclient>
  3. <!-- Saved on œroda, listopad 06, 2013, 11:02 -->
  4. <!-- MuClient version 4.00 -->
  5.  
  6. <!-- Plugin "SenseLife" generated by Plugin Wizard -->
  7.  
  8. <muclient>
  9. <plugin
  10. name="SenseLife"
  11. author="Divlia"
  12. id="9d6660dc110f23607a27a88b"
  13. language="Lua"
  14. purpose="Notifies about distant area repops"
  15. date_written="2013-11-06 11:01:25"
  16. requires="4.00"
  17. version="1.0"
  18. >
  19. <description trim="y">
  20. <![CDATA[
  21. Idea: IvanHoe
  22. List of timers idea: Cooler
  23. Implementation: Divlia
  24. ]]>
  25. </description>
  26. </plugin>
  27.  
  28.  
  29. <!-- Get our standard constants -->
  30.  
  31. <include name="constants.lua"/>
  32.  
  33. <triggers>
  34. <trigger match="You sense that life will return to this area within the next minute."
  35. script="timer60"
  36. enabled="y"
  37. regexp="n"
  38. omit_from_output="n"
  39. sequence="100">
  40. </trigger>
  41. <trigger match="You sense that life will return to this area within the next 30 seconds."
  42. script="timer30"
  43. enabled="y"
  44. regexp="n"
  45. omit_from_output="n"
  46. sequence="100">
  47. </trigger>
  48. <trigger match="You sense that life will return to this area in roughly *-* minutes."
  49. script="timerx"
  50. enabled="y"
  51. regexp="n"
  52. omit_from_output="n"
  53. sequence="100">
  54. </trigger>
  55. </triggers>
  56.  
  57. <aliases>
  58. <alias
  59. script="ListTimers"
  60. match="timers"
  61. keep_evaluating="y"
  62. enabled="y"
  63. regexp="n"
  64. send_to="12"
  65. sequence="100"
  66. >
  67. </alias>
  68. </aliases>
  69.  
  70. <script>
  71. <![CDATA[
  72.  
  73. require "gmcphelper"
  74.  
  75. timersT = {}
  76.  
  77. function ListTimers()
  78. if #timersT > 0 then
  79. ColourNote("darkorange", "", "Active timers:")
  80. ColourNote("darkorange", "", "")
  81. for j,x in ipairs (timersT) do
  82. sec = GetTimerInfo(x, 13)
  83. if sec == nil then
  84. sec = "??:??"
  85. end
  86. ColourNote("darkorange", "", string.format("%-30s %s", x, string.format("%.2d:%.2d", math.floor(math.abs(sec/60)), sec - 60*(math.floor(math.abs(sec/60))))))
  87. end
  88. ColourNote("darkorange", "", "")
  89. else
  90. ColourNote("darkorange", "", "No timers set so far")
  91. ColourNote("darkorange", "", "")
  92. end
  93. end
  94.  
  95. function AddTimerForArea(min, sec)
  96. if currentRoom ~= nil then
  97. code = AddTimer(currentRoom.zone, 0, tonumber(min), tonumber(sec), "", timer_flag.Enabled + timer_flag.OneShot, "timerfunc")
  98. if code == 0 then
  99. ColourNote("darkorange", "", "Timer set for "..currentRoom.zone)
  100. table.insert(timersT, currentRoom.zone)
  101. elseif code == 30018 then
  102. ColourNote("darkorange", "", "You already have a timer for "..currentRoom.zone)
  103. elseif code == 30022 then
  104. ColourNote("darkorange", "", "We have error here, wrong time passed.")
  105. elseif code == 30009 then
  106. ColourNote("darkorange", "", "We have error here, wrong name of the script.")
  107. elseif code == 30009 then
  108. ColourNote("darkorange", "", "We have error here, wrong name of the object.")
  109. else
  110. ColourNote("darkorange", "", "We have unknown error here.")
  111. end
  112. end
  113. end
  114.  
  115. function timerx(name, line, wildcards)
  116. AddTimerForArea(wildcards[2], 0)
  117. end
  118.  
  119. function timer60()
  120. AddTimerForArea(1, 0)
  121. end
  122.  
  123. function timer30()
  124. AddTimerForArea(0, 30)
  125. end
  126.  
  127. function timerfunc(name)
  128. if (currentRoom ~= nil) and (currentRoom.zone ~= name) then
  129. SendNoEcho("tracker Distant area repopped: @R"..name.."@Y")
  130. end
  131. for j,x in ipairs (timersT) do
  132. if x == name then
  133. table.remove(timersT, j)
  134. return
  135. end
  136. end
  137. end
  138.  
  139. function OnPluginBroadcast (msg, id, name, text)
  140. if (id == '3e7dedbe37e44942dd46d264') then
  141. if (text == "room.info") then
  142. res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264", "gmcpval", "room.info")
  143. luastmt = "room = " .. gmcparg
  144. assert (loadstring (luastmt or "")) ()
  145. if (room ~= nil) then
  146. currentRoom = room
  147. else
  148. currentRoom = nil
  149. end
  150. end
  151. end
  152. end
  153.  
  154. function OnPluginInstall ()
  155. if IsConnected() then
  156. Send_GMCP_Packet("request area")
  157. end
  158. end
  159.  
  160. ]]>
  161. </script>
  162. </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement