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
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Thu Jun 17, 2010 5:23 am   

[3.19f] BUG: #add wonkiness
 
I'm sure there's a better description than wonkiness, but #add doesn't work in the following script.

Code:
#unvar testvar
#5 {
  #add testvar 10
  #print {Testvar: @testvar}
  }


output:
Quote:
Testvar: 10
Testvar: 1010
Testvar: 101010
Testvar: 10101010
Testvar: 1010101010
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Jun 17, 2010 5:47 am   
 
The reason seems to be that when you don't have a variable, it creates it as a string by default. Therefore, it sees 10 as a string instead of an integer, and 'appropriately' adds (concatenates, actually) the new value.

If you do:

Code:
testvar=0
#5 {#ADD testvar 10;#PRINT {Testvar: @testvar}}


it properly returns:
Code:
Testvar: 10
Testvar: 20
Testvar: 30
Testvar: 40
Testvar: 50


Charneus
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jun 17, 2010 4:34 pm   
 
Yeah, but the bug is valid. When a variable doesn't exist, it is actually supposed to default to Auto type, and when it is first used it should see the 10 and use the numeric version. So something has happened to the Autotype code. Added to bug list.
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