|
Sinbad Newbie
Joined: 25 Aug 2007 Posts: 4
|
Posted: Sun Apr 27, 2008 9:45 am
Capture first word of each new line into a list |
I've been browsing around and cant see a complete solution to this. Tried cobbling together bits from other peoples but the problem is the first line.
Basically i have a command to check my inventory. I send the command and the list of items starts without any intro text I can trigger on like this:
Wand121497; a magical wand.
Sword121499; a silver sword.
potion121; a clear potion.
etc etc
At the end of the list I get the text: 'Thus 14 items protected with ....' Which I can trigger on to end the capture.
My problem is I cant figure out how to start the capture and get the first word only (up to the ;) of each line into a list variable. Becuase theres no text at the start I cant fire it on that and secondly Im not getting the syntax right for the word that precedes ;
TIA |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 27, 2008 10:07 am |
You can use [%w%d] to capture the word at the start, matching letters and numbers. You can start the capture by using an oninput trigger, something like:
#oninput {^inv} {#t+ itemcap}
#cond {Thus %d items protected with} {#t- itemcap}
#trig itemcap {^([%w%d]); a*.} {do whatever} "" {disable} |
|
|
|
|
|