Reply to Re: Irritating Weird Things
If you don't have an account, just leave the password field blank.
Hrm... I was looking at the main.c of my current D-Mod, where &magic was after &magic_level and &magic_cost... I must have simply switched the order a while ago to prevent disaster.
Though after doing some testing, I must assure you that I'm correct The global-ness or local-ness has little factor in the variable name bug (nor are the required variables exempt as WC suggested): the primary factor is when the variable was created.
*Test 1*
I changed the script for the table in Dink's first room to _magic.c. In it, I had say("&magic_level",1); in the main procedure. Upon starting the game, Dink says "0_level" before the cutscene. To make sure, I exited and re-entered, and Dink still said "0_level". Both &magic and &magic_level are global, and they suffer from the variable name bug.
*Explanation*
So how does &magic_level and &magic_cost work without interference from &magic? Quite simply, the variable name problem is not a problem with assignment operations, but most other operations (comparable, say, etc).
I think with my work on FIAT, I couldn't get if (&magic_level > 5) to work. So all I had to do was initialize a temporary variable to the value of &magic_level, and do all comparisons and such from there. &temp = &magic_level; works fine, and so does &magic_level = 4; and so on. And, most &magic_level and &magic_cost code is done within the Dink engine itself, so DinkC can't screw it up too much.
Though after doing some testing, I must assure you that I'm correct The global-ness or local-ness has little factor in the variable name bug (nor are the required variables exempt as WC suggested): the primary factor is when the variable was created.
*Test 1*
I changed the script for the table in Dink's first room to _magic.c. In it, I had say("&magic_level",1); in the main procedure. Upon starting the game, Dink says "0_level" before the cutscene. To make sure, I exited and re-entered, and Dink still said "0_level". Both &magic and &magic_level are global, and they suffer from the variable name bug.
*Explanation*
So how does &magic_level and &magic_cost work without interference from &magic? Quite simply, the variable name problem is not a problem with assignment operations, but most other operations (comparable, say, etc).
I think with my work on FIAT, I couldn't get if (&magic_level > 5) to work. So all I had to do was initialize a temporary variable to the value of &magic_level, and do all comparisons and such from there. &temp = &magic_level; works fine, and so does &magic_level = 4; and so on. And, most &magic_level and &magic_cost code is done within the Dink engine itself, so DinkC can't screw it up too much.