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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
crycry
Apprentice


Joined: 24 Jun 2006
Posts: 169
Location: UK - South Coast

PostPosted: Thu Dec 07, 2006 12:06 pm   

trigger help needed
 
Im trying to capture a list of names into as a string into a variable, any my brains melting trying to think of a way to do this. The problem is, that its the line AFTER the trigger line.

Quote:
Your friends list is:
wotan fley mathonwy arika thangor evermoore legolas cking athos cloudstrife tali var sylphs tonith shimmer tiana entropy corellon korg umbra ishana diluted tiax ivy aurican starscream flibbity quakor sharen shotzi tryxx lancet marzo rest syhria empty avio common


so, i want to trigger from the pattern, 'Your friends list is:' and capture the list after, which is a wrapped single line.

Any clues? Im guessing a multistate trigger, but Im having serious trouble getting my head around them.
_________________
'Life is what happens, when your too busy doing something else'

_________________

XP Pro SP2
cMud 1.24
_________________
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Dec 07, 2006 12:35 pm   
 
#TRIGGER {^Your friends list is:$(*)$} {friendList = %replace(%1, " ", "|")}

should put it into a string list
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Dec 07, 2006 12:38 pm   
 
#trig {^Your friends list is~:}
#cond {($friendlist:*)$} {#var FriendList %replace($friendlist," ",|)} {Within|param=1}

Will result in the variable FriendList containing a stringlist of all those friends. You could also do #forall %replace() {} if you want to do something for each friend.

Multistate triggers work so that the second state will only fire after the first state, and then the first state will only fire once the second state's fired. So they'll only go in 1-2-1-2-1-2 order (or 1-2-3-1-2-3 or whatever). In addition, the second state of this trigger has the Within option, and the parameter is 1 - this means that the state will only be active within one line of the first state firing. If the pattern still hasn't been recieved by the time another line arrives, it'll move onto the next state (which is the first one) without executing anything.


Last edited by Fang Xianfu on Thu Dec 07, 2006 12:41 pm; edited 2 times in total
Reply with quote
crycry
Apprentice


Joined: 24 Jun 2006
Posts: 169
Location: UK - South Coast

PostPosted: Thu Dec 07, 2006 12:39 pm   
 
thats amazingly cool, thanks Guinn and Fang
_________________
'Life is what happens, when your too busy doing something else'

_________________

XP Pro SP2
cMud 1.24
_________________

Last edited by crycry on Thu Dec 07, 2006 12:42 pm; edited 1 time in total
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Dec 07, 2006 12:40 pm   
 
Beaten by Guinn's older but also-working method :(
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
crycry
Apprentice


Joined: 24 Jun 2006
Posts: 169
Location: UK - South Coast

PostPosted: Thu Dec 07, 2006 12:43 pm   
 
lol thanks though Fang, and thanks for the explanation too :)
_________________
'Life is what happens, when your too busy doing something else'

_________________

XP Pro SP2
cMud 1.24
_________________
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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