|
deathkitty Apprentice
Joined: 14 Apr 2008 Posts: 105
|
Posted: Tue Apr 22, 2008 12:59 am
How do I log different windows (created by triggers) separately? |
here is my screen with the different windows shown
I have a main one, one for Tells, one for my Group if I'm in one at the moment, one for chat Channel s and one for Clubs
I want to log them separately to different folders so I have logs\name\2008-blaba.txt and logs\name\Tells\2008-blaba.txt, logs\name\Channel\2008-blaba.txt etc
How do I set it up to do this? I have tried figuring it out myself but it's a pain :(
Thank you for any help :) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Apr 22, 2008 4:00 am |
Use the #log command in the child window, but give it the full file path (that'll be different for each window, obviously. You can get the date and time to put in the file name with %time if you like. If your windows don't have command lines, use the #execwin command for each window. Something like:
#forall chat|guild|tells {#execwin %i {#log %concat("C:\My Logs\My Mudname\",%i,"\",%time(yyyy-mm-dd),"-MyMudName-",%i,"-log.txt")}}
Which will result in files like
C:\My Logs\My Mudname\chat\2008-12-23-MyMudName-chat-log.txt |
|
|
|
deathkitty Apprentice
Joined: 14 Apr 2008 Posts: 105
|
Posted: Tue Apr 22, 2008 10:39 am |
where do I put the bit starting #forall, in a trigger or a atOpen event or something? it looks really confusing
i made all that stuff in the screenshot but just trial and error and reading instructions i dont get programming at all |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Apr 22, 2008 4:02 pm |
You could put it in an OnConnect event if you like or (perhaps more sensible) some line you get after you've logged in, so that it doesn't log your password.
It's a bit more complex than it needs to be, deliberately to make it look a bit prettier. I'll attempt to explain what it's doing:
The #forall command means "run these commands for every item in the list". The list in this case is chat|guild|tells and the command is the #execwin command. #execwin means "run these commands in this window" - the window in this case is %i, which is the current item that the #forall's at - so it runs the #execwin once when %i is "chat", once when it's "guild", and once when it's "tells", to run the command for each of those windows.
The command that #execwin is running in each window is the #log command. This command creates a log file for that window in wherever you sent it, and starts recording everything that comes in. The %concat function just means "jam these different bits together into one string", so that you can use variables in the file path. In this case, I used %i and %time to create a folder for each window, and to put the date and window name in each file's name.
Perhaps it'll be easier to look at if I colourise it:
#forall chat|guild|tells {#execwin %i {#log %concat("C:\My Logs\My Mudname\",%i,"\",%time(yyyy-mm-dd),"-MyMudName-",%i,"-log.txt")}}
The green parts are strings, literal words, and the blue parts are variables. The %concat function is going to put them all together into one string, telling the #log command where to save. |
|
|
|
deathkitty Apprentice
Joined: 14 Apr 2008 Posts: 105
|
Posted: Tue Apr 22, 2008 4:55 pm |
thanks loads, I understand it now and got it to work too :)
|
|
|
|
|
|
|
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
|
|