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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Fri Apr 09, 2010 7:11 am   

%eval & alias names? what the....
 
#ALIAS 120 {wd 1234567}

wields my 120 weapon...

#show |%eval(135-16)| |%eval(135-15)| |%eval(135-14)| --> |119| || |121|

#UNALIAS 120

#show |%eval(135-16)| |%eval(135-15)| |%eval(135-14)| --> |119| |120| |121|

what the?!?!

ive had similar aliases since zMud 2.0


Last edited by Private on Fri Apr 09, 2010 9:10 am; edited 1 time in total
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Apr 09, 2010 8:17 am   
 
See here: http://forums.zuggsoft.com/forums/viewtopic.php?t=29537&highlight=eval

Charneus
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Fri Apr 09, 2010 9:09 am   
 
heh, Posted: 08 Jan 2008 22:44... and STILL a bug... nice

%eval should NOT parse alias names!

>#ALIAS foo {bar}
>#SHOW %eval(foo)

no output

>#UNALIAS foo
>#SHOW %eval(foo)

foo

it aint only with numbered aliases
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Apr 09, 2010 9:28 am   
 
Heh.

Zugg wrote:
The numerical aliases issue isn't going to get fixed anytime soon because you are not supposed to use numeric aliases in the first place.


from:

http://forums.zuggsoft.com/forums/viewtopic.php?p=154878

Either way, an alias with numbers starting it will not get fixed.

Charneus
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Apr 09, 2010 1:13 pm   
 
From the help page for %eval:
Quote:
NB: Do not use this function unless you're sure you have to. While it was used very often in zMUD, most of its uses have been deprecated in CMUD. In CMUD, evaluating an expression is as simple as surrounding it in brackets.

Use of this function is inadvisable because its argument is treated as a string and only compiled at runtime, which is slower than simply using brackets.

In other words, just use (135-16) instead of %eval(135-16)
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Apr 09, 2010 3:18 pm   
 
zMUD was never intended to allow numeric alias names either. It was actually a bug in zMUD. For compatibility, CMUD has some limited support for aliases that start with or contain numbers, but they will only work from the command line and not from within scripts.

And yes, as Rahab said, you should be getting rid of most of your %eval calls in CMUD. They are no longer needed.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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