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
➜ Timestamp to output
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ashass
(50 posts) Bio
|
Date
| Mon 06 Feb 2012 01:00 AM (UTC) |
Message
| Hey Nick, (or anybody who might know)
Currently I am utilizing the timestamp code (located at http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=10625)
I have need to put this into output so that it can be selected (or have the timestamp window changed in such a way it can be selected along with the text)
This will allow for better log parsing when it comes to pk logs, rp logs, etc. And will allow me to play back items in a real time format to emulate the occurrence.
Any suggestions how to approach this? I really like the fact that the timestamps are colored for normal world output, commands sent to mud, and scripts that are executed, and preserving that would be highly ideal. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 06 Feb 2012 03:11 AM (UTC) |
Message
| My suggestion is to amend the line preamble in the logging part (since you mention logs). That way you can stamp the date/time/whatever as part of the logs as saved to disk. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ashass
(50 posts) Bio
|
Date
| Reply #2 on Mon 06 Feb 2012 03:33 AM (UTC) |
Message
| Polite way of saying there's no clean way to save it in the raw output to world? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 06 Feb 2012 09:25 AM (UTC) |
Message
| I always try to be polite. :)
The fact is that that date/time is stored internally as part of the array entry for each line. And when you enable that option the output routine is configured to show it. And if you disable it, it isn't shown.
To actually add the date to the lines would corrupt the behaviour of many things like triggers that match on prompts, so it isn't actually part of the text of the line.
However ...
It wouldn't take much effort for you to write a small script that uses that to get the text of the line, plus the date/time it was created, plus the information about whether it is input/output/note and make your "copy" of the output buffer. You can even put it on the Clipboard:
So yes, there's a clean way of saving it, with timestamps, if you do a small script to do it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ashass
(50 posts) Bio
|
Date
| Reply #4 on Tue 07 Feb 2012 12:01 AM (UTC) |
Message
| Great reference! In spirit of keeping things simple, here's what it ultimately turned in to, and I am providing this as a sample for anyone else who might want a peek. My script is already capturing my prompt for health/mana/etc and outputting my condition based on that.
Output:
<122/122hp, 116/116m, 130/130mv, (Room of Holy Ceremony)[ES-SE]> 1:30pm.
[2/6/2012 4:58:49 PM] - You are in excellent condition.
The first line of output is my mud prompt, the second line of output is the result of that script you provided.
Trigger:
<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="<*/*hp, */*m, */*mv, *> *. *"
send_to="12"
sequence="100"
variable="health"
>
<send>Dim percent
dim line, total_lines
total_lines = world.GetLinesInBufferCount
SetVariable "current_hp", "%1"
SetVariable "total_hp", "%2"
percent = (%1/%2 * 100)
if(percent >= 100) then
world.tell "[" & world.GetLineInfo (total_lines, 9) & "] "
Note "You are in excellent condition."
end if
if(percent < 100 and percent >= 90) then
Note "You have a few scratches."
end if
if(percent < 90 and percent >= 75) then
Note "You have some small wounds and bruises"
end if
if(percent < 75 and percent >= 50) then
Note "You have quite a few wounds"
end if
if(percent < 50 and percent >= 30) then
Note "You have some big & nasty wounds"
end if
if(percent < 30 and percent >= 15) then
Note "You are pretty hurt"
end if
if(percent < 15 and percent > 0) then
Note "You are in awful condition"
end if
if(percent = 0) then
Note "You are dead!"
end if</send>
</trigger>
</triggers>
Thanks for your help Nick! | 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,529 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top