Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ ON_IDLE

ON_IDLE

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Logan   (1 post)  Bio
Date Tue 27 Aug 2002 12:35 AM (UTC)
Message
Could there be a trigger option (Or some setting) that you can have a certain command execute if you haven't typed any commands for X seconds. Where X is also settable. Example:

I create a new trigger. In the window, I select "On Idle: __ hours __ minutes __ seconds." I fill in 1 hours, 30 minutes, and 0 seconds. For the commands executed, I fill in "peer".

I'm mudding along, and it just so happens that I left for dinner, and 1 hour and 30 minutes have ellapsed. Mushclient automatically sends 'peer' to the game.


Thats it =0
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 28 Aug 2002 10:57 PM (UTC)
Message
I did a plugin to achieve that. Just copy the text below the line, paste into NotePad or similar, save as Idle_Message.xml, put into your plugins directory, and then use the plugin dialog to add it.

Alternatively, download the file from:

http://www.mushclient.com/plugins/idle_message.xml

To do your example, you would type:


OnIdle 1 30 0 peer





<?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>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #2 on Wed 28 Aug 2002 11:16 PM (UTC)
Message
How does the Sub OnPluginCommand get called?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 29 Aug 2002 06:04 AM (UTC)

Amended on Thu 29 Aug 2002 06:05 AM (UTC) by Nick Gammon

Message
See Plugin callbacks

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,295 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.