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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Skaphia
Beginner


Joined: 18 Dec 2002
Posts: 27
Location: USA

PostPosted: 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
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: 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
Reply with quote
Skaphia
Beginner


Joined: 18 Dec 2002
Posts: 27
Location: USA

PostPosted: 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
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: 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
Reply with quote
Skaphia
Beginner


Joined: 18 Dec 2002
Posts: 27
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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