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.
 Entire forum ➜ MUSHclient ➜ General ➜ measuring time

measuring time

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


Posted by Thebloodsiren   (13 posts)  Bio
Date Thu 06 Feb 2003 11:15 AM (UTC)
Message
The mud i play requires a certain number of hours per month to be played minumum.

How would I create some sort of time reading device that records what time I log on and log off and then calculates and adds this to my monthly total?

-----------------------------------
Calm down, its only ones and zeros.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 06 Feb 2003 09:22 PM (UTC)
Message
Make a small plugin that gets the time on connection, and saves it into a variable. Make another that gets the time on disconnection. Find the difference. Add to a MUSHclient variable. Have the plugin save its state. Then that should gradually keep track of your connection time.

- Nick Gammon

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

Posted by Thebloodsiren   (13 posts)  Bio
Date Reply #2 on Thu 06 Feb 2003 11:17 PM (UTC)
Message
Sounds easy enough that I might be able to do it myself.
Can you make a trigger to catch the world.note stuff
--- Connected on Friday, February 07, 2003, 8:52 AM ---
and the disconnected message and then find the difference between them? I seem to be having troubles getting a trigger to match.

Otherwise do I need to use some function to get the system or world time. Like world.gettime if that existed.

Ta

-----------------------------------
Calm down, its only ones and zeros.
Top

Posted by Vaejor   (120 posts)  Bio
Date Reply #3 on Fri 07 Feb 2003 02:50 PM (UTC)
Message
Since no scripting language is mentioned, I'll just throw out that you can use the function Now() in VBScript to get your current date/time of your system.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 10 Feb 2003 10:19 PM (UTC)

Amended on Mon 10 Feb 2003 10:21 PM (UTC) by Nick Gammon

Message
Quote:

Can you make a trigger to catch the world.note stuff
--- Connected on Friday, February 07, 2003, 8:52 AM ---
and the disconnected message and then find the difference between them? I seem to be having troubles getting a trigger to match.


Those messages are world "notes" and triggers only match on incoming text from the MUD, so that won't work. However MUSHclient provides a "callback" for world connect and disconnect, so simply put a script function for both of them. Something like this, although I haven't tested it ...


dim connect_time

connect_time = Now  ' in case already connected

sub OnConnect
  connect_time = Now
end sub

sub OnDisconnect
dim Elapsed, TotalConnected

'
'  get connected time in minutes
'

  Elapsed = DateDiff ("m", connect_time, Now)

'
'  find previous connected time
'
 
  TotalConnected = CLng (world.GetVariable ("connected_time"))

'
'  add new time
'

  TotalConnected = TotalConnected + CLng (Elapsed)

'
'  save new time
'

  world.SetVariable "connected_time", TotalConnected

end sub


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


15,394 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.