|
myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Fri Nov 04, 2005 7:56 pm
Yet another parsing names in to a lists question. |
I'm stumped and I dont even know where to start.
I get a list of names like this :
----------------------------------] Players [----------------------------------
Name1 Name2 Name3 Name4 Name5
Name6 Name7 Name8 Name9 Name10
-----------> There are Ten players <---------------------------------------
(By definition the last line also isn't set since Number words are used as well.)
There is no set fix number of spaces between each name since the layout (and hence the number of names on each line) depends on how many people are on.
What do I need to do to get each name in to a list?
Thank you kindly! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Nov 04, 2005 10:08 pm |
Try this for starters
Code: |
#TR {----------------------------------] Players [----------------------------------} {#VAR PlayerList }
#COND {(*)} { #VAR Temp %subregex( "%1", "\s+", "|"); #FORALL @Temp {#ADDITEM PlayerList %i} }
#COND {-----------> There are (*) players <--------------------------------------- } {#VAR PlayerCount %1 } |
|
|
_________________ Asati di tempari! |
|
|
|
myddrun Wanderer
Joined: 31 Mar 2005 Posts: 58
|
Posted: Sat Nov 05, 2005 8:46 am |
Thanks Tech, thats a great help!
There's a slight glitch since its only parsing the first row of names :(
I gather the fact that it uses Nineteen not 19 doesn't matter at all?
But thank! I didn't know you could do what you've suggested!
Mydd. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Nov 07, 2005 3:29 am |
Yeah.. I'm glad it helped. I didn't really test out the code, but I'm sure you can figure out the glitch. And actually as I'm typing I realized it.
Change
Code: |
#COND {(*)} { #VAR Temp %subregex( "%1", "\s+", "|"); #FORALL @Temp {#ADDITEM PlayerList %i} }
#COND {-----------> There are (*) players <--------------------------------------- } {#VAR PlayerCount %1 } |
to
Code: |
#COND {(*)} { #IF (%match(%1, "-----------> There are (*) players <--------------------------------------- ") { #VAR PlayerCount %1 } { #VAR Temp %subregex( "%1", "\s+", "|"); #FORALL @Temp {#ADDITEM PlayerList %i}; #STATE 1} |
Also untested but should do the trick.. I was only matching the line once. |
|
_________________ Asati di tempari! |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Nov 07, 2005 5:45 pm |
Code: |
#TRIGGER "WhoStart" {----------------------------------~] Players ~[----------------------------------} {#VAR PlayerList ""}
#COND {(*)} {#FORALL %subregex( "%1", "\s+", "|") {#ADDITEM Playerlist "%i"}} {manual}
#TRIGGER "WhoStop" {-----------~> There are (*) players ~<--------------------------------------- } {#VAR PlayerCount %1;#STATE WhoStart 1} |
This should work for you. |
|
|
|
|
|