[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Help with a script - logging the output of a command.

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Help with a script - logging the output of a command.
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Virthe   (4 posts)  [Biography] bio
Date Fri 25 May 2012 11:49 AM (UTC)  quote  ]
Message
Great! That fixed it. Thanks for your help.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Fri 25 May 2012 01:05 AM (UTC)  quote  ]
Message
You are short some backslashes. Inside a Lua string you need to double them, eg.


OpenLog("D:\\Users\\User\\Documents\\AL\\log.txt",false)


And if this is in "send to script" you have to double them again.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Virthe   (4 posts)  [Biography] bio
Date Thu 24 May 2012 02:55 PM (UTC)  quote  ]

Amended on Thu 24 May 2012 06:09 PM (UTC) by Virthe

Message
Okay. I now have:


And an alias with the following script:
OpenLog("D:\Users\User\Documents\AL\log.txt",false)
SetLogOutput (true)

SetTriggerOption("eof","enabled","y")

world.Send("cat %1")


A trigger labelled "eof" with the following script:
FlushLog()
CloseLog()
SetTriggerOption("eof","enabled","n")


The trigger runs as planned and is enabled/disabled correctly.

However, the log file still doesn't work. No file is created. I have tried using the default log name with no success.

Is there anything else I need to do to enable/disable logging from the script?
[Go to top] top

Posted by Virthe   (4 posts)  [Biography] bio
Date Thu 24 May 2012 01:03 PM (UTC)  quote  ]
Message
Okay, I think I can sort out the trigger (enabling and disabling it with SetTriggerOption).

I can't figure out how to get the log file working though. Am I on the right lines with that? Will it work if I move FlushLog() to the end of file trigger?
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Thu 24 May 2012 12:50 PM (UTC)  quote  ]
Message
Quote:
Would I need to set up triggers to detect when the output of the command has finished?

Yes.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Virthe   (4 posts)  [Biography] bio
Date Thu 24 May 2012 09:42 AM (UTC)  quote  ]
Message
I need to log the output of a command to a file on my hard disk?

So far I have this:


OpenLog("D:\Users\User\Documents\AL\test")
SetLogOutput (true)
world.Send("cat %1")
FlushLog()


It doesn't work at all.

I need to log all the output of the 'cat' command.

How do I correctly use log to store the MUD output?

Would I need to set up triggers to detect when the output of the command has finished?
[Go to top] 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.


919 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]