Sorry, my site went down for quite a while, and now I'm having a rather hard time getting my old host name back. This is also an old version, I don't have access to the new version while I'm at work.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, May 17, 2007, 9:30 AM -->
<!-- MuClient version 4.05 -->
<!-- Plugin "moonbot" generated by Plugin Wizard -->
<muclient>
<plugin
name="moonbot"
author="Balaam"
id="2349913955dd86427355ad5e"
language="Lua"
purpose="moon phase tracker"
save_state="y"
date_written="2007-05-17 09:28:14"
requires="4.05"
version="1.0"
>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
group="moons"
match="--> TICK <--*"
name="moontick"
send_to="12"
sequence="100"
>
<send>for i,v in pairs(moons) do
if moons[i].now ~= nil then
moons[i].now = (v.now+1) % v.cycle
end
end
if countdown == nil then
countdown, countdowndur = nextunion()
else
countdown = countdown - 1
if countdown < 1 then
countdown, countdowndur = nextunion()
ColourNote("lime", "black", "Three moons are up for "..countdowndur.." ticks!" )
end
end</send>
</trigger>
<trigger
enabled="y"
group="moons"
match="^You notice the (black|grey|white) moon fall in the (ea|we)st.$"
name="moonsetting"
regexp="y"
script="moonsetting"
sequence="100"
>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
<alias
match="moon:plot"
enabled="y"
group="moontracker"
send_to="12"
sequence="100"
>
<send>if (moons.black.now == nil ) or
(moons.grey.now == nil ) or
(moons.white.now == nil ) then
Note( "The cycle of one or more moons is unknown.")
else
plotdata={white={},grey={},black={}}
for i = 0,69 do
for m,t in pairs(plotdata) do
table.insert(t, ((moons[m].now + i ) % moons[m].cycle) < moons[m].up)
end
end
for i,t in pairs(plotdata) do
local temp = "["
for _,v in ipairs(t) do
if v then
temp = temp.."O"
else
temp = temp.."."
end
end
print(temp.."] "..i)
end
end</send>
</alias>
<alias
match="moon:union"
enabled="y"
group="moontracker"
send_to="12"
sequence="100"
>
<send>print(nextunion())</send>
</alias>
<alias
match="moon:print"
enabled="y"
group="moontracker"
send_to="12"
sequence="100"
>
<send>Note( "Black="..(moons.black.now or "nil")..
" Grey="..(moons.grey.now or "nil")..
" White="..(moons.white.now or "nil") )
</send>
</alias>
<alias
match="moon:tick"
enabled="y"
group="moontracker"
send_to="12"
sequence="100"
>
<send>tickgag = not tickgag
SetVariable( "tickgag", tostring(gagmoon) )
local temp = "n"
if tickgag then temp = "y" end
SetTriggerOption( "moontick", "omit_from_output", temp )
ColourNote( "white", "black", "Tick gagging set to ",
"lime", "black", tostring(tickgag) )
</send>
</alias>
<alias
match="^moon(bot)?:help"
send_to="12"
regexp="y"
enabled="y"
>
<send> OnPluginInstall()
ColourNote( "white", "black", "moonbot:help ",
"lime", "black", ": You just typed it. Look what happened." )
ColourNote( "white", "black", "moon:plot ",
"lime", "black", ": show the moon cycle" )
ColourNote( "white", "black", "moon:union ",
"lime", "black", ": show time until next union of 3 moons" )
ColourNote( "white", "black", "moon:tick ",
"lime", "black", ": turn tick gagging on or off" )
</send>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
tickgag = GetVariable( "tickgag" )
if tickgag == nil then
tickgag = false
else
tickgag = gagmoon == "true"
SetTriggerOption( "moontick", "omit_from_output", "y" )
end
moons={black={now=nil,cycle=50,up=13},
grey={now=nil,cycle=30,up=8},
white={now=nil,cycle=65,up=17}}
function moonsetting( tname, tstr, wildcards )
local moon = wildcards[1]
moons[moon].now = moons[moon].up - 2
end-- moonsetting
function printmoons()
Note( "Black="..(moons.black.now or "nil")..
" Grey="..(moons.grey.now or "nil")..
" White="..(moons.white.now or "nil") )
end
function nextunion()
if (moons.black.now == nil ) or
(moons.grey.now == nil ) or
(moons.white.now == nil ) then
return nil,nil
else
local offset = 0
while ((moons.white.now + offset) % moons.white.cycle >= moons.white.up) or
((moons.black.now + offset) % moons.black.cycle >= moons.black.up) or
((moons.grey.now + offset) % moons.grey.cycle >= moons.grey.up) do
offset = offset + 1
end
local duration = 1
while ((moons.white.now + offset + duration) % moons.white.cycle < moons.white.up) and
((moons.black.now + offset + duration) % moons.black.cycle < moons.black.up) and
((moons.grey.now + offset + duration) % moons.grey.cycle < moons.grey.up) do
duration = duration + 1
end
return offset,duration
end
end -- nextunion()
function OnPluginInstall()
ColourNote( "white", "black", "Plugin ",
"lime", "black", GetPluginName(),
"white", "black", " Version:",
"lime", "black", tostring(GetPluginInfo (GetPluginID(), 19)),
"white", "black", " installed." )
end -- OnPluginInstall
function OnPluginClose()
ColourNote( "white", "black", "Plugin ",
"lime", "black", GetPluginName(),
"white", "black", " closed." )
end -- OnPluginClose
]]>
</script>
</muclient>
|