Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Fri Mar 18, 2016 7:09 pm   

CMUD Logging Question
 
Hello.

When you type "#LOG" to turn off a log, it does not copy the last line to show in the mud. In my case, I am running the #LOG command twice to force the log to write so I can actively analyze it with another program I am writing.

So every time the main prompt of the MUD I am playing comes up, it closes/opens the log. However, the prompt itself is never in the log file.

Is there a way to make the line showing that you type the #LOG command on to show up in the log file?

If not, then I might have to find another way to fire my dual #LOG command. I tried an alarm but it did not seem to work. Perhaps I should try to look into that again.

Thanks!
Derek Conlon
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Mar 18, 2016 7:18 pm   
 
I tend to use the onConnect event myself:

#EVENT onConnect {#LOG "filename"}

Other then that... maybe the setting in prefs, on the session tab to the left, then the logging tab up top, uncheck after triggers.

What exactly are you trying to capture though?
I fail to understand just what you are trying to achieve.
_________________
Discord: Shalimarwildcat
Reply with quote
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Fri Mar 18, 2016 9:19 pm   
 
I have a previous post here : http://forums.zuggsoft.com/forums/viewtopic.php?t=38902

The problem in that post was that the Log file didn't appear to update "instantly" so the fix for that was to force close the log file and then reopen it effectively making the log file update "instantly" because the prompt on the mud shows up after every input or message from the mud itself.

I attached the "#LOG" command to the prompt and it does this now everytime the prompt shows up in the MUD:

#LOG
#LOG logfile.txt

That closes and re-opens the log, which my C# program can detect and then process i.e. making it possible for me to monitor the log file "live" while I play and therefore show me information or have it auto cast spells as they wear off, etc.

The problem I have now is, I want the prompt to be in the log file, but whatever line you type "#LOG" on doesn't show up in the log file.
which brings me to the question in this thread.

Hope that clears up my goals and what's happening.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Mar 18, 2016 9:21 pm   
 
The prompt is not recorded because logging occurs when the line advances. The easiest way to solve this issue is capture the entire prompt and write it directly to the file after shutting off logging. You would use the #FILE, #WRITE, and #CLOSE commands in between your 2 #LOG commands. The %line Predefined Variable should contain your entire prompt. I think #WRITE will result in a newline being appended to avoid the extra newline you might using #CALL {%write(file, %line)}

If you find this method to be too slow then there is an alternative, but you will not be able to stop extra lines from being added to the log with each prompt.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Fri Mar 18, 2016 10:00 pm   
 
Vijilante wrote:
The prompt is not recorded because logging occurs when the line advances. The easiest way to solve this issue is capture the entire prompt and write it directly to the file after shutting off logging. You would use the #FILE, #WRITE, and #CLOSE commands in between your 2 #LOG commands. The %line Predefined Variable should contain your entire prompt. I think #WRITE will result in a newline being appended to avoid the extra newline you might using #CALL {%write(file, %line)}

If you find this method to be too slow then there is an alternative, but you will not be able to stop extra lines from being added to the log with each prompt.


This solution was a winner!!

Just so I don't have to ask again in the future if this slows down my game for some reason, what is the alternative? Extra lines in the LOG aren't that big of a deal because the LOG file isn't saved, its just analyzed as it is created. Then deleted periodically.

Thanks!!!!!
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Mar 18, 2016 11:14 pm   
 
There's also a #writelog command that you could use instead of #file/#write/#close.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Mar 19, 2016 12:09 am   
 
Even better Daern! I forgot about that command. I have updated the help to properly cross reference it. #WRITELOG is definitely the best solution since you are not concerned about extra lines in the log. I won't get into the the alternative beyond saying it would involve using the VT102 positioning code.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net