Damein Posted May 25, 2020 Share Posted May 25, 2020 So I have a huge text file that is admittedly laid out perfectly for this but I can't seem to think of the best way to do it. I'm trying to manage some data and want to condense it. Example data <span class='color3'>Serpent's Small Charm of Inertia</span> (83)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 40</span><BR><span class='color3'>+3% Faster Run/Walk</span><BR><span class='color3'>+13 to Mana</span> <span class='color3'>Ruby Small Charm of Dexterity</span> (85)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 32</span><BR><span class='color3'>+2 to Dexterity</span><BR><span class='color3'>Fire Resist +11%</span> <span class='color3'> Small Charm of Inertia</span> (81)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 27</span><BR><span class='color3'>+3% Faster Run/Walk</span> <span class='color3'> Small Charm of Inertia</span> (84)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 27</span><BR><span class='color3'>+3% Faster Run/Walk</span> <span class='color3'>Fine Small Charm of Sustenance</span> (77)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 21</span><BR><span class='color3'>+2 to Maximum Damage</span><BR><span class='color3'>+19 to Attack Rating</span><BR><span class='color3'>+14 to Life</span> <span class='color3'>Bronze Small Charm of Sustenance</span> (86)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 17</span><BR><span class='color3'>+7 to Attack Rating</span><BR><span class='color3'>+15 to Life</span> <span class='color3'>Shimmering Small Charm of Dexterity</span> (79)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 25</span><BR><span class='color3'>+2 to Dexterity</span><BR><span class='color3'>All Resistances +4</span> <span class='color3'>Serpent's Small Charm of Strength</span> (86)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 40</span><BR><span class='color3'>+2 to Strength</span><BR><span class='color3'>+17 to Mana</span> <span class='color3'>Steel Small Charm of Dexterity</span> (81)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 49</span><BR><span class='color3'>+33 to Attack Rating</span><BR><span class='color3'>+2 to Dexterity</span> <span class='color3'>Bronze Small Charm of Dexterity</span> (79)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 5</span><BR><span class='color3'>+4 to Attack Rating</span><BR><span class='color3'>+1 to Dexterity</span> So first goal; Read Into Array And Split Between Each Line and then further split between each needed field, which is conveniently the same line as the StringRegExp $ReadFile = FileOpenDialog("Find Mule...", "D:\Documents\d2mr-1.14d\d2bot-with-kolbot-master\d2bot-with-kolbot-master\d2bs\kolbot\mules", "Text files (*.txt)", 4) Dim $aRecords If Not _FileReadToArray($ReadFile,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] $ArrayData = StringRegExp($aRecords[$x],"(?i)(?s)<span class='color3'>(.*?)</span>",3) Next Now I want to do one more thing that I can't think of how to do The first instance of the RegExp gives me the Title, so I can assign that something like $Title = $ArrayData[$x][0] I then need to iterate through however many more instances there are and add them together like $Field = $Field + $ArrayData[$x][xxxx] until no more fields found This is where I am stuck Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Developers Jos Posted May 25, 2020 Developers Share Posted May 25, 2020 (edited) Welcome to the AutoIt forum. Are you still new to our rules being here this long? Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team Edited May 25, 2020 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts