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

Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Plugin for tracking when MXP entities were last updated

Plugin for tracking when MXP entities were last updated

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

Posted by Isthiriel   (113 posts)  [Biography] bio
Date Fri 28 Dec 2007 09:28 PM (UTC)

Amended on Sat 29 Dec 2007 10:06 AM (UTC) by Isthiriel

I needed this for something else and since it seems to be fairly useful (if rather trivial) I've posted it :)

What it does is populate the plugin's variable space with the time that it last received a new entity message. Discworld MUD uses these to track hitpoints &c.. and from this information I can add a field to my InfoBar with how old the data is.

You can replace the time.clock() call with a time.time() call if that suits your purposes better.

(time.time() returns the unix epoch tick while time.clock() returns the number of seconds since the first call to time.clock() as a float with millisecond precision)

Also, this should be fairly easy to implement in Lua for portability, but not something I've done yet.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
   purpose="To track the last received time of various mxp entities."
   date_written="2007-12-29 07:17:54"
import re, time

def OnPluginMXPsetEntity(val):
    # val is of the form 'entity=newvalue'
    m = re.match("^([^=]*)=(.*)$", val)
    if not m: # something went wrong, we can't fix it, so ignore it
        return 0
    world.SetVariable(m.group(1), str(time.clock()))
    return 0 # returning a string here gets me a "Type Mismatch <OK>" dialog.
[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.


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.


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 HostDash]