|
forren Novice
Joined: 26 Apr 2007 Posts: 44
|
Posted: Thu Oct 04, 2007 12:05 pm
Parsing a list of names |
Alright. I'm trying to parse the following and add each name to a list:
Enemies of the Righteous Principality of New Celest:
Ildryn, Kotai, Nikua, Visaeris, Razyx, Leilani, Kaelar, Tehn, Isuka, Ethelon, Osai, Drago, Felemar, Ellara, Caelthalas, Sudoxe, Bossa, Kerigor, Kell, Yukari, Divayth, Erion, Ixion, Olan, Alamander, Vathael, Yuniko, Yuya, Brona, Silvanus, Vilya, Thoros, Xanders, Torvak, Helion, Plyn, Laquatus, Strakc, Ravin, Davrick, Varor, Polgara, Gwilym, Faerdon, Adria, Ashlin, Zalana, Yeshaya, Destin, Iaknek, Weylin, Thul, Vauraugli, Telrath, Ensua, Escalia, Saladin, Shoki, Veonira, Mortakai, Orti, Kaithe, Tsai, Aajen, Loyen, Graal, Murphy, Raizan, Kharvik, Tuek, Nepthysia, Theodast, Veinor, Ceran, Vyr, Daevos, Chade, Rexali, Volgrant, Marlucia,
The names go on, until the last entry is just the name with no punctuation.
I want to have a trigger capture each of these names. When I create them, it only captures the first name per line that the server sends (one if I'm using wrapwidth 0, multiple on wrapwidth 250). How can I cause the trigger to keep going and capture every name on every line? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Oct 04, 2007 1:17 pm |
I do this something like this:
#trig {Enemies of the Righteous Principality of New Celest:} {#t+ EnemyCap;#var EnemyList ""}
#cond {Some line that ends the list, possibly prompt} {#t- EnemyCap}
#regex "EnemyCap" {^(\w+, )+} {#forall %replace(%line,", ","|") {#additem EnemyList %i}}
You could maybe just concat the %replaced string, but that method's more foolproof.
For no wordwrap, it's even easier:
#trig {Enemies of the Righteous Principality of New Celest:} {#t+ EnemyCap;#var EnemyList ""}
#cond {^*$} {#forall %replace(%line,", ","|") {#additem EnemyList %i}}
This one you could probably do #var Enemylist %replace(blah) but I know this method will work. |
|
|
|
|
|
|
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
|
|