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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Timestamp to output

Timestamp to output

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


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

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

Posted by Ashass   (50 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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 ...

Template:function=GetLineInfo GetLineInfo

The documentation for the GetLineInfo script function is available online. It is also in the MUSHclient help file.



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:

Template:function=SetClipboard SetClipboard

The documentation for the SetClipboard script function is available online. It is also in the MUSHclient help file.



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
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] 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="&lt;*/*hp, */*m, */*mv, *&gt; *. *"
   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 &gt;= 100) then

world.tell "[" &amp; world.GetLineInfo (total_lines, 9) &amp; "] " 
 
Note "You are in excellent condition."
end if

if(percent &lt; 100 and percent &gt;= 90) then
Note "You have a few scratches."
end if

if(percent &lt; 90 and percent &gt;= 75) then
Note "You have some small wounds and bruises"
end if

if(percent &lt; 75 and percent &gt;= 50) then
Note "You have quite a few wounds"
end if

if(percent &lt; 50 and percent &gt;= 30) then
Note "You have some big &amp; nasty wounds"
end if

if(percent &lt; 30 and percent &gt;= 15) then
Note "You are pretty hurt"
end if

if(percent &lt; 15 and percent &gt; 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!
[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.


14,458 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 HostDash]