 |
narl Newbie
Joined: 19 Feb 2010 Posts: 1
|
Posted: Fri Feb 19, 2010 11:20 am
Using trigger defined variables to access stored variable list strings |
Hi Guys,
I'm having a look at converting from zmud to cmud and am having a problem.
I have a trigger: ~"* (%a)~"*Type: &%wtype * Sips: &%dsips~.
Where variables are something like %1 = potion42325 %2=immunity %3=32
In zmud I was using this as the trigger script:
#additem %2 %1
#delitem potsmissing %2
#if (%numitems( @%2)>1) {
put %pop( %2) in sack
#additem inpack%2 %1
} {#va sips%2 %3 EMPTY potions|sorting}
Where %numitems(@%2) would return the number of stored potions of that type. Eg it would look at the string lists @immunity or @health depending on the result of the trigger. Where as no matter what in cmud a 1 is always returned.
It's definately to do with CMUD not being able to recognise @%2 as the actual variable @immunity
Any ideas how to go about it in cmud?
Regards
Narly |
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Feb 19, 2010 3:19 pm |
Probably all you need is braces: "@{%2}". Zmud was not as rigorous as Cmud about dealing with ambiguous structures like this. Even under Zmud, using braces was the proper method, but it allowed a lot of things that really were poor design.
I'm curious why you are using the & construction in your trigger pattern to create the variables @type and @sips when you are using %2 and %3 in your trigger value and ignoring the variable names you specified in the pattern? Are you even using the @type and @sips anywhere else? |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sun Feb 21, 2010 3:41 am |
What does the actual message from the MUD look like? Why do you have * throughout your trigger pattern?
|
|
|
 |
|
|