The Dink Network

Irritating Weird Things

May 8th 2003, 04:39 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Sorry I have to bug you guys again with one of my messages . But while creating my Evil Hero DMod, I encountered some irritating weird things (hence the title):
I've got a var called &boss. This one stores the number the boss is, because it appears and disappears, flies in the air and such... Then, I created the var &bosspoint, to store the amount of life it has. I couldn't use sp_hitpoints() beacause, well, this guy appears and disappears. But it seems that, when I want something to say the value of &bosspoint it says in fact 3point (&boss was 3). It cost me a while to figure that out! Irritating, and weird...
And then this: if you make a goto-loop, it will hang if you don't wait() a bit. Dang!!
The last thing: in the cave I'm creating, Dink will warp from map to map, to make sure he couldn't visit a specific place before he hits all buttons. This script doesn't work if you don't wait() in it's main(). You'll then see the screen he really is, and after some time, the screen he goes to. Weird. (Oh, instead of a wait(1), I used a fade_up() without a fade_down() it costs less time.)
Does someone know what's going on here???
PS. My entry will be very Zelda-like. I'm currently freaking on the Wind Waker.
May 8th 2003, 06:32 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
You've stumbled upon the Dink's variable name bug. Try calling &bosspoint something else, like &hp_boss. The problem only happens when a variable name starts with an existing variable, like your &bosspoint and &boss.

Is it a base script? Base scripts (which are attached to screens) don't display anything until you 'wait'.
May 8th 2003, 08:44 AM
sob_scorpy.gif
Tyrsis
Peasant She/Her Russia
 
Are &boss and &bosspoint both global?
May 8th 2003, 09:06 AM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
Tyrsis, I believe that does not matter, that bug will still occur, and it is a rather annoying one...Seth should die.
May 8th 2003, 10:16 AM
sob_scorpy.gif
Tyrsis
Peasant She/Her Russia
 
But it does matter. If &boss is global and &bosspoints is not, you have this glitch. Just make them both global - and it's OK
May 8th 2003, 11:07 AM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
Negatory, that wotn work, the a varible can not start with the name of another varible, it causes the dink engine to go wack.
May 8th 2003, 01:55 PM
custom_odd.gif
You don't need a global tho, because if dink is still on the screen, you can store it in the enemy script... In fact, you should be able to use the regular hp

How do you have him disapear?

Why don't you just use sp_nodraw or even easier, just move him offscreen and freeze him, then move him back on when you want him to reapear... you would just use the regular hp that way.
May 9th 2003, 12:11 AM
sob_scorpy.gif
Tyrsis
Peasant She/Her Russia
 
&magic, &magiclevel
May 9th 2003, 06:51 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
The only reason why &magic_level is immune from the bug is because it is created before &magic, not because it is a global. If you created a new global variable called &magic_fun after you created &magic, the bug would be quite evident.
May 9th 2003, 07:16 AM
sob_scorpy.gif
Tyrsis
Peasant She/Her Russia
 
In the original dink &magic is created before &magic_level and &magic_cost, and &lifemax before &life.
To be free from this bug they should be either both local or both global
May 9th 2003, 11:21 AM
wizardg.gif
Paul
Peasant He/Him United States
 
At the moment that doesn't matter though, magicman just needs to rename one of them.
May 9th 2003, 02:29 PM
knightg.gif
WC
Peasant He/Him United States
Destroying noobs since 1999. 
The reason why the &magic baribles are fine is because they are in the hard code of the dink engine.
May 9th 2003, 04:57 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
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.
May 10th 2003, 01:39 PM
sob_scorpy.gif
Tyrsis
Peasant She/Her Russia
 
I tested it too. You are right: the order is the most important. The variable with the longer name should be created first. But if &m is created before &m1, they work OK in calculations, it's just say() and debug() show wrong results.
May 18th 2003, 10:47 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Ah thanks for all your help. Sorry though to be a bit late, I was for a week to Rome. Oh, well, back to normal life I guess.