|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Dec 18, 2002 7:09 pm
minor trigger problems for variables |
I play on Realms of Despair and am attempting to make a trigger to brew potions.
Currently my trigger pattern is:
%1 says 'Skaphia? Will you please brew me %2 %3 ?'
%2 representing how many I wish to brew, i.e. 500 and %3 representing what I am brewing, i.e. armor.
My problem is that I am turning %3 into a variable inside the trigger, i.e. #VAR brewitem %3. This works for one word potions like armor but if I want to brew a potion like ethereal shield it only sees ethereal and then sets shield as the default. Is there a set of characters I can surround %3 with to make it accept two words for the variable? or is there and easier trigger pattern? Thanks :)
Skaphia |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Dec 18, 2002 7:29 pm |
First, you don't use %1..%n inside the tirgger's pattern. What you do is use wildcards and surround them by parenthesis, then the values matched by this wildcards is saved in %1..%n for you to access in the commands of the trigger. With this in mind, your pattern should then be:
(%w) says 'Skaphia? Will you please brew me (%d) (*) ?'
Now, to save the name of the spell that the person wants brewed you would do:
#VAR brewitem "%3"
Notice that %3 is surrounded by double quotes. zMUD still expands %3 while surrounded by double quotes, but this prevents the parser from interpreting the #VAR command incorrectly if %3 contains more than one word, which was the cause of your problem.
Kjata |
|
|
|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Dec 18, 2002 7:41 pm |
quote:
First, you don't use %1..%n inside the tirgger's pattern. What you do is use wildcards and surround them by parenthesis, then the values matched by this wildcards is saved in %1..%n for you to access in the commands of the trigger. With this in mind, your pattern should then be:
(%w) says 'Skaphia? Will you please brew me (%d) (*) ?'
Now, to save the name of the spell that the person wants brewed you would do:
#VAR brewitem "%3"
Notice that %3 is surrounded by double quotes. zMUD still expands %3 while surrounded by double quotes, but this prevents the parser from interpreting the #VAR command incorrectly if %3 contains more than one word, which was the cause of your problem.
Kjata
So what would you recommend using instead of %3? By the way if it helps I am on v5.55
Skaphia |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Dec 18, 2002 7:44 pm |
In my example I used an * in place of %3.
By the way, you should upgrade to the newest version of zMUD. In reality, I see no reason for using anything older.
Note: What I mean is that %1..%n should not be used in the pattern of the trigger. You still use it in the commands of the trigger. Try reading Introduction to Triggers in the help file for more examples.
Kjata |
|
|
|
Skaphia Beginner
Joined: 18 Dec 2002 Posts: 27 Location: USA
|
Posted: Wed Dec 18, 2002 7:57 pm |
Nods you are right about the upgrade. Changed it all around after re-reading your post. Wasn't QUITE understanding but I understand now and it works great. Thanks again.
Skaphia |
|
|
|
|
|