taultunleashed logoPorting EQ2 bot - have question. : EverQuest 2 Premium Discussions
newtopic  postreply
 [ 7 posts ] 
blue large dot

Porting EQ2 bot - have question. : EverQuest 2 Premium Discussions

Posted: January 5th, 2005, 2:02 pm
 
drakkiss
drakkiss's Reps:
User avatar
Is there anyway for WaitForLogFileText() to monitor a logfile in realtime while a seperate function is running?

So if 'xxxxx' appears in the logfile it will break out of the the running sub and enter a new one? Or is WaitForLogFileText() mainly useful in a DO loop where it checks the log each time the loop resets?

My problem is I need to be able to break out of these loops as soon as a 'xxxxx' is found in the logfile. Finishing up the loop or wasting seconds is not an option.

Also, let's say my logfile gets updated 37 times while my loop is finishing. Will WaitForLogFileText() check all 37 entries since it was last called?


Reply with quote
Posted: January 5th, 2005, 2:10 pm
 
wyvernx

Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
User avatar
administrator
premium
Check out the XUFish for FFXI and WOW. They use a much better alternative using the FSO.

_________________
Use Search first, ask questions later!


Reply with quote
Posted: January 5th, 2005, 2:11 pm
 
wyvernx

Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
User avatar
administrator
premium
Actually, I tink asl18fs released a version 4 preview for his XUFish which uses nice classes. I beleive there is one for log entries.

_________________
Use Search first, ask questions later!


Reply with quote
Posted: January 5th, 2005, 2:12 pm
 
drakkiss
drakkiss's Reps:
User avatar
wyvernx";p="52001 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))):
Actually, I tink asl18fs released a version 4 preview for his XUFish which uses nice classes. I beleive there is one for log entries.


Thanks, I'll check it out now. . .


Reply with quote
Posted: January 5th, 2005, 2:23 pm
 
drakkiss
drakkiss's Reps:
User avatar
EDIT - Found asl18fs' version.


Reply with quote
Posted: January 7th, 2005, 8:49 am
 
drakkiss
drakkiss's Reps:
User avatar
I have made a breakthrough! I found a wonderful FREE object called COMScriptThread. It allows you to run functions and or entire scripts asynchronously! This is unbelievably useful for processing log files at high speed where you need to stop and start actions very quickly. You can download it here.

It's use took me a couple hours to figure out as the documentation isn't stellar. But it's free so who cares! Below I am posting example code so you will not have to fight with it like I did.

Main code:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
'main.vbs
Option Explicit
Dim thread, XX, ThreadFile, sf
Set thread = CreateObject("newObjects.utilctls.COMScriptThread")
Set sf = CreateObject("newObjects.utilctls.SFMain") 'Like FSO but more flexible
Set ThreadFile = sf.OpenFile("test.vbs")

If thread.Start("VBScript",ThreadFile.ReadText(-2)) Then
   If thread.Wait(30000) then 'Waiting up to 30 seconds - not necessarily required for this example
      If thread.success Then 'The thread started!
         thread.Execute("Tester") 'Execute the subroutine Tester from test.vbs
         MsgBox("Success")
      Else
         thread.Stop
         XX = thread.LastError 'Something went wrong waiting for the thread to start
         MsgBox(XX) 'Let's see what it was
      End If
   Else
    XX = thread.LastError 'The thread would not start at all if we got here.
   MsgBox(XX) 'Let's see why?
   End If
End If


Code we use to generate threads:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
'test.vbs
Option Explicit
Dim objFSO, objFSOText, objFolder, objFile
Dim strDirectory, strFile, strFile1
strDirectory = "c:\Scripts"
strFile = "\Special.txt"
strFile1 = "\Special1.txt"

Sub Tester
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
Echo "Just created " & strDirectory & strFile
End Sub

Sub Tester1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strDirectory & strFile1)
Echo "Just created " & strDirectory & strFile1
End Sub

It's a very simple example and I am not actually doing anything asynchronously, though I could be. I am simply demonstrating use of the members.

The Tester & Tester1 subroutines could be looped doing quite a bit of work if this script actually did anything useful. If that were the case, with this code I would have the power to start and stop either one at will.

One thing I have noticed is that there doesn't seem to be a way to stop routines that you have executing asynchronously in the same thread individually. You cannot stop someting you executed. Stop kills the entire thread. If you need that ability (as I do) just execute your subs using seperate threads (IE load the vbs file several times with a different thread name) or just split the subs that need that ability into different files (more effecient).


Reply with quote
Posted: January 7th, 2005, 2:45 pm
 
wyvernx

Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
User avatar
administrator
premium
The biggest problem is you would not be able to use XU functions because scripts must be started with XU. So I suggest this. Send admin a pm with where ya found it. He can add it to the script host and you can then call xu script host functions to spawn a thread if you need one, and still use xu functinos in it.

_________________
Use Search first, ask questions later!


Reply with quote
Want Advertisements After The Last Post Removed? Create A Free Account!

blue large dot Who is online
Users browsing this forum: No registered users and 205 guests

Popular Sections
SWTOR Cheats
Guild Wars 2 Cheats
Guild Wars 2 Hacks
Guild Wars 2 Bots
Diablo 3 Cheats
Guild Wars 2 Mods

Popular Sections
WoW Cataclysm Cheats & Exploits
WoW Cataclysm Hacks & Bots
Star Wars The Old Republic Cheats
SWTOR Mods
Torchlight 2 Cheats
SWTOR Space Mission Bots
Site Nav and RSS
RSS Feed of EverQuest 2 Premium Discussions RSS Feed 
Sitemap of EverQuest 2 Premium Discussions Sitemap 
SitemapIndex SitemapIndex
RSS Feed RSS Feed
Channel list Channel list
left bottom corner Site and Contents Copyright 2001-2012 All Rights Reserved TaultUnleashed.com bottom corner
top left
top right
createaccount
Username:   Password:   Remember Me?