<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, August 29, 2002, 8:49 AM -->
<!-- MuClient version 3.26 -->

<!-- Plugin "Idle_Message" generated by Plugin Wizard -->

<!--
To customise the script so that the message is shown repeatedly (eg. every 10 seconds), then you need to remove the "one-shot" flag.

ie.

Change the line below:

world.addtimer "idletimer", hours, minutes, seconds, what, 1029, ""

to

world.addtimer "idletimer", hours, minutes, seconds, what, 1025, ""


(that is, change 1029 to 1025).

-->

<muclient>
<plugin
   name="Idle_Message"
   author="Nick Gammon"
   id="4ea415972d64ffe602170f89"
   language="VBscript"
   purpose="Sends a message when you are idle"
   date_written="2002-08-29 08:44:25"
   requires="3.25"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Sends a message to the MUD (once) after you are idle for a nominated amount of time.

You can specify the time as hours, minutes, or seconds, like this:

OnIdle 30 say Gone AFK      <-- after 30 seconds
OnIdle 1 20 say Gone AFK    <-- after 1 minute 20 seconds
OnIdle 1 10 20 say Gone AFK    <-- after 1 hour, 10 minutes, 20 seconds

OnIdle   <-- deletes the idle message

Idle_Message:help  <-- this help
]]>
</description>

</plugin>

<!--  Aliases  -->

<aliases>
  <alias
   script="OnIdleTime"
   match="^OnIdle( [[:digit:]]{1,2})?( [[:digit:]]{1,2})?( [[:digit:]]{1,2}) (.*?)$"
   enabled="y"
   regexp="y"
  >
  </alias>
  <alias
   script="DeleteIdleMessage"
   match="OnIdle"
   enabled="y"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
Function OnPluginCommand (sText)
  world.resettimer "idletimer"  ' not idle right now
  OnPluginCommand = vbTrue  ' process it
End Function

sub DeleteIdleMessage (name, output, wildcards)
  if world.deletetimer ("idletimer") = 0 then
     world.note "Idle message deleted"
  else
     world.note "No idle message was set up"
  end if
end sub

'
'  sub to add an "idle" timer
'   the timer is reset when the player types something
'
sub OnIdleTime (name, output, wildcards)
dim hours, minutes, seconds, what

  hours = trim (wildcards (1))
  minutes = trim (wildcards (2))
  seconds = trim (wildcards (3))
  what = wildcards (4)

  if hours = "" then hours = 0
  if minutes = "" then minutes = 0
  if seconds = "" then seconds = 0

if hours > 23 then
  world.note "Idle hours cannot exceed 23, you entered " & hours
  exit sub
end if

if minutes > 59 then
  world.note "Idle minutes cannot exceed 59, you entered " & minutes
  exit sub
end if

if seconds > 59 then
  world.note "Idle seconds cannot exceed 59, you entered " & seconds
  exit sub
end if

if (hours = 0) and (minutes = 0) and (seconds = 0) then
  world.note "Idle time cannot be zero"
  exit sub
end if

' flags:
'    1 = enabled
'    4 = one-shot
' 1024 = replace existing

world.addtimer "idletimer", hours, minutes, seconds, what, 1029, ""

world.note "When we are idle for " _
 & hours & "h " _
 & minutes & "m " _
 & seconds & "s " _
 & "we will send '" & what & "'"

end sub

]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="Idle_Message:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
  World.Note World.GetPluginInfo (World.GetPluginID, 3)
End Sub
]]>
</script> 

</muclient>
