First of all I'd like to thank everyone for all the time and effort you have given this problem it is much appreciated, now I am not going to lie I am still trying to implement the ideas that have been suggested to see if they can be useful in the ultimate endgame of my problem. and so perhaps if I describe in a bit more detail what I am trying to do and give a real life example of the data I am working with someone may be put me on the right track. First the text file is imported as
raiddata=Import["raid1.txt", {"Text", "Lines"}];
Length[raiddata] = 151166
p.s. this is a small file.
and raiddata[[19765]] is
"[Sun Jul 22 18:18:58 2018] Rokani pierces an Arcron dread magus for 11787 points of damage."
The data contains references to an unknown number of mobs, (a computer controlled entity) neither do we know what they are called, it also contains reference to players by their avatar names also an unknown amount and unknown names. As part of the parses function we have to identify this information, though the number of players isn't too important. and associate all those players that have interacted with each mob but only by the damage they have done to it and ultimately the type of damage. Different classes have different types of spells, i.e. direct damage and DOT's (damage over time), then there are the melee players, they just stab poke and bash kind of thing. The following is a small random sample of text from the file but chosen to give some idea of what is what.
"[Sun Jul 22 18:06:55 2018] Hsishi's eyes glow with the strength of the forest.",
"[Sun Jul 22 18:06:55 2018] Khen snarls, filled with the power of the predator.",
"[Sun Jul 22 18:06:55 2018] Blackjaw`s warder's eyes glow with the strength of the forest.",
"[Sun Jul 22 18:15:17 2018] Seibas begins to cast a spell. <Crown of Roses Nimbus>",
"[Sun Jul 22 18:16:20 2018] Daktarr has been delegated Raid Main Assist.",
"[Sun Jul 22 18:16:43 2018] LOADING, PLEASE WAIT...",
"[Sun Jul 22 18:16:56 2018] Fidden slashes a sepulcher skeleton for 20105 points of damage.",
"[Sun Jul 22 18:16:56 2018] A sepulcher skeleton has been slain by Fidden!",
"[Sun Jul 22 18:16:58 2018] You have entered an area where levitation effects do not function.",
"[Sun Jul 22 18:16:59 2018] Shadisar pierces a bile golem for 1311 points of damage.",
"[Sun Jul 22 18:16:59 2018] A bile golem hits Tankpaw for 4673 points of damage.",
"[Sun Jul 22 18:16:59 2018] Khoros slashes a bile golem for 3939 points of damage.",
"[Sun Jul 22 18:16:59 2018] A bile golem has taken 111723 damage from Mesil by Decay Effect III.",
"[Sun Jul 22 18:16:59 2018] A sepulcher spectre has taken 111723 damage from Mesil by Decay Effect III.",
"[Sun Jul 22 18:16:59 2018] An elementalbone skeleton bashes Dablubb for 2254 points of damage.",
"[Sun Jul 22 18:16:59 2018] Shadisar hit a bile golem for 7695 points of non-melee damage.",
"[Sun Jul 22 18:17:03 2018] An Arcron dread magus begins to cast a spell. <Glowing Incandescence>",
"[Sun Jul 22 18:17:04 2018] Sanae bashes a sepulcher spectre for 1920 points of damage.",
"[Sun Jul 22 18:17:06 2018] Blackjaw`s warder slashes a sepulcher spectre for 4261 points of damage.",
"[Sun Jul 22 18:17:11 2018] Felrynn performs an exceptional heal! (171082)",
"[Sun Jul 22 18:17:11 2018] Felrynn hit an elementalbone skeleton for 109141 points of non-melee damage.",
"[Sun Jul 22 18:17:11 2018] Felrynn delivers a critical blast! (109141)",
"[Sun Jul 22 18:26:09 2018] Drusella Sathir smashes Mizar for 23023 points of damage."
"[Sun Jul 22 18:26:09 2018] Drusella Sathir bashes Mizar for 20343 points of damage."
"[Sun Jul 22 18:26:13 2018] Sarryn slashes Drusella Sathir for 5390 points of damage."
"[Sun Jul 22 18:26:18 2018] Drusella Sathir has taken 30358 damage from Mesil by Cytotoxic Wounds Rk. II."
"[Sun Jul 22 18:26:18 2018] Drusella Sathir has taken 90249 damage from Stevnec by Pyre of the Shadewarden Rk. III."
"[Sun Jul 22 18:26:19 2018] Wevz crushes Drusella Sathir for 10568 points of damage."
The first two lines although they don't contain parsable data they do contain two players names, names are always found immediately after the time and date stamp. The 3rd line is reference to another player but more specifically his warder (this is a pet and will do your bidding). The warder can be parsed but in the end any damage it does is added to its owner's damage. The 4th line is fairly irrelevant but it does contain reference to a spell name, line 5 and 6 are totally irrelevant. Fidden is relevant as he has done damage to a mob, the mob being "a sepulcher skeleton" and he has slain a mob. (A search for "has been slain by" identifies all mobs except maybe the one who is too hard to fight and the raid wipes, so you can't identify all mobs by the slain tack tick. Also if you look at the two lines with Fidden "a sepulcher skeleton" and "A sepulcher skeleton" are the same mob, one is capitalized as it is the first word on the line the other is not the first word, these have to be associated together, the same with the "a bile golem" and "A bile golem". A relevant line is where Khoros slashes but "A bile golem hits" is not because it is the mob doing the damage and isn't parsed. The line with "A sepulcher spectre has taken 111723 damage from Mesil by Decay Effect III.", is very relevant it contains the mob name the damage done the players name and the name of the spell used, that particular line identifies a DOT playing character and as such needs special attention because over the fight of say a Raid mob, can have up to 20 different DOT's in play at one time each doing its own damage, this needs to be kept separate and summed individually and then finally totaled together along with any other damage done that are not DOT's and their pets if they have used one. "Drusella Sathir" is mentioned because she is the Raid mob, the lesser mobs can be dealt with by a few players the named mob is a different ball game, the encounter can take upwards of 45 minutes and all 54 people in the raid, and all 54 can "wipe" i.e die within a few seconds up to now I have parsed the named with over 2.5 billion hit points. and finally if that wasn't enough the last and most important part of the parser is to calculate the DPS or damage per second, so we have to identify the time stamp when a mob is encountered first and then when it dies from that we get a time interval for that mob say 32 seconds for the lesser mobs and each person associated with that mob has done so much damage during that time so a dps can be calculated per individual, it becomes a bit harder when an individual might not have been on that encounter for the entire time, they may be part of 2 or 3 separate ones.
So as I have previously mentioned I have made an attempt to do all this with a fair modicum of success, I am still having difficulty in identifying the lines where the mob hits players, there doesn't seem to be a consistent thing to look for. My parser as it stands takes a good 10 minutes to complete this file due to the number of complete passes through the file, hence my original question about creating named lists that could be addressed by index, so on as few passes as there are mobs I can put into each list only that data relevant to the mob in question which incidentally I can do now just by creating a table of empty lists.
I do have a question, is there a way to access each line of data in the main file and compare it to say a name without using a Do loop? For example I identify the names of the mobs by this code
mobqnty =
Reap[Do[If[StringCount[raiddata[[q]], "has been slain by"] == 1,
Sow[raiddata[[q]]]], {q, 1, Length[raiddata]}]]; mobqnty =
Flatten[mobqnty[[2]], 1]; pos =
Reap[Do[p = Flatten[StringPosition[mobqnty[[q]], "has"]];
pm = StringTake[mobqnty[[q]], {28, p[[1]] - 2}];
ct = Flatten[ToCharacterCode[Characters[pm]]];
If[Count[ct, 32] >= 1 && StringCount[pm, "pet"] != 1, Sow[pm]], {q,
1, Length[mobqnty]}]]; pos = Flatten[pos[[2]]]; mobqntty =
Tally[pos];
which gives me this list.
{{"A sepulcher skeleton", 3}, {"A bile golem",
2}, {"A sepulcher spectre", 2}, {"An elementalbone skeleton",
2}, {"An Arcron lifter", 3}, {"An Arcron dread magus",
2}, {"A pyre golem", 1}, {"A Krellnakor scavenger",
3}, {"A Wulthan crusader", 2}, {"A hexbone skeleton",
1}, {"A Krellnakor enforcer", 1}, {"An Arcron delver",
1}, {"An Arcron helot", 1}, {"A Fereth appraiser",
3}, {"An Arcron firebrand", 1}, {"A Krellnakor filcher",
1}, {"A Wulthan thief", 1}, {"A bloodthirsty gnawer",
2}, {"A hexbone protector", 2}}
Where we now have the names of mobs and how many of them were in the encounter, after this I create a list of empty lists as such
nametemp = Table["{}", {i, 1, Length[mobqntty]}] (thanks to Marco who gave me this idea)
and finally
q = 1; While[q < Length[mobqntty] + 1,
nametemp[[q]] =
Reap[Do[If[StringCount[raiddata[[w]], mobqntty[[q,1]]] == 1,
Sow[raiddata[[w]]]], {w, 1, Length[raiddata]}]];
nametemp[[q]] = Flatten[nametemp[[q]][[2]]]; q++]
That is partially the data as I also have to look for the non capitalized version of the name too. At the end of this I have a list of lists the complete list called nametemp whos sub lists can be referenced by nametemp[[i]] where everything now in nametemp[[1]] contains every line that contains "A sepulcher skeleton" or "a sepulcher skeleton" that particular list is 670 lines and Drusella is 43102 lines, to complete this task to this point including reading in the file takes 10 seconds a huge improvement on my old 10 minutes. I am certain it is not good programming but I'm not a programmer by profession.
I do appologise for the length of this post.
Regards
Paul.