[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  measuring time
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

measuring time

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


Posted by Thebloodsiren   (13 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,647 posts)  [Biography] 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
[Go to top] top

Posted by Thebloodsiren   (13 posts)  [Biography] 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.
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,647 posts)  [Biography] 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
[Go to top] 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.


4,428 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]