|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sat Oct 14, 2006 12:28 pm
[1.10] Variable with no value - Error compiling script |
Within the settings editor, if I create a new variable, type Integer, and give it a value of 1, then the compiled code is
Code: |
0000 LINE 0 ; 1
0012 INT 1 |
If I then delete the value the compiled code is
Code: |
Error compiling script: |
Just thinking this might cause problems later if variables without a value can't be compiled correctly? |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Riesz Novice
Joined: 16 May 2006 Posts: 35 Location: Plymouth, England
|
Posted: Sat Oct 14, 2006 1:35 pm |
In earlier versions of CMud (1.03ish), I caused an error that used #if (@variable) when @variable didn't exist. Using it like that was a handy shortcut for checking for non-zero/non-null/nonexistant variables. I don't know about later versions though, but it might have something to do with what you said.
|
|
_________________ Elaria, Lusternia. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sat Oct 14, 2006 2:11 pm |
This problem also occurs with some of the other variable types.
Empty values in these variable types show the same error.
AutoType
Integer
String (expanded)
Array
Float
COM Object
String (literal), appears to be the only one working that gives us the ability to look at the compiled code. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Oct 14, 2006 5:22 pm |
This isn't necessarily a problem. The compiler/parser already handles the case where a variable can't compile. In those cases, the value of the variable is used directly without any code. The problem is that the Code view in the settings editor shows the error. I just need to change the error message. It shouldn't be effecting your scripts. If the variable doesn't have a value, then a null value is used when the variable is accessed.
|
|
|
|
|
|