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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ How does log work

How does log work

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


Posted by Buji   (4 posts)  Bio
Date Tue 26 Feb 2002 01:20 AM (UTC)
Message
Should this work?

sub LogTest()
world.openlog "test.txt", false
world.logoutput = 1
world.loginput = 1
world.send "l"
world.closelog()
end sub

Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 26 Feb 2002 11:55 AM (UTC)
Message
Logging logs output from the mud, and things you type (actually type, not world.send).

The reason logging does not log things in a script is that, if the script wants them logged, it can do it itself. A recent post suggest that if you want that then make your own function to do just that. That would be less typing anyway. eg.


sub Sendit (strText)
world.send strText
world.writelog strText
end sub


Thus you can now call "sendit" to send and log rather than "world.send". You can see that calling "sendit" is less typing, but automatically logs.

With this functionality available it seems unnecessary to worry about whether or not world.send logs in its own right.


- Nick Gammon

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

Posted by Buji   (4 posts)  Bio
Date Reply #2 on Tue 26 Feb 2002 07:10 PM (UTC)
Message
I like the idea of sendIt. The other problem I'm having is that the output from the "l" (look) is not being logged. The log is created, but empty. Should have made that clear in my first post, sorry.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 27 Feb 2002 12:42 AM (UTC)
Message
Ah I see. Your script sends the "L" command to the mud and then immediately closes the log (during the execution of the script). Thus the log is closed by the time the mud responds.

If you really wanted to capture something like a "look" output but nothing else, you would need to do it a bit differently. Here is one idea (remembering that the the mud might have stuff queued up to send you before it gets the "look" command).

1. Send a special string that is unlikely to occur normally.
2. Have a trigger that matches on that string and turns logging on.
3. Send the "look" command.
4. Send another special string.
5. Have another trigger that matches on the second string, this trigger turns logging off.

eg. something like this:

world.send "think $*&%$(*&%$FKJEDLKJSKDF"
world.send "look"
world.send "think 39u349flkjdfkjh&$%&$"

The triggers that match on the 2 funny strings could "omit from output" to avoid annoying you.


- 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.


16,627 views.

It is now over 60 days since the last post. This thread is closed.     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.