|
stark62 Wanderer
Joined: 04 Apr 2003 Posts: 94 Location: United Kingdom
|
Posted: Wed Aug 29, 2012 11:06 am
Extracting multiple info |
OK been trying all sorts of stuff and nothing really works for me
What I am trying to do is this - I get this text
Pouch #1262 contains 133 batches of Acaana, 86 batches of Ajkara, 77 batches of Akmar, 75 batches of Athanzar, 237 batches of Blackroot, 71 batches of Bukandas.
Pouch #3564 contains 138 batches of Kelventari, 143 batches of Dynallca, 120 batches of Erasmus, 233 batches of Etarka, 157 batches of Exaar, 120 batches of Grelixar.
Pouch #6469 contains 2 batches of Quarri, 19 batches of Sata, 27 batches of Siriena, 94 batches of Tyrlar, 14 batches of Kathkusa, 5 batches of Wirren.
So what i want is each herb and quantity put into a stringlist or something eg listpouch
so then hopefully it will read like
Acaana 133
Ajkara 86
Akmar 75
I tried capturing using (%d) batches of (%w) but that doesnt get all of them for some reason - then tried to make
Pouch #(%d) contains (%d) batches of (%w), (%d) batches of (%w), (%d) batches of (%w), (%d) batches of (%w), (%d) batches of (%w), (%d) batches of (%w).
Hoped this might then capture each pouch full but does not seem to
ANY IDEAS ??????? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Aug 29, 2012 12:11 pm |
{(%d) batches of (%w)}
should work if you check the repeat within line for the trigger... if not try something like...
#TR {Pouch ~#(%d) contains (*).} {
templist = %replace(%param(2), ",", "|")
#FORALL templist {
#NOOP %match(%i, "(%d) batches of (%w)", num, item)
#ADDITEM listPouch %concat(@item, " ", @num)
}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
stark62 Wanderer
Joined: 04 Apr 2003 Posts: 94 Location: United Kingdom
|
Posted: Wed Aug 29, 2012 12:36 pm |
Sorry whats the repeat within line - and where do i find it pls??
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Aug 29, 2012 3:50 pm |
it should be in the more or advanced section of the trigger within the editor, normally its below the value textbox
what it does is allow the trigger to fire for each time it matches on a given line, instead of just the first match |
|
_________________ Discord: Shalimarwildcat |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Aug 29, 2012 7:09 pm |
Wrong forum, Shalimar. This is for ZMud, not CMud.
Quote: |
I tried capturing using (%d) batches of (%w) but that doesnt get all of them for some reason
|
The reason for this is that ZMud only matches each trigger pattern once on a given line, and always in the broadest form of said pattern.
Your more explicit matching based on 6 different items in the contains list should have worked just fine, so either you made a mistake in the line being received or in the pattern you made from it. Of course, it will not match on lines with either less than 6 items or if the line contains an item that has only 1 batch instead of multiple batches. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Aug 29, 2012 10:23 pm |
repeat within line was new for CMUD? coulda swore it was old school
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
jodibecks Newbie
Joined: 20 Sep 2012 Posts: 1
|
Posted: Thu Sep 20, 2012 1:24 am |
I just knew of this feature.
|
|
|
|
stark62 Wanderer
Joined: 04 Apr 2003 Posts: 94 Location: United Kingdom
|
Posted: Thu Sep 20, 2012 1:41 am |
Thanks Matt - got it to work but like you said it only works if the full pattern is correct.
Thanks anyway as if nothing else I am slowly picking up how things logically work. |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Fri Sep 28, 2012 11:47 pm |
Hi, I gave a stab at this as it was close to what I am working on and gave me a chance to re-familiarize myself after taking a really long break.
There is probably many other ways to do this and it probably could be cleaned up and nested better.
Saying that, it does work, hope it helps
#TRIGGER {^Pouch ~#%d contains (*).} {#ADDI HH "%1";#VAR HH %replace( @HH, " batches of ", "-");#VAR HH %replace( @HH, ", ", "|");#var AH %numitems( @HH);#Loop @AH,1 {#SH %item( @HH, %i)};#VAR HH ""}
Which displays as thus:
Pouch #1262 contains 133 batches of Acaana, 86 batches of Ajkara, 77 batches of Akmar, 75 batches of Athanzar, 237 batches of Blackroot, 71 batches of Bukandas.
71-Bukandas
237-Blackroot
75-Athanzar
77-Akmar
86-Ajkara
133-Acaana
Pouch #3564 contains 138 batches of Kelventari, 143 batches of Dynallca, 120 batches of Erasmus, 233 batches of Etarka, 157 batches of Exaar, 120 batches of Grelixar.
120-Grelixar
157-Exaar
233-Etarka
120-Erasmus
143-Dynallca
138-Kelventari
Pouch #6469 contains 2 batches of Quarri, 19 batches of Sata, 27 batches of Siriena, 94 batches of Tyrlar, 14 batches of Kathkusa, 5 batches of Wirren.
5-Wirren
14-Kathkusa
94-Tyrlar
27-Siriena
19-Sata
2-Quarri |
|
_________________ megamog75
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|