ID:105245
 
Not a bug
BYOND Version:479
Operating System:Windows Vista Home Premium 64-bit
Web Browser:Chrome 8.0.552.210
Applies to:Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
See title.

Numbered Steps to Reproduce Problem:
1. Copy code below
2. Paste code below into Dream Maker
3. Compile

Code Snippet (if applicable) to Reproduce Problem:
box
var
width = world.icon_size // First error
height = world.icon_size

mob
verb
// Note that I am not actually trying to change icon_size at runtime, this is just to bring up the error.
change_icon_size(n as num)
world.icon_size = n // Second error


Expected Results:
Second error still shows up, but the first does not.

Actual Results:
Both errors show up. This is strange because in the first error it's saying world.icon_size isn't constant, and in the second error it's saying it is constant.

Does the problem occur:
Every time? Or how often? Every time
In other games? N/A
In other user accounts? Sure
On other computers? Yes

When does the problem NOT occur?
N/A
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
The version world.icon_size was first added does this, as it does now.

Workarounds:
Declare a new /const var and use that in setting world/icon_size at compile time, and also use it in the width and height variables.

That's for if you ignored my other post because it didn't have the template yet provided the same information.
Did you delete your other report? Because that report had more information and identified a minor issue that was actually a bug, while what you're reporting here is incorrect. world.icon_size is a constant variable.

Besides, if you were missing any info in the first report you're missing even more now. Your code has references to first and second errors, but you did not specify what those errors were.

Just to be clear, deleting an issue and reposting it in a similar form is abuse of the bug tracker. I'm not that keen on bumping by comment but it's understandable. This however makes it difficult to keep track of what's current and what's not. In the future please do not delete and repost your bug reports.
The errors were
error: =: expected a constant expression
error: world.icon_size: cannot change constant value
This isn't a bug, but I can see how it could be perceived as such. A constant var isn't the same thing as a #define macro, because it is initialized and may not actually exist at the point in time that you want to use it. Technically, world vars are global and really should be accessible at any time, but DM treats them just like other object vars. You should initialize new vars in the datum's new proc, as such:
box
var
width
height
New()
width = world.icon_size
height = world.icon_size

The other error is due to the fact that world.icon_size is a constant so once initialized, it can't be changed.