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 ➜ Plugins ➜ Idle monitor/reporter

Idle monitor/reporter

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


Posted by Vaejor   (120 posts)  Bio
Date Wed 25 Sep 2002 02:13 AM (UTC)

Amended on Wed 25 Sep 2002 02:18 AM (UTC) by Vaejor

Message
Here's a plugin I threw together.

As is, it should be safe for everyone.

Some MUDs may not like anti-idle triggers/timers(eg. making it force a command to be sent), so changing anything is at your own discretion and risk.

----------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="idle_monitor"
   author="Vaejor"
   id="ebcc5214dc5b657cd72984e4"
   language="VBscript"
   purpose="Monitor idleness, report output after specified time"
   save_state="n"
   date_written="2002-09-18 10:08:00"
   requires="3.260000"
   version="1.0"
   >
</plugin>

<!-- Scripts -->

<script>
<![CDATA[

  Const intIdleWarningStartMinutes = 30
'strMessageText: %m shows minutes, %s shows seconds
  Const strMessageText = "*-*-*-*-*- You have been idle for %m:%s -*-*-*-*-*"
  Const strMessageForeColor = "red"
  Const strMessageBackColor = "black"

  Const intIdleWarningRepeatSeconds = 30

  Dim datLastCmdSent

  Function OnPluginSend(ByVal strData)
    IdleTimerReset
    OnPluginSend = vbTrue
  End Function

  Sub OnPluginInstall
    IdleTimerReset
  End Sub

  Sub OnPluginConnect
    IdleTimerReset
  End Sub

  Sub IdleTimerReset
    If (world.IsTimer("idle_warning_timer_message") = eOK) Then world.DeleteTimer "idle_warning_timer_message"
    world.AddTimer "idle_warning_timer", 0, intIdleWarningStartMinutes, 0, "", 1+4+1024+16384, "IdleTimerLimit"
    datLastCmdSent = Now()
  End Sub

  Sub IdleTimerLimit(ByVal strTimerName)
    world.AddTimer "idle_warning_timer_message", 0, 0, intIdleWarningRepeatSeconds, "", 1+1024+16384, "IdleTimerMessage"
    IdleTimerMessage "IdleTimerLimit"
  End Sub

  Sub IdleTimerMessage(ByVal strTimerName)
    Dim varMinutes
    Dim varSeconds
    Dim strMsgSend

    varSeconds = Fix(CSng(Now - datLastCmdSent) * 86400) Mod 86400
    varMinutes = Fix(varSeconds / 60)
    varSeconds = varSeconds Mod 60

    strMsgSend = strMessageText
    strMsgSend = Replace(strMsgSend, "%m", varMinutes)
    If (InStr(1, strMsgSend, " %s") = 0 And varSeconds < 10) Then varSeconds = "0" & varSeconds
    strMsgSend = Replace(strMsgSend, "%s", varSeconds)

    world.ColourNote strMessageForeColor, strMessageBackColor, strMsgSend
  End Sub
]]>
</script>

</muclient>
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.


10,773 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.