Aller au contenu

Photo

Write to log?


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
Somebody suggested that they have a script write to a log on the server and when the server restarts they use an outside script ((batch, bash, whatever)) to parse the log to delete or remove toons from the servervault.

My question is, how can use a script to intentionally write to a log?

#2
Thayan

Thayan
  • Members
  • 244 messages
Use the WriteTimestampedLogEntry() or PrintString() function. For example, from the Lexicon:

// This call would produce "[Fri Jul 12 12:08:03] Test" in the log file
WriteTimestampedLogEntry("Test");

The logfile the string is printed in is called nwclientlog.txt and is located in the "logs" folder under your nwn install directory.

Modifié par Thayan, 18 juin 2012 - 07:08 .


#3
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
Brilliant! I'll play with that. Thank you kindly Thayan!

#4
acomputerdood

acomputerdood
  • Members
  • 219 messages
using outside programs to parse your logfile to do stuff is very powerful. your imagination is the limit with the things you can do.

we've used it for a player status/tracking system, announcement of special victories or dragon slayings, triggers to automatically update forum posts, and of course, player deletions.

of course, we've been moving away from the log file entry system in favor of a slicker nwnx database system. but the log file is still a great place to start.

Modifié par acomputerdood, 19 juin 2012 - 12:43 .


#5
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
I'm not sure why I haven't been attracted to nwnx2 yet. I have MySQL already running on the server. Maybe I just don't know enough about the benefits and creative options.

#6
acomputerdood

acomputerdood
  • Members
  • 219 messages
at the risk of spamming my own nwvault submissions:

http://nwvault.ign.c....Detail&id=3627
http://nwvault.ign.c....Detail&id=3838
http://nwvault.ign.c....Detail&id=3837
http://nwvault.ign.c....Detail&id=3626

i'm always looking for new ideas and ways to combine mysql/web interfaces to interact with the game. having a heartbeat poll the database every 6 seconds offers decent granularity to check for events to happen.

Modifié par acomputerdood, 19 juin 2012 - 05:00 .


#7
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<marking up...>

Dood! I had no idea! Great stuff... and I *knew* you could export the minimap, somehow :-) Very important for my regional mod system ;-)

Seriously, a shameless self-promotion thread would not be inappropriate, I'm thinking. The web - ingame chat function alone is yummy enough for that :-)

<...bookmarks like crazy>