Page 1 of 1
Play soundfile on tell?
Posted: April 8th, 2007, 6:05 am
by mythicskunk
Hi, I have a very very limited knowledge of scripting but managed to write myself a little bot. I am fairly pleased with the it so far but I would like some notification if it receives a tell (I'm usually watching a movie while its running and atm I have to get up every 15 min to check on it)
I was just wondering if anyone had any suggestions or maybe just a line of code that would play a sound file when my character receives a tell. I can hook onto the log file fine, I just don't know how to read or react to it
Any help would be appreciated, thanks.
Posted: April 9th, 2007, 9:30 am
by mythicskunk
Well, I was able to get working. I just copy/pasted a function out of one of the B-Bots.
Big thanks to Binafus.
Posted: April 9th, 2007, 4:20 pm
by macro112
Mind posting what the function is?
Posted: April 15th, 2007, 9:10 pm
by mythicskunk
Put this at the top of your script
Const QUIT_ON_TELL = 1
Dim GoodPlayer(4)
GoodPlayer(0) = "1Joe"
GoodPlayer(1) = "1Test"
GoodPlayer(2) = "1Bill"
GoodPlayer(3) = "1Tom"
GoodPlayer(4) = "1Edd"
Dim fso, InFile, Line, Path ' Set up File Vars
Const ForReading = 1 ' Flag to open file up for reading
Path = root.GetExhumeDirectory ' Find the root directory for VGExtreme
FileName = root.GetExhumeDirectory & "\VGLogDump.log" ' Name of outputfile
Set fso = CreateObject("Scripting.FileSystemObject") '
FileIO.TouchFile(FileName) ' If file does not exist create it
Set Infile = fso.OpenTextFile(FileName, ForReading) ' Log file setup
Dim TellName, TellNameStart, TellNameEnd, TempTime, TempExp ' Vars for Checking the log file
Dim Experience, ExpStart, ExpEnd, StartingExperience, StartingTime ' Vars for CheckLog
'*************************************************************'
'* Opens up Log file and Moves to the bottom of it
'*************************************************************'
'
Function OpenLogFile () ' Opens up Log File
Do While Not (Infile.AtEndOfStream) ' Reads Log File till it is at EOF
Line = Infile.ReadLine
Loop
OpenLogFile= True
EnableChatLog ' Turn the ChatLog on
End Function
'********************************'
'* Pattern Search *'
'********************************'
' This Function Should Work for Any Class
'
Function RegExpTest(patrn, strng) ' Pattern Search Function
Dim regEx, Match, Matches ' Create variable.
Set regEx = New RegExp ' Create a regular expression.
regEx.Pattern = patrn ' Set pattern.
regEx.IgnoreCase = True ' Set case insensitivity.
regEx.Global = True ' Set global applicability.
Set Matches = regEx.Execute(strng) ' Execute search.
For Each Match in Matches ' Iterate Matches collection.
RetStr = RetStr & Match.FirstIndex ' & ". Match Value is '"
Next
RegExpTest = RetStr
End Function
Function Check_Log
Dim a
Do While not (Infile.atEndOfStream) ' do while not EOF
Line = Infile.ReadLine ' Read a Line from InFile
if Instr (Line, "From") then
TellNameStart = (RegExpTest("<pcname>", Line)) ' Searches for <pcname>
TellNameStart = TellNameStart + 9
TellNameEnd = (RegExpTest("</l", Line)) ' Searches for the , space in the line
TellNameEnd = TellNameEnd - TellNameStart + 1
TellName = Mid(Line, TellNameStart,TellNameEnd)
log.debuglog " You just got a Tell From " & TellName
for a = 0 to ubound(GoodPlayer) ' Checks if the mob is in the harvest array
if GoodPlayer(a) = TellName then
Log.debuglog " This is a Friendly Player "
exit for
End if
Next
If (QUIT_ON_TELL = 1) then ' Flag if set to 1 will exit game
VGSendCommand "/quit" ' Quit the game the bot just got a tell.
End if
End if
Loop
End Function
Modify the spot under """"If (QUIT_ON_TELL = 1) then"""""
to react to a tell according to your specifiactions. for example Sound.PlaySoundFile "Ring.wav"
This is not my work. Thank Binafus
Posted: May 24th, 2007, 10:38 pm
by hat123
Can someone please make a simple play sound on tell script so I can AFK and hear that I got a tell when Im LFG ect. Thanks Alot