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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Thu Apr 30, 2009 7:46 pm   

Local Varible parsing/syntax error
 
Code:
<alias name="test" id="739">
  <value>#print
#local $startt,$endt,$count
$val = 1
#print "val is" $val
#if ($val) {#print declared} {#print not declared}</value>
</alias>


Ctrl+K, gives no error

run the alias, notice that no value is printed, and the if statement shows that $val is not declared as a local variable.

On the first line, add space between comma and next local var, or replace with space, run alias again, 1 is displayed and is noticed as a declared variable.

Ctrl+k no error

#local delcared local varibles do work with and with out space
Unknown if this was pre 3.06, just noticed this in current test script writing.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4782
Location: Pensacola, FL, USA

PostPosted: Thu Apr 30, 2009 8:08 pm   
 
you shouldn't be declaring a localvar that isn't used in the first place

I can confirm this behavior however.

Also, the help file has no mention of using commas, so it could just be a matter of improper syntax
_________________
Discord server
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Thu Apr 30, 2009 8:16 pm   
 
Yeah, not sure where i picked up using commas in there.

And I found this in a script where I was using all of the #local declared variables, and then about a page down assigned a value to a local variable i hadn't declared with #local, and couldn't see both lines....
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri May 01, 2009 5:18 pm   
 
The problem is with the commas. Remember that the general syntax for ALL #commands in CMUD (and zMUD) is that the arguments for the command are separated by SPACES. So the correct syntax is:

#LOCAL $startt $endt $count

without any commas. I'm not sure why using the commas didn't flag any syntax error, but I'll look into that.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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