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
atreus
Beginner


Joined: 22 Mar 2005
Posts: 21

PostPosted: Wed Apr 06, 2005 8:30 am   

Syntax Error in a perfectly working trigger
 
Hey peeps.

Can someone spot why this (perfectly working!) trigger is considered to have a syntax error in it and what I could do to fix the situation.

It's a spell timer and here's what it does when the spell wears off:

Pattern:

^Your eyes tickle for a second and you notice that your abnormal senses are gone.

Value:

@senses_min = %eval( @senses_time/60)
@senses_sec = %mod( @senses_time, 60)
pas Senses of a Beast down ([@senses_min]m[@senses_sec]s)
senses_time = 0
#T- senses_time

And the complaint is:

Code:

pas Senses of a Beast down ([@senses_min]m[@senses_sec]s)
                            ^ syntax error


The reason for those brackets is that I want the time output to be compact, like it is now, eg.:

Code:
Atreus [party]: Senses of a Beast down (5m29s)


What's wrong?

.atr.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Apr 06, 2005 1:22 pm   
 
A couple of issues actually. Here are the corrected commands.

senses_min = %eval( @senses_time/60)
senses_sec = %mod( @senses_time, 60)
pas Senses of a Beast down (@{senses_min}m@{senses_sec}s)
senses_time = 0
#T- senses_time

The curly brackets may or may not be the official correct way to do that, but it has always worked for me. Also notice that there is no AT symbol before the variable names in the first two lines. The even more correct way for these variable assignments would be:

#VAR senses_min {%eval( @senses_time/60)}
#VAR senses_sec {%mod( @senses_time, 60)}
...
#VAR senses_time {0}
_________________
Carabas
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Wed Apr 06, 2005 1:48 pm   
 
Technically nothing. This is a very loose script however and herein lies the "issue" if you would like to call it that.

Loose:
pas Senses of a Beast down ([@senses_min]m[@senses_sec]s)
Strict:
#SEND {pas Senses of a Beast down ([@senses_min]m[@senses_sec]s)}

They both accomplish the same thing so whats the difference? Symantically nothing *but* in your example the syntax checker has no way of knowing what you are trying to do. It sees (the syntax checker) brackets as a potential cause for concern/error. In mine, since I explicitly state this is being sent to the mud, there is no confusion and it parses correctly.

Your script can be rewritten as follows if you like:
#VAR senses_min {%eval( @senses_time/60)}
#VAR senses_sec {%mod( @senses_time, 60)}
#SEND {pas Senses of a Beast down ([@senses_min]m[@senses_sec]s)}
#VAR senses_time {0}
#T- {senses_time}
Reply with quote
atreus
Beginner


Joined: 22 Mar 2005
Posts: 21

PostPosted: Wed Apr 06, 2005 1:52 pm   
 
yes, the curly brackets seemed to clear the error messages (and the triggers still actually work Mr. Green ). Thanks.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Apr 06, 2005 1:59 pm   
 
Ahh. You know that didn't even click when I read through the script. I wondered, since the default for "allow [ ] for eval" is checked, why that would throw an error. Good job, Maelstrom.
_________________
Carabas
Reply with quote
atreus
Beginner


Joined: 22 Mar 2005
Posts: 21

PostPosted: Wed Apr 06, 2005 2:09 pm   
 
Ok, thanks both for your input. I changed the triggers to correspond with the strict syntax so there's no room for errors or confusion.

.atr.
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