|
snoogans Novice
Joined: 28 Oct 2001 Posts: 43 Location: USA
|
Posted: Tue Sep 17, 2002 10:06 am
Having problems with a script ... |
Okay I have this script that i want to use to make leveling a bit less tedious :) Here it goes ...
In a class called 'crocs' i have this trigger ...
Pattern: A sneaky crocodile who is %1 to the %2.
Action:
#t- crocs2
#col 12
#if (%1 = right here) {
#var moves 1
crocoff
} {}
#if (%1 = close by) {
#var moves 2
crocoff
} {}
#if (%1 = not far off) {
#var moves 3
crocoff
} {}
#if (%1 = a brief walk away) {
#var moves 4
crocoff
} {}
#if (%1 = rather far off) {
#var moves 5
crocoff
} {}
#if (%1 = off in the distance) {
#var moves 6
crocoff
} {}
crocoff is an alias to turn the class off
The line the game sends that this is supossed to trigger off of is ...
A sneaky crocodile who is not far off to the northwest.
"not far off" is replaced with one of 6 phrases and i want it to set @moves to a number storing how many times i have to move in a certain direction, I have another trigger that sets which direction i need to go the exact same way and its working fine. Problem is @moves allways equals 6, and i cant figure out why. If anyone can explain it to me i would appreciate it :) |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Sep 17, 2002 12:56 pm |
First, you should know that %1..%n should not be used inside a trigger pattern. You mya get unexpected results from doing this. Instead, you use the wildcards mentioned in the help file. In your case, the pattern would be:
A sneaky crocodile who is (*) to the (%w).
Each wildcard that you enclose in parenthesis is saved to one of the %n variables. In this case, whatever was matched by * is saved to %1 and whatever was matched by %w is saved to %2.
Having explained that, lets get to your problem. What happens is that %1 contains multiple words and so does the string that you are comparing it to in the #IF. When this happens, zMUD gets confused. To avoid this, enclose the string and %1 in double quotes:
#IF ("%1" = "right here") {...} {}
and so on for the others.
Kjata |
|
|
|
|
|
|
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
|
|