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
➜ 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 page
Posted by
| Isthiriel
(113 posts) Bio
|
Date
| Fri 28 Dec 2007 09:28 PM (UTC) Amended on Sat 29 Dec 2007 10:06 AM (UTC) by Isthiriel
|
Message
| 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>
<muclient>
<plugin
name="mxp_entity_last_received"
author="Isthiriel"
id="321c805e606140f2c3e6272e"
language="Python"
purpose="To track the last received time of various mxp entities."
save_state="y"
date_written="2007-12-29 07:17:54"
requires="4.00"
version="1.0"
>
</plugin>
<script>
<![CDATA[
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.
]]>
</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.
7,657 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top