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
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Wed Dec 29, 2004 6:02 am   

Syntax error msg
 
For one of my delay aliases I have it create a standar + alarm trigger
followed with a command line to reduce the time by .4 seconds that looks like...

#NOOP %alarm( Delay, <%eval( %eval( @delay*1000)-400)>)


It works how it should, reducing the time by 400 milliseconds. However, the < > are giving a syntax error in the editor window.

Without the < > the #NOOP line fails to work.


Suggestions, comments, questions?

Like I said, it DOES work, just the error bothers me - and with the error it won't auto align everything Very Happy
_________________
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Dec 29, 2004 6:08 am   
 
hmmm

try using
{} or () or 's instead of <>
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Wed Dec 29, 2004 7:02 am   
 
No, neither the {} or () worked. They don't force the expansion of the %eval statements like the <> do. Typically the <> do not seem to be needed, becuase usually it expands on its own fine. But used with the %alarm function it won't work without the <> - which gives the syntax error. Sad
_________________
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Wed Dec 29, 2004 8:51 am   
 
Have you tried using the double quote " instead of < and >?
Or
#Math NewDelayTime (@delay*1000)-400))
#NOOP %alarm( Delay, @NewDelayTime)
Reply with quote
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Wed Dec 29, 2004 8:57 am   
 
quotation marks did not work either. And I tried the style of #NOOP %alarm( Delay, @NewDelayTime) it will only work in the same manner #NOOP %alarm( Delay, <@NewDelayTime>)
_________________
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Wed Dec 29, 2004 10:37 am   
 
Did you try #CALL instead of #NOOP?
_________________
zMUD 7.05a
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Wed Dec 29, 2004 10:47 am   
 
I think this is a bug and it shows a possible design issue in zMUD. Zugg probably has to add handling for arguments separately each time he defines a new function so it isn't odd these things occur.

Workaround:
#exec {~#noop ~%alarm( Delay, %eval( @delay*1000-400))}
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Wed Dec 29, 2004 12:17 pm   
 
I'm not sure you actualy need the %eval, assuming @delay has an integer value stored in it.
#NOOP %alarm(Delay, ((@delay*1000)-400))
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Wed Dec 29, 2004 2:41 pm   
 
Vorax wrote:
I'm not sure you actualy need the %eval, assuming @delay has an integer value stored in it.
#NOOP %alarm(Delay, ((@delay*1000)-400))

You need the %eval because @delay is expanded to a string.

Example:
> delay = 10
> #echo @delay*10
> 10*10

zMUD seem to assume concatenation of strings as default. For commands it usually depends on the argument.

For example:
> #echo 10*10
> 10*10

but:

> #eval 10*10
> 100

and:

> #echo [10*10]
> 100

A more interesting example:

> #echo %concat( 10*10, "abc")
> 10*10abc

The above example shows that even though zMUD colourizes the 10*10 as it does with things it evaluates no evaluation will occur.

What makes zScript a bit difficult in my opinion is that different commands handle arguments differently. You can not assume that a command will expand/evaluate its argument.
Reply with quote
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Wed Dec 29, 2004 10:11 pm   
 
#exec {~#noop ~%alarm( Delay, %eval( @delay*1000-400))}

and

#CALL %alarm( Delay, %eval( %eval( @delay*1000)-400))

did not work.

#CALL %alarm( Delay, <%eval( %eval( @delay*1000)-400)>)

still gave the syntax error

Oh well, I guess it is a little flaw, and I'll just keep working with the <> and the syntax error
_________________
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Thu Dec 30, 2004 1:52 am   
 
Rorso wrote:
You need the %eval because @delay is expanded to a string.

In that case how about this?
#NOOP %alarm(Delay, ((%int(@delay)*1000)-400))
Reply with quote
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Thu Dec 30, 2004 3:50 am   
 
mmm, nope just threw that into my settings and

#NOOP %alarm(Delay, ((%int(@delay)*1000)-400))

did not cut it either. Sad
_________________
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Thu Dec 30, 2004 8:21 am   
 
Is there a possibility that you've changed some of the default settings that would affect any of these suggestions?
Or is there something else in your script that would affect it?
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Thu Dec 30, 2004 1:11 pm   
 
I decided to test these things out.
The #EXEC example above did work for me. The other examples only seemed to reset the alarm to its original time setting, seemingly to set the setTime parameter as its original value.

I set this alarm:
Code:
#ALARM "Test" +10 {#SHOW Alarm message}
#SHOW %alarm(Test)
#NOOP %alarm(Test, %eval(%eval(20*10000)-400))
#SHOW %alarm(Test)


Output was:
Code:
10000
10000
Alarm message


Then tried this:
Code:
#ALARM "Test" +10 {#SHOW Alarm message}
#SHOW %alarm(Test)
#NOOP %alarm(Test, %eval(%eval(40*10000)-400))
#SHOW %alarm(Test)


Output:
Code:
10000
10000
Alarm message
The output didn't change for this one even though I changed the 20 to 40 inside the %eval. The original time was displayed again.

Then this:
Code:
#ALARM "Test" +10 {#SHOW Alarm message}
#SHOW %alarm(Test)
#EXEC {~#NOOP ~%alarm( Test, %eval( 40*1000-400))}
#SHOW %alarm(Test)


Output:
Code:
10000
39590
Alarm message
This one did alter the time correctly.

Even this:
Code:
#ALARM "Test" +10 {#SHOW Alarm message}
#SHOW %alarm(Test)
#NOOP %alarm( Test, <%eval( %eval( 40*1000)-400)>)
#SHOW %alarm(Test)


Output:
Code:
10000
10000
Alarm message


The #EXEC method was the only one I was able to get working properly.
Reply with quote
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Thu Dec 30, 2004 10:30 pm   
 
Yes, I do have to apologize, I put in the code once again and you're correct in that the #EXEC method does work. I must've mistyped something when I tried it previously. Great work Very Happy
_________________
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