|
nostra Wanderer
Joined: 23 May 2001 Posts: 68 Location: Sweden
|
Posted: Thu Jun 10, 2004 5:59 am
Extracting a phrase from a line |
Well, this could be simple -- but I guess it's not.
I want to extract a spell from a list and add it to my stringlist. Problem is that some "spells" are one-word and others are two-word. See example below:
Spell: detect invisibility - Level 200
Spell: pass door - Level 144
Spell: improved invisibility - Level 241
Spell: armor - Level 90
Right now I only manage to extract the first word (detect, pass, improved, armor). Any ideas how to get both words?
Current trigger
Pattern: ^Spell:%s(*)%s-%sLevel
Value: #additem list_currentspells %1
ps, I thought exchangning the "standard" %w for a * (wildcard) would capture everything, but it doesn't, which strikes me as quite odd, ds. |
|
|
|
nostra Wanderer
Joined: 23 May 2001 Posts: 68 Location: Sweden
|
Posted: Thu Jun 10, 2004 6:06 am |
Well, I got a working solution - but it's not beatiful so if anyone else got something neater feel free to post it [:p]
Pattern: ^Spell:%s(%w) (%w)%s-%sLevel
Value: #additem list_currentspells {%1 %2} |
|
|
|
Serentus Apprentice
Joined: 28 Sep 2001 Posts: 103 Location: USA
|
Posted: Thu Jun 10, 2004 8:43 am |
The (*) was capturing both words. The reason it only added the first word was that it expands to:
#additem list_currentspells detect invisiblity
So it only sees detect. You could still use the (*) int the trigger and the patern would be
#additem list_currentspells {%1}
the {} causes it to be treated as one parameter. |
|
|
|
|
|