Most efficient file watch - lavishscript
Moderators: Lavish Software Team, Moderators
Most efficient file watch - lavishscript
I'm building a kind of timer / countdown bar overlay to use in EQ1 to show spell duration, resuse timers, etc. It will simply read log file lines and update based on string matches. (yes I know about GTT but I want graphical bars and ability to monitor multiple files without multiple GTT's running).
I'm trying to determine the best (efficient) way to open multiple log files and watch them for new lines.
If I did this in lavishscript it would basically be:
load a script w/ main function that:
- opnens readonly all my log files (3 or 4 of them)
- in while loop
--- read line
--- if not EOF then parse read line
------ set any properties to update UI
---update my UI bars that are active and update based on last line parsed
Is this the right approach for Lavishscript? Should I do any kind of counter / wait in the while loop to prevent excessive processing (like ensure the loop only runs once every 100ms or so)?
Or .. is there some other approach I should use for this to be done efficiently?
I'm trying to determine the best (efficient) way to open multiple log files and watch them for new lines.
If I did this in lavishscript it would basically be:
load a script w/ main function that:
- opnens readonly all my log files (3 or 4 of them)
- in while loop
--- read line
--- if not EOF then parse read line
------ set any properties to update UI
---update my UI bars that are active and update based on last line parsed
Is this the right approach for Lavishscript? Should I do any kind of counter / wait in the while loop to prevent excessive processing (like ensure the loop only runs once every 100ms or so)?
Or .. is there some other approach I should use for this to be done efficiently?
There is an efficient real-time log parsing method available in Inner Space. Here's a working proof-of-concept script: http://pastebin.com/gm3BV4Jj
Ok I have most of what I need working.
Is there any way to load specific log files? It does not matter which file I pass to RegisterLog, it always uses the log file of the current character for that IS session. For example, all 3 of the following produce the same result and always reads "MyCharacter.txt":
LogReader:RegisterLog["logs/eqlog_MyCharacter.txt","EQ1_ChatLog"]
LogReader:RegisterLog["logs/eqlog_SomeOtherCharacter.txt","EQ1_ChatLog"]
LogReader:RegisterLog["logs/eqlog_*.txt","EQ1_ChatLog"]
LogReader:RegisterLog["","EQ1_ChatLog"]
I didn't see any virtual files mapped for log files, but maybe there is some other redirection happening?
Is there any way to load specific log files? It does not matter which file I pass to RegisterLog, it always uses the log file of the current character for that IS session. For example, all 3 of the following produce the same result and always reads "MyCharacter.txt":
LogReader:RegisterLog["logs/eqlog_MyCharacter.txt","EQ1_ChatLog"]
LogReader:RegisterLog["logs/eqlog_SomeOtherCharacter.txt","EQ1_ChatLog"]
LogReader:RegisterLog["logs/eqlog_*.txt","EQ1_ChatLog"]
LogReader:RegisterLog["","EQ1_ChatLog"]
I didn't see any virtual files mapped for log files, but maybe there is some other redirection happening?
Thanks for posting your results over on isboxer.com 
ismods.com could use some content like this as well, if you're interested. The site is a bit under-utilized right now but this is exactly what belongs there

ismods.com could use some content like this as well, if you're interested. The site is a bit under-utilized right now but this is exactly what belongs there
Any chance of a transparent parameter for AddTrigger? (or is there a way to do it with current implementation)
example usage: http://pastebin.com/bNZ3mZpy
I'd like to control the proliferation of atoms ) If it gets too unwieldy I might build a configurator to generate my files.
On that note .. any thought given to extensibility plugins for isboxer that could generate other files based on the isboxer config?
example usage: http://pastebin.com/bNZ3mZpy
I'd like to control the proliferation of atoms ) If it gets too unwieldy I might build a configurator to generate my files.
On that note .. any thought given to extensibility plugins for isboxer that could generate other files based on the isboxer config?
Sorry for the necro of this old thread, but this is where I got all the info I am asking questions about.
I have used ISboxer for years, and decided I wanted to try out the TTS in your example. The problem is I can't get it to read the log files as they change.
I tried the various name combinations mentioned above. The file name format is currently "eqlog_charname_servername.txt", and I tried adjusting for that. I ran the script as a direct copy from the sample provided, both from the Uplink console and from the console in the game itself (from the instance "is1"). In game, the log file is on and being updated as expected.
How do I determine which file it is looking at (ie to confirm the path and file format is correct)? Or any other ideas on what might be wrong?
Thanks!
I have used ISboxer for years, and decided I wanted to try out the TTS in your example. The problem is I can't get it to read the log files as they change.
I tried the various name combinations mentioned above. The file name format is currently "eqlog_charname_servername.txt", and I tried adjusting for that. I ran the script as a direct copy from the sample provided, both from the Uplink console and from the console in the game itself (from the instance "is1"). In game, the log file is on and being updated as expected.
How do I determine which file it is looking at (ie to confirm the path and file format is correct)? Or any other ideas on what might be wrong?
Thanks!
The log reader supports wildcards. The example script (http://pastebin.com/gm3BV4Jj) should work without modifications, using a wildcard.Pizani wrote:Sorry for the necro of this old thread, but this is where I got all the info I am asking questions about.
I have used ISboxer for years, and decided I wanted to try out the TTS in your example. The problem is I can't get it to read the log files as they change.
I tried the various name combinations mentioned above. The file name format is currently "eqlog_charname_servername.txt", and I tried adjusting for that. I ran the script as a direct copy from the sample provided, both from the Uplink console and from the console in the game itself (from the instance "is1"). In game, the log file is on and being updated as expected.
How do I determine which file it is looking at (ie to confirm the path and file format is correct)? Or any other ideas on what might be wrong?
Thanks!
LogReader:RegisterLog["logs/eqlog_*.txt","EQ1_ChatLog"]
The * matches any charname_servername.txt.
The event attached to the log reader fires when the file is open and specifies the filename.How do I determine which file it is looking at (ie to confirm the path and file format is correct)?
Code: Select all
atom OnEQ1ChatLog(string filename, string action, string text)
{
echo "OnEQ1ChatLog["${filename.Escape}","${action.Escape}","${text.Escape}"]"
}
Share your actual code and I can give more speficic tips. Also if you're running this in the Uplink that's not going to work, the log reader works based on the log files open by the current process.Or any other ideas on what might be wrong?
p.s. I would prefer ismods.com for this type of question but that's okay. Here's an example of a script, at ismods.com, based on the stuff in this thread: http://ismods.com/phpBB3/viewtopic.php?f=5&t=29
Thanks for the reply, Lax. Here is the code (it's a subset of the examples above so I can actually see a response when the log file changes).
This code is run inside the EQ game instance (NOT from the Uplink console). It all seems easy enough to me, but I don't get a response. File logging is on and starts up when I log in although EQ does not add the line regarding logging being on. I can use "/log on" to create the line in the log file that says
Logging to 'eqlog.txt' is now *ON*.
But no echoed text appears.
I created a new (trash) character for these tests. The log file created is from log in, plus my turning on and off AFK to see if events are firing.
The issue is that it just seems not to see any log file changes. the OnEQ1ChatLog event just does not seem to fire. I am guessing at the cause, but it could be that it is reading from the wrong folder. But to see what folder it is monitoring, I would need the event to fire.
My EQ install path is D:\Games\Everquest\First and the log files are being created in that folder as expected.
InnerSpace is installed to D:\Games\InnerSpace and the scripts are in the "Scripts\Test" subfolder.
The only response I get in the console area is "<<Test Activated>>" upon running the script, as expected.
There doesn't seem to be much that can go wrong, except the folder names. I tried forcing the full folder name as well, with no change.
Thanks for looking at this.
Code: Select all
function main()
{
AddTrigger EQ1_OnLoggingEnabled "[@datetime@] Logging to 'eqlog.txt' is now *ON*."
AddTrigger EQ1_AFKOn "[@datetime@] You are now A.F.K. (Away From Keyboard)."
AddTrigger EQ1_AFKOff "[@datetime@] You are no longer A.F.K. (Away From Keyboard)."
LogReader:RegisterLog["logs/eqlog_*.txt","EQ1_ChatLog"]
LavishScript:RegisterEvent[EQ1_ChatLog]
Event[EQ1_ChatLog]:AttachAtom[OnEQ1ChatLog]
echo <<Test Activated>>
while 1
{
waitframe
}
}
atom EQ1_OnLoggingEnabled(string _Line, string _DateTime)
{
echo EQ1_OnLoggingEnabled[\"${_Line.Escape}\",\"${_DateTime.Escape}\"]"
}
atom EQ1_AFKOn(string _Line, string _DateTime)
{
echo EQ1_AFKOn()
}
atom EQ1_AFKOff(string _Line, string _DateTime)
{
echo EQ1_AFKOff()
}
atom OnEQ1ChatLog(string filename, string action, string text)
{
echo "OnEQ1ChatLog[\"${filename.Escape}\",\"${action.Escape}\",\"${text.Escape}\"]"
}
Logging to 'eqlog.txt' is now *ON*.
But no echoed text appears.
I created a new (trash) character for these tests. The log file created is from log in, plus my turning on and off AFK to see if events are firing.
Code: Select all
[Sun Oct 12 07:37:40 2014] You are not currently assigned to an adventure.
[Sun Oct 12 07:37:45 2014] Announcing now off
[Sun Oct 12 07:37:46 2014] Channels: 1=newplayers(4), 2=General(58), 3=Necromancer(1), 4=Faydwer(11)
[Sun Oct 12 07:37:46 2014] Welcome to EverQuest!
[Sun Oct 12 07:37:46 2014] If you need help, click on the EQ Menu button at the bottom of your screen and select the "Help" option.
[Sun Oct 12 07:37:46 2014] You have entered The Steamfont Mountains.
[Sun Oct 12 07:37:47 2014] Your account has one or more rewards waiting to be claimed. You may use the Claim Window to view and claim your rewards. Please remember that each reward can only be claimed by a single character on a single server on this account.
[Sun Oct 12 07:37:47 2014] You can claim a veteran reward on this character. Type /veteranReward to mark this character veteran reward enabled. Once a character is flagged for veteran rewards they will get all veteran rewards this account is flagged for, and they will automatically get new veteran rewards as this account qualifies for them.
[Sun Oct 12 07:38:07 2014] You are now A.F.K. (Away From Keyboard).
[Sun Oct 12 07:38:10 2014] You are no longer A.F.K. (Away From Keyboard).
[Sun Oct 12 07:42:33 2014] Logging to 'eqlog.txt' is now *ON*.
My EQ install path is D:\Games\Everquest\First and the log files are being created in that folder as expected.
InnerSpace is installed to D:\Games\InnerSpace and the scripts are in the "Scripts\Test" subfolder.
The only response I get in the console area is "<<Test Activated>>" upon running the script, as expected.
There doesn't seem to be much that can go wrong, except the folder names. I tried forcing the full folder name as well, with no change.
Thanks for looking at this.