 |
crycry Apprentice

Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: 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
_________________ |
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: 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... ;) |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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 |
|
|
 |
crycry Apprentice

Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: 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 |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Dec 07, 2006 12:40 pm |
Beaten by Guinn's older but also-working method :(
|
|
|
|
 |
crycry Apprentice

Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: 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
_________________ |
|
|
 |
|
|
|