|
McGravin Beginner
Joined: 30 May 2002 Posts: 25 Location: USA
|
Posted: Fri Sep 27, 2002 10:13 pm
Help with a gagging script... |
I'm trying to write a short trigger to gag two consecutive lines of text, but only if those two lines are consecutive.
The MOO I play often returns the lines "The starship's thrusters cease to fire." followed by "The starship's thrusters begin to fire, and acceleration pulls you back slightly." Why it feels the need to do this in the middle of an autopilot flight with no course correction, I have no idea, but it gets a bit spammy.
Is there some way to tell zMUD to gag the two lines only if the second one immediately follows the first one, and not if they ever appear by themselves? I can't seem to think of a test to do so.
-McGravin
Space Station Earth MUD |
|
|
|
McGravin Beginner
Joined: 30 May 2002 Posts: 25 Location: USA
|
Posted: Fri Sep 27, 2002 10:38 pm |
Well, I did a bit of looking through the help files, and I found out the answer was obvious. In fact, I had done something like it before, for another script. I was just being stupid, methinks.
But I'm still getting a problem.
The trigger's pattern is:
^The starship's thrusters begin to fire, and acceleration pulls you back slightly.$
The value is:
#IF {%line2 =~ "The starship's thrusters cease to fire."} {#GAG; #GAG -1)
But every time I click "Save", zMUD gives me a little red "^ syntax error". Any idea why?
-McGravin
Non plaudite, modo pecuniam jacite. |
|
|
|
McGravin Beginner
Joined: 30 May 2002 Posts: 25 Location: USA
|
Posted: Fri Sep 27, 2002 10:43 pm |
Now I'm even dumber. Someone shoot me. I'm having One Of Those Days. A blonde moment, if you will.
For some unknown reason, I felt the need to close that little clause-thing (what's the zMUD technical term for a {<commands>} thing? a command block?) with a parenthesis. A PARENTHESIS! No wonder I got a syntax error.
emote is dumb.
-McGravin
Non plaudite, modo pecuniam jacite. |
|
|
|
snoogans Novice
Joined: 28 Oct 2001 Posts: 43 Location: USA
|
Posted: Fri Sep 27, 2002 11:35 pm |
quote:
#IF {%line2 =~ "The starship's thrusters cease to fire."} {#GAG; #GAG -1)
But every time I click "Save", zMUD gives me a little red "^ syntax error". Any idea why?
This line #IF {%line2 =~ "The starship's thrusters cease to fire."} {#GAG; #GAG -1)
should look like this
#IF (%line2 = ~"The starship's thrusters cease to fire.") {#GAG; #GAG -1} {} |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat Sep 28, 2002 2:56 pm |
zMUD does not require an empty {} for the else part of an #IF when there are no commands to be executed on the else part.
Kjata |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Sep 28, 2002 3:18 pm |
You could skip the #IF completely and put both lines in the trigger phrase.
#TR {The starship's thrusters cease to fire$The starship's thrusters begin to fire, and acceleration pulls you back slightly} {#GAG;#GAG -1}
LightBulb
Senior Member |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Sep 29, 2002 6:06 am |
quote:
#IF {%line2 =~ "The starship's thrusters cease to fire."} {#GAG; #GAG -1)
Be very sure you double-check your syntax as far as braces and quotes go. Not only is this the most common mistake made, but Zmud tends to eat a few braces on the sly or otherwise update the pretty-print output when you're not ready (and since it's getting parsed at that time, it naturally will produce syntax errors).
li'l shmoe of Dragon's Gate MUD |
|
|
|
|
|