Register forum user name Search FAQ

Gammon Forum

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.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Suggestions for implementing an event triggered logging system?

Suggestions for implementing an event triggered logging system?

You need to log onto the forum to reply or create new threads.

  Refresh page


Posted by Gdub   (40 posts)  Bio
Date Fri 25 Oct 2024 12:06 AM (UTC)

Amended on Fri 25 Oct 2024 08:32 PM (UTC) by Gdub

Message
hi folks,

Looking for some input on how I would go about capturing game output to a log file that could be triggered by specific events? Stuff like solving a big quest or PVP conflicts.

I think I know how to setup the event triggers but am not sure how to go about capturing game output with all its ANSI glory...

A PVP example would be:
2 players engage in PVP.
I would like to capture (from each players POV) ~60 seconds leading up to the engagement, their equipment and inventory.

Here's an example from another MUD: https://www.durismud.com/pvp/logs/301761

Any suggestions will be greatly appreciated!
Top

Posted by Gdub   (40 posts)  Bio
Date Reply #1 on Fri 25 Oct 2024 03:28 PM (UTC)
Message
I think I have a solution... sleep does wonders for problem solving. :)
Top

Posted by Gdub   (40 posts)  Bio
Date Reply #2 on Fri 25 Oct 2024 08:01 PM (UTC)

Amended on Fri 25 Oct 2024 08:33 PM (UTC) by Gdub

Message
I plugged into send_to_char_color() and act() with my logging hooks and am successfully writing to file. It's not capturing all the ANSI goodness though.


&g^wOvergrown Park^x

&rAlso in the room: Ant.

Obvious Exits: none.

You move to attack Ant.

! Autocombat ON !

Ant moves to attack you.

You are using:

<wielded>           &C<&R++++++++--&C>&W  &cSabre&g

<held>              &C<&R----------&C>&W  &cElvish Flute&g

<worn on back>      &C<&R++++++++++&C>&W  &cbrown leather backpack&g

Voodoo slashes Ant for 7 damage with his Sabre.

Ant charges north.

Ant flees head over heels!

&O! Autocombat OFF !

Saved...

Your surroundings begin to fade as a mystical swirling vortex of colors

envelops your body...



I'll keep digging/researching but if anyone has ideas, please share. Thank you
Top

Posted by Gdub   (40 posts)  Bio
Date Reply #3 on Fri 25 Oct 2024 09:05 PM (UTC)

Amended on Sat 26 Oct 2024 12:17 AM (UTC) by Gdub

Message
I shuffled everything 1 step lower to write_to_buffer() and it appears to be working!

If anyone want wants this code, please let me know.
Top

Posted by Nick Gammon   Australia  (23,100 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 26 Oct 2024 05:47 AM (UTC)
Message
OK, nicely done. Glad you solved it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Gdub   (40 posts)  Bio
Date Reply #5 on Sat 26 Oct 2024 05:27 PM (UTC)
Message
I'm still not super happy with the quality of the logs themselves but the system is working.

Maybe I can find a way to convert terminal output to HTML and post process them?
Top

Posted by Nick Gammon   Australia  (23,100 posts)  Bio   Forum Administrator
Date Reply #6 on Sat 26 Oct 2024 08:01 PM (UTC)
Message
There's a function in the server that converts stuff like &C into colours. You could simply do a find-and-replace of all those codes into HTML styles easily enough.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


286 views.

You need to log onto the forum to reply or create new threads.

  Refresh page

Go to topic:           Search the forum


[Go to top] top

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