Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="iso-8859-1"?>
- <!DOCTYPE muclient>
- <!-- Saved on Åroda, listopad 06, 2013, 11:02 -->
- <!-- MuClient version 4.00 -->
- <!-- Plugin "SenseLife" generated by Plugin Wizard -->
- <muclient>
- <plugin
- name="SenseLife"
- author="Divlia"
- id="9d6660dc110f23607a27a88b"
- language="Lua"
- purpose="Notifies about distant area repops"
- date_written="2013-11-06 11:01:25"
- requires="4.00"
- version="1.0"
- >
- <description trim="y">
- <![CDATA[
- Idea: IvanHoe
- List of timers idea: Cooler
- Implementation: Divlia
- ]]>
- </description>
- </plugin>
- <!-- Get our standard constants -->
- <include name="constants.lua"/>
- <triggers>
- <trigger match="You sense that life will return to this area within the next minute."
- script="timer60"
- enabled="y"
- regexp="n"
- omit_from_output="n"
- sequence="100">
- </trigger>
- <trigger match="You sense that life will return to this area within the next 30 seconds."
- script="timer30"
- enabled="y"
- regexp="n"
- omit_from_output="n"
- sequence="100">
- </trigger>
- <trigger match="You sense that life will return to this area in roughly *-* minutes."
- script="timerx"
- enabled="y"
- regexp="n"
- omit_from_output="n"
- sequence="100">
- </trigger>
- </triggers>
- <aliases>
- <alias
- script="ListTimers"
- match="timers"
- keep_evaluating="y"
- enabled="y"
- regexp="n"
- send_to="12"
- sequence="100"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- require "gmcphelper"
- timersT = {}
- function ListTimers()
- if #timersT > 0 then
- ColourNote("darkorange", "", "Active timers:")
- ColourNote("darkorange", "", "")
- for j,x in ipairs (timersT) do
- sec = GetTimerInfo(x, 13)
- if sec == nil then
- sec = "??:??"
- end
- 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))))))
- end
- ColourNote("darkorange", "", "")
- else
- ColourNote("darkorange", "", "No timers set so far")
- ColourNote("darkorange", "", "")
- end
- end
- function AddTimerForArea(min, sec)
- if currentRoom ~= nil then
- code = AddTimer(currentRoom.zone, 0, tonumber(min), tonumber(sec), "", timer_flag.Enabled + timer_flag.OneShot, "timerfunc")
- if code == 0 then
- ColourNote("darkorange", "", "Timer set for "..currentRoom.zone)
- table.insert(timersT, currentRoom.zone)
- elseif code == 30018 then
- ColourNote("darkorange", "", "You already have a timer for "..currentRoom.zone)
- elseif code == 30022 then
- ColourNote("darkorange", "", "We have error here, wrong time passed.")
- elseif code == 30009 then
- ColourNote("darkorange", "", "We have error here, wrong name of the script.")
- elseif code == 30009 then
- ColourNote("darkorange", "", "We have error here, wrong name of the object.")
- else
- ColourNote("darkorange", "", "We have unknown error here.")
- end
- end
- end
- function timerx(name, line, wildcards)
- AddTimerForArea(wildcards[2], 0)
- end
- function timer60()
- AddTimerForArea(1, 0)
- end
- function timer30()
- AddTimerForArea(0, 30)
- end
- function timerfunc(name)
- if (currentRoom ~= nil) and (currentRoom.zone ~= name) then
- SendNoEcho("tracker Distant area repopped: @R"..name.."@Y")
- end
- for j,x in ipairs (timersT) do
- if x == name then
- table.remove(timersT, j)
- return
- end
- end
- end
- function OnPluginBroadcast (msg, id, name, text)
- if (id == '3e7dedbe37e44942dd46d264') then
- if (text == "room.info") then
- res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264", "gmcpval", "room.info")
- luastmt = "room = " .. gmcparg
- assert (loadstring (luastmt or "")) ()
- if (room ~= nil) then
- currentRoom = room
- else
- currentRoom = nil
- end
- end
- end
- end
- function OnPluginInstall ()
- if IsConnected() then
- Send_GMCP_Packet("request area")
- end
- end
- ]]>
- </script>
- </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement