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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
fumi
Beginner


Joined: 27 May 2015
Posts: 10

PostPosted: Fri Oct 02, 2015 10:51 am   

How do I extract list item in a %b{@stringlist}%b trigger
 
I have figured out how to trigger on a string list item. Now I would like to utilize the specific list item that triggered. For example
stringlist: monster1 | monster2 | monster3

#TRIGGER {%b{@stringlist}%b} {kill monster#}

If monster 3 triggered, I would now like to execute "kill monster3"

Can anyone shed some light on this please? Thanks
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Fri Oct 02, 2015 6:00 pm   
 
Just use parenthesis to turn it into an anonymous variable

#TR {%b({@stringlist})%b} {kill %1)
_________________
Discord: Shalimarwildcat
Reply with quote
fumi
Beginner


Joined: 27 May 2015
Posts: 10

PostPosted: Sat Oct 03, 2015 3:47 pm   
 
Thanks for the response!
I just tried it with parenthesis, and the trigger is no longer firing. Is there anything else I can try? I am running CMUD latest version.
Reply with quote
fumi
Beginner


Joined: 27 May 2015
Posts: 10

PostPosted: Sat Oct 03, 2015 3:59 pm   
 
Just tried changing the location of parenthesis, and it WORKED!
This is what works for me
#TRIG {(%b{@list}%b)} {kill %1}

I can't believe it finally works. This has been something I've struggled with for a long time. Thank you so much for your insight shalimar!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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