huldu Posted February 28, 2006 Author Posted February 28, 2006 (edited) Ye something like that. However, for example the "aimless boogey" is something that changes, depending on what type of monster you are fighting. This might cause alot of problems, so im leaving that out for now. Same with "You perform your Figure Eight", figure eight is a style and also changes alot depending on class etc. Im gonna leave that out for now. For the moment im only focusing on the actual experiance gained (will be good for now). The rest of the stuff i guess tends to be more complicated.<monster type> " hits your " <armor part> " for " <damage> <resist> " damage!" (<resist> can be something like (-1), (-1000) it can also be a positive number (+1) or +(1000).<monster type> " dies!"<monster type> " attacks you and misses!<monster type> " attacks you and you " <defense> " the blow! (<defense> can be parry, evade or block>"You perform your " <style> " perfectly." <style bonus> (<style bonus> can be a negative or a positive value from 1 to 9999), a side note if there is no <style bonus> the style was not "performed" (this is a bug in the game)"You critical hit for an additional " <crit dmg> " damage!" (the <crit dmg> can be a large or a small value, can never be negative."You heal yourself for " <healed> " hit points." (<healed> can never be a negative)"You get " <experiance> " experience points." <bonus exp> (no need for the <bonus exp>)You pick up 32 silver, and 15 copper pieces. (this is a tad more complicated because it can several types of coin, platina, gold, silver and copper. In the example above it only shows silver and copper.But in generally thats how the "complicated" part works. No need for that now, the experiance gained is more then enough for now. Edited February 28, 2006 by huldu "I'm paper, rock is fine, nerf scissors!!!"
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 Here this shouldn't be to hard for you to look at and get the idea of what is going on. Let's see what you can do with it from here... it's almost 6 am, I've got to get some sleep#include <file.au3> Global $LastTimeChecked = '' Global $aGAmeArray = StringSplit('You perform your |You attack aimless boogey with your staff and hit for |' & _ 'aimless boogey attacks you and |You miss!|aimless boogey attacks you and |You critical hit for an additional |' & _ 'You heal yourself for | dies!| experience points. |You pick up |, which you pick up.| attacks you and misses!| hits your ', '|') Local $aArray = '' Local $fz_FilePath = @DesktopDir & '\chat.log'; change this to your file location If Not _FileReadToArray($fz_FilePath, $aArray) Then MsgBox(0, 'Error', 'No File') Exit EndIf Local $GameInfo = _ExtractGameInfo($aArray) Func _ExtractGameInfo(ByRef $nArray) Local $sMid = '', $sLen = '', $TimeCheck = '', $ReturnArray = '' For $x = 1 To UBound($nArray) - 1 $TimeCheck = StringMid($nArray[$x], StringInStr($nArray[$x], '[') + 1, StringInStr($nArray[$x], ']') - 2) If $TimeCheck > $LastTimeChecked Then $LastTimeChecked = $TimeCheck For $i = 1 To UBound($aGAmeArray) - 1 If StringInStr($nArray[$x], $aGAmeArray[$i]) Then If $i = 1 Then $ReturnArray = $ReturnArray & StringTrimLeft($nArray[$x], StringInStr($nArray[$x], '(') - 1) & Chr(01) If $i = 2 Then $ReturnArray = $ReturnArray & StringTrimLeft(StringTrimRight($nArray[$x], StringLen(' damage!')), StringLen($aGAmeArray[$i])) & Chr(01) EndIf Next EndIf Next $ReturnArray = StringSplit(StringTrimRight($ReturnArray, 1), Chr(01)) For $c = 1 To UBound($ReturnArray) - 1 ConsoleWrite($ReturnArray[$c] & @LF) Next EndFunc The Last $ReturnArray (the stringsplit) is normally what we would return, but I put a for loop there with console write so you can test your progress. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
huldu Posted February 28, 2006 Author Posted February 28, 2006 Thank you for your time spent smoke i really appreciate it! "I'm paper, rock is fine, nerf scissors!!!"
huldu Posted February 28, 2006 Author Posted February 28, 2006 I changed a few things just to get the idea how it works, however i ran into a problem which i cant figure out. expandcollapse popup#include <file.au3> Global $LastTimeChecked = '' Global $aGAmeArray = StringSplit('You get| experiance points', '|') $a = 0 Local $aArray = '' Local $fz_FilePath = @ScriptDir & '.\chat.log'; change this to your file location If Not _FileReadToArray($fz_FilePath, $aArray) Then MsgBox(0, 'Error', 'No File') Exit EndIf Local $GameInfo = _ExtractGameInfo($aArray) Func _ExtractGameInfo(ByRef $nArray) Local $sMid = '', $sLen = '', $TimeCheck = '', $ReturnArray = '' For $x = 1 To UBound($nArray) - 1 $TimeCheck = StringMid($nArray[$x], StringInStr($nArray[$x], '[') + 1, StringInStr($nArray[$x], ']') - 2) If $TimeCheck > $LastTimeChecked Then $LastTimeChecked = $TimeCheck For $i = 1 To UBound($aGAmeArray) - 1 If StringInStr($nArray[$x], $aGAmeArray[$i]) Then If $i = 1 Then $ReturnArray = $ReturnArray & StringTrimLeft($nArray[$x], StringInStr($nArray[$x], ' ') -1 ) & Chr(01) If $i = 2 Then $ReturnArray = $ReturnArray & StringTrimLeft(StringTrimRight($nArray[$x], StringLen(' damage!')), StringLen($aGAmeArray[$i])) & Chr(01) EndIf Next EndIf Next $ReturnArray = StringSplit(StringTrimRight($ReturnArray, 1), Chr(01)) For $c = 1 To UBound($ReturnArray) - 1 ;ConsoleWrite($ReturnArray[$c] & @LF) If $a = 0 Then $openfile = FileOpen(".\spam.txt", 2) $a = 1 EndIf FileWriteLine($openfile, $ReturnArray[$c]) Next FileClose($openfile) EndFunc I changed the to Global $aGAmeArray = StringSplit('You get', '|') And the variable down in the For loop. What this should do (i was hoping) was to show all the "[01:22:02] You get 4,516,866 experience points. (1,505,622 instance bonus)". The weird thing however was that NO experiance poped up. I however got this line: 23:57:17] @@You send, "do graphic change on minion pets as you get new ones?" to Belgrove Im still trying to figure out how this works. "I'm paper, rock is fine, nerf scissors!!!"
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 (edited) Here try this, I made a couple of alterations, in case someone didn't do it better before I went to bed, so maybe if I have time, it would be easy to play with when I woke up (which is probably smarter for me to just wait anyway).. The initial scan if you folder is this big, is always going to be slow in the first pass, but now I have the time checked for the end of the file, so if it isn't higher than said time that it will just skip and continue the loop (will be much faster after the initial)expandcollapse popup#include <file.au3> Global $LastTimeChecked = '' Global $aGAmeArray = StringSplit('You perform your |You attack boogey runt with your staff and hit for |' & _ 'aimless boogey attacks you and |You miss!|aimless boogey attacks you and |You critical hit for an additional |' & _ 'You heal yourself for | dies!| experience points. |You pick up |, which you pick up.| attacks you and misses!| hits your ', '|', 1) Local $aArray = '' Local $fz_FilePath = @DesktopDir & '\chat.log'; change this to your file location If Not _FileReadToArray($fz_FilePath, $aArray) Then MsgBox(0, 'Error', 'No File') Exit EndIf Local $GameInfo = _ExtractGameInfo($aArray) Func _ExtractGameInfo(ByRef $nArray) Local $sMid = '', $sLen = '', $TimeCheck = '', $ReturnArray = '', $LastBracket = '', $cCount = '' For $x = 1 To UBound($nArray) - 1 $sTMid = _StringBetween($nArray[$x], '[', ']') If StringInStr($sTMid, ':') And StringInStr($nArray[$x], '[') And StringInStr($nArray[$x], ']') Then $TimeCheck = $sTMid $LastBracket = $x EndIf If $TimeCheck > $LastTimeChecked Then For $i = 1 To UBound($aGAmeArray) - 1 If StringInStr($nArray[$x], $aGAmeArray[$i]) Then If $i = 1 Then $ReturnArray = $ReturnArray & StringTrimLeft($nArray[$x], StringInStr($nArray[$x], '(') - 1) & Chr(01) If $i = 2 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' damage!') & Chr(01) EndIf Next EndIf Next $LastTimeChecked = StringMid($nArray[$LastBracket], StringInStr($nArray[$LastBracket], '[') + 1, StringInStr($nArray[$LastBracket], ']') - 2) $ReturnArray = StringSplit(StringTrimRight($ReturnArray, 1), Chr(01)) For $c = 1 To UBound($ReturnArray) - 1 ConsoleWrite($ReturnArray[$c] & @LF) Next ConsoleWrite($LastTimeChecked & @LF) EndFunc Func _StringBetween($s_String, $s_Start, $s_End = 0) $s_Start = StringInStr($s_String, $s_Start)+StringLen($s_Start) return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End)-$s_Start) EndFunc Where you thought this was going to be an easy task is seriously beyone me, your doing at least 2 parses, then you have to go back to each individual array and play with the strings until you get the desired output. Edit: Made it a tad easier... Edited February 28, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 Here, this does the original file you gave me:expandcollapse popup#include <file.au3> Global $LastTimeChecked = '' Global $aGAmeArray = StringSplit('You perform your |You attack boogey runt with your staff and hit for |' & _ 'aimless boogey attacks you and |You miss!|You critical hit for an additional |' & _ 'You heal yourself for | dies!| experience points. |You pick up |, which you pick up.| attacks you and misses!| hits your ', '|', 1) Local $aArray = '' Local $fz_FilePath = @DesktopDir & '\chat.log'; change this to your file location If Not _FileReadToArray($fz_FilePath, $aArray) Then MsgBox(0, 'Error', 'No File') Exit EndIf Local $GameInfo = _ExtractGameInfo($aArray) Func _ExtractGameInfo(ByRef $nArray) Local $sMid = '', $sLen = '', $TimeCheck = '', $ReturnArray = '', $LastBracket = '', $cCount = '' For $x = 1 To UBound($nArray) - 1 $sTMid = _StringBetween($nArray[$x], '[', ']') If StringInStr($sTMid, ':') And StringInStr($nArray[$x], '[') And StringInStr($nArray[$x], ']') Then $TimeCheck = $sTMid $LastBracket = $x EndIf If $TimeCheck > $LastTimeChecked Then For $i = 1 To UBound($aGAmeArray) - 1 If StringInStr($nArray[$x], $aGAmeArray[$i]) Then If $i = 1 Then $ReturnArray = $ReturnArray & StringTrimLeft($nArray[$x], StringInStr($nArray[$x], '(') - 1) & Chr(01) If $i = 2 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' damage!') & Chr(01) If $i = 3 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' the blow!') & Chr(01) If $i = 4 Then $ReturnArray = $ReturnArray & $aGAmeArray[$i] & Chr(01) If $i = 5 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' damage!') & Chr(01) If $i = 6 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' hit points') & Chr(01) If $i = 7 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], '] ', $aGAmeArray[$i]) & Chr(01) If $i = 8 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], 'You get ', $aGAmeArray[$i]) & Chr(01) & _StringBetween($nArray[$x], '. (', ' instance bonus)') & Chr(01) If $i = 9 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' silver') & Chr(01) & _StringBetween($nArray[$x], 'and ', 'copper') & Chr(01) If $i = 10 Then $ReturnArray = $ReturnArray & 'bag of coins' & Chr(01) If $i = 11 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], '] ', $aGAmeArray[$i]) & Chr(01) If $i = 12 Then $ReturnArray = $ReturnArray & _StringBetween($nArray[$x], $aGAmeArray[$i], ' for ') & Chr(01) & _StringBetween($nArray[$x], ' for ', ' damage!') & Chr(01) MsgBox(0, $i, $ReturnArray) EndIf Next EndIf Next $LastTimeChecked = _StringBetween($nArray[$LastBracket], '[', ']') $ReturnArray = StringSplit(StringTrimRight($ReturnArray, 1), Chr(01)) For $c = 1 To UBound($ReturnArray) - 1 ConsoleWrite($ReturnArray[$c] & @LF) Next ConsoleWrite($LastTimeChecked & @LF) EndFunc Func _StringBetween($s_String, $s_Start, $s_End = 0) $s_Start = StringInStr($s_String, $s_Start)+StringLen($s_Start) return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End)-$s_Start) EndFuncYou'll have to add to the $aGameArray = StringSplit(), because that huge file you gave me has different between words/items. But this is really self explanitory, as you add to the split... you'll just go up in $i = 13 / 14 etc..., using _StringBetween() should make it that much easier for you. This is the text I used[23:30:10]You perform your Figure Eight perfectly. (+31) [23:30:10] You attack aimless boogey with your staff and hit for 69 (-12) damage! [23:30:10] You prepare to perform a Double Strike! [23:30:17] aimless boogey attacks you and you parry the blow! [23:30:17] You miss! [23:30:20] aimless boogey attacks you and you evade the blow! [23:30:24] aimless boogey attacks you and misses! [23:30:27] You critical hit for an additional 27 damage! [23:30:36] You heal yourself for 37 hit points. [23:30:42] aimless boogey dies! [23:30:42] You get 3,120,957 experience points. (1,040,319 instance bonus) [23:30:42] You pick up 34 silver, and 9 copper pieces. [23:30:42] You deposit 69 copper pieces in your guild bank. [23:30:42] aimless boogey drops a bag of coins, which you pick up. [23:30:57] boogey runt attacks you and misses! [23:31:08] boogey runt hits your torso for 51 (-18) damage! If you need to know what each are, you can put in $ReturnArray & $ReturnArray & 'Attacker is: ' & string & Chr(01)... but it should just be like Valauters 1-2-3 now Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
huldu Posted February 28, 2006 Author Posted February 28, 2006 Wow, this is looking really really great smoke ) "I'm paper, rock is fine, nerf scissors!!!"
w0uter Posted February 28, 2006 Posted February 28, 2006 could you explain precicely what you want to get out of that log file, and what you want to do with it. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 could you explain precicely what you want to get out of that log file, and what you want to do with it.http://www.autoitscript.com/forum/index.ph...ndpost&p=154883 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
w0uter Posted February 28, 2006 Posted February 28, 2006 (edited) never saw that but still i wonder in what format he wants it. does he just want all the data in a big array ?or like an different array for evry 'thing'I wondered when you would poke your head into this postyour funny Edited February 28, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 never saw that but still i wonder in what format he wants it. does he just want all the data in a big array ?or like an different array for evry 'thing'your funny To be honest w0uter, if you run my last example, it seems that is what they are looking for, but then when you look at that Chat.log file.... Things are not the same....I don't know how they plan on tracking what each item returned is... but gave the example of adding something to the $ReturnArray of each of 'those' 12 options to seperate them. All that was asked was to help get specific information, what and how it would be used wasn't explained. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
w0uter Posted February 28, 2006 Posted February 28, 2006 heres my lazy try #include <array.au3> $s_File = FileRead(@DesktopDir & '\chat.log'); change this to your file location $as_cast = StringRegExp($s_File, 'You cast a (.*?) Spell!', 3) $as_prep = StringRegExp($s_File, 'You prepare to perform a (.*?)!', 3) $as_heal = StringRegExp($s_File, 'You heal yourself for (.*?) hit points.', 3) _ArrayDisplay($as_cast, 'Casted') _ArrayDisplay($as_prep, 'Prepared') _ArrayDisplay($as_heal, 'Healed') My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
huldu Posted February 28, 2006 Author Posted February 28, 2006 Hiya, got back from work! What my goal is to get all the stuff out in hopefully "seperate" arrays (or variables). For example monsters go into one array, experiance into another, dmg etc into their own array. This is to "filter" the stuff out to different files for "calculations". I only know how the perl version of this idea worked, and it did pretty much what im trying to do now. I was just a bit overcome by how advanced the scripting actually was to do string manipulation! Im gonna make a few examples below (really simple ones). I am gonna use "experiance" since its rather simple and not too advanced. [01:22:10]You get 4,516,866 experience points. (1,505,622 instance bonus) This is how the experiance looks when in the .log itself. The goal is to extract the 4,516,866 part (this can vary from 1 to a number in billion, this can never be negative). The instance bonus is of no interest. While it says instance bonus in the example a monster out in the world would have the (x camp bonus) instead of instance. The number would be saved into a variable, in this case 4,516,866. This variable would later be added with the "rest" of the experiance variables to sum up a total experiance gained. Another fancy thing i was trying to make was a check to see what the highest experiance gained was. This is pretty much what i am looking for to do with all the data in the chat.log. But just to start off easy the experiance in the above example will do great for now, i can try figure out the rest myself if i get the idea how to get the experiance to work. At the moment the code smoke has written (thank you!) is very complicated (i dont understand half what going on hehe). I hope this clears up some things. "I'm paper, rock is fine, nerf scissors!!!"
huldu Posted February 28, 2006 Author Posted February 28, 2006 (edited) #include <array.au3>$s_File = FileRead(@DesktopDir & '\chat.log'); change this to your file location$as_cast = StringRegExp($s_File, 'You cast a (.*?) Spell!', 3)$as_prep = StringRegExp($s_File, 'You prepare to perform a (.*?)!', 3)$as_heal = StringRegExp($s_File, 'You heal yourself for (.*?) hit points.', 3)_ArrayDisplay($as_cast, 'Casted')_ArrayDisplay($as_prep, 'Prepared')_ArrayDisplay($as_heal, 'Healed')This is very interesting and simple, does it work? (it kinda reminds of of how the perl variation looked like!Im gonna try see if i can get the above to work.<Edit> What does _ArrayDisplay($as_cast, 'Casted') do? </Edit> Edited February 28, 2006 by huldu "I'm paper, rock is fine, nerf scissors!!!"
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 lol... did you run it? He's more than likely looking at the entire file, placing all situations into an array, and you use that to display it. No offense, but as much time as I spent on the above, I hope it fails!! @ w0uter! j/k. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
huldu Posted February 28, 2006 Author Posted February 28, 2006 (edited) Lol the funny thing is that the above actually works! It pops everything into a messagebox, gonna see if i can solve it to writting into a file instead. This looks really great to be honest, and how simple! Im trying to figure out how to "empty" the array of information atm. For $x = 1 To UBound($as_cast) FileWriteLine($openfile, $as_cast) FileWriteLine($openfile, "Test: " & $x) Next expandcollapse popup The above doesnt actually "write" anything but an empty space. The interesting thing was that the UBound thing (got it from smokey) made up 187 lines when i ran thru chat.log. Im probably doing it all wrong, this is all so new. Edited February 28, 2006 by huldu "I'm paper, rock is fine, nerf scissors!!!" (adsbygoogle = window.adsbygoogle || []).push({}); Moderators SmOke_N Posted February 28, 2006 SmOke_N Moderators 16.3k 49 It's not what you know ... It's what you can prove! Moderators Posted February 28, 2006 Yes simple, but you are still going to run into issues... you'll be writing duplicates to the file over and over... the only thing that this does is parse (MUCH FASTER) but you should still figure a way to stick it in the original For / Next Loop I made (replacing the 1 - 12 with it maybe)... to make sure your not duplicating entries over and over. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. huldu Posted February 28, 2006 huldu Active Members 154 Author Posted February 28, 2006 (edited) Yes simple, but you are still going to run into issues... you'll be writing duplicates to the file over and over... the only thing that this does is parse (MUCH FASTER) but you should still figure a way to stick it in the original For / Next Loop I made (replacing the 1 - 12 with it maybe)... to make sure your not duplicating entries over and over.Doesnt this run thru the log just once?<edit> I dont know how to extract the information from the StringRegExp and save it tho. </edit> Edited February 28, 2006 by huldu "I'm paper, rock is fine, nerf scissors!!!" huldu Posted February 28, 2006 huldu Active Members 154 Author Posted February 28, 2006 Nvm thing i found it! For $x = 1 To UBound($as_cast) - 1 FileWriteLine($openfile, $as_cast[$x]) Next Is there something im missing here?:| "I'm paper, rock is fine, nerf scissors!!!"
Moderators SmOke_N Posted February 28, 2006 Moderators Posted February 28, 2006 Doesnt this run thru the log just once? <edit> I dont know how to extract the information from the StringRegExp and save it tho. </edit>Well it will extact it only once, if your not constantly checking it... You were close:For $x = 1 To UBound($as_cast) - 1 FileWriteLine($openfile, $as_cast[$x]) Next Of course this is assuming that $openFile is something other than the file you just read. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now