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
rythin
Beginner


Joined: 12 Jul 2011
Posts: 13

PostPosted: Tue Jul 12, 2011 8:26 am   

Trigger catching non-specified number of items.
 
Hi!
I'd like to prepare a trigger that will catch a non-specified amount of items from my inventory, separated by comas, and put them into separate variables, so:

You have following items in your inventory: any, amount of, items separated by, commas.

And %1=any, %2=amount of, %3, items separated by, etc.

How do I do that?

Thanks in advance,
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jul 12, 2011 12:26 pm   
 
#TRIGGER {^You have following items in your inventory: *$} {#VARIABLE items %replace(%1,",","|")}

Assuming there are no carriage returns and the items just wrap onto new lines then something like the above should be fine. You can then iterate through the string list items with a #FORALL.
_________________
Taz :)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jul 12, 2011 3:53 pm   
 
Make sure you put () around the *, otherwise the %1 will be useless and won't return anything.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jul 14, 2011 1:23 am   
 
An alternate way to do this is:

#TRIGGER {^You have following items in your inventory: (*)$} {#VARIABLE items %list(%1, ",")}
_________________
Sic itur ad astra.
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Jul 15, 2011 12:43 pm   
 
Doh, what a numpty I am missing out the capture brackets.

I also seem not to be getting my notification emails for replies :(
_________________
Taz :)
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