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 ➜ General ➜ Is there a function that gets the time since the last input command?

Is there a function that gets the time since the last input command?

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


Posted by SKYY   (28 posts)  Bio
Date Tue 08 Apr 2008 01:09 AM (UTC)
Message
What the title says. Search hasn't helped me, and I want something for making a safe idling timer.

For example, the timer would look at the amount of time since the last triggered or typed-in command, and if that time exceeds a certain amount (15 minutes or so) it would input something like "save;afk".

Any advice?

Thanks in advance.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 08 Apr 2008 06:31 AM (UTC)
Message
I searched for "afk timer". This is one of the posts:

http://www.gammon.com.au/forum/?id=5964

- Nick Gammon

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

Posted by SKYY   (28 posts)  Bio
Date Reply #2 on Tue 08 Apr 2008 02:38 PM (UTC)
Message
I looked at that one, but it seemed like it wasn't automatic--ie. you had to manually set the timer on or off. I'm trying to make a plugin that IS automatic, ie. it knows how long since you've entered a command, and it sets you AFK when that time is past a certain amount.

Or does that plugin you wrote do just that?

Thanks.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Tue 08 Apr 2008 04:34 PM (UTC)
Message
It looks pretty automatic to me, once the plugin is enabled... The plugin takes care of managing the timer for you, you don't have to do it yourself.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 08 Apr 2008 09:01 PM (UTC)
Message
It would be hardly much use if you had to manually do it, would it?

The important part is here:


-- when they type something, reset AFK status

function OnPluginCommand (sText)
  FixTimer ()
  return true  -- process the command
end


Every time you enter a command it resets the timer. Thus effectively it remembers the time of the last command. If you don't enter a command for the desired period then the timer fires and sends the required message to the MUD.

- Nick Gammon

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

Posted by SKYY   (28 posts)  Bio
Date Reply #5 on Tue 08 Apr 2008 09:04 PM (UTC)
Message
I'm a moron. Heh--thanks!
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.


16,950 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.