Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Sinbad
Newbie


Joined: 25 Aug 2007
Posts: 4

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net