|
rythin Beginner
Joined: 12 Jul 2011 Posts: 13
|
Posted: 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, |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: 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 :) |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Jul 12, 2011 3:53 pm |
Make sure you put () around the *, otherwise the %1 will be useless and won't return anything.
|
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: 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. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: 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 :) |
|
|
|
|
|