Windemere variable thing
The following is based on my probably flawed understanding of the Dink engine:
One of the good (bad) things about dink is that, basically, only one script runs at a time. This means that you can have globals like ¤t_sprite and &missile_target, because for example, when an arrow hits something, and its damage proc is run, there are no other damage procs running at that exact instant, so &missile_target is well defined...
If multiple scripts were running at once, then you'd have a problem... I suppose &missile_target could several values simultaneously, differentiated only by context, but then it'd hardly be a global...
So, does Windemere run scripts simultaneously? If not, do ¤t_sprite, &enemy_sprite, &missile_target, etc. stay? Or will they be replaced by something more stable?
One of the good (bad) things about dink is that, basically, only one script runs at a time. This means that you can have globals like ¤t_sprite and &missile_target, because for example, when an arrow hits something, and its damage proc is run, there are no other damage procs running at that exact instant, so &missile_target is well defined...
If multiple scripts were running at once, then you'd have a problem... I suppose &missile_target could several values simultaneously, differentiated only by context, but then it'd hardly be a global...
So, does Windemere run scripts simultaneously? If not, do ¤t_sprite, &enemy_sprite, &missile_target, etc. stay? Or will they be replaced by something more stable?
Well, the Dink engine is capable of running more than one script at the same time. If you have two sprites with the same script attached and you'll let them say something (so they'll both do it), both sprites talk so ¤t_sprite works like it should. Same thing when spawn()-ing a script, it'll run simultaneously as the script it was spawned from. Like you can see in redink1's Savegame Editor; a variable has a variable-name but also a scope: the scope is either 0 meaning a global variable or the number of the script that uses it. Same thing applies to the global ones I think. I haven't tested a script that fires two arrows when Dink fires (you'd also have to set the same distance to both target sprites and so on) but I don't think it'll cause trouble for the variables involved.. but it would have to be tested to be sure.
If the scripts ran at exactly the same time, wouldn't only one talk? I mean, ¤t_sprite can only have one value at any given moment, and I'd assume that's the value of the sprite whose script is running.
Milo: I'm pretty sure those will be completely gone.
I think ¤t_sprite, &enemy_sprite, &missile_target are special variables. They're not real globals, so they'll work in whatever script calls them.
Simeon: Sort of. Dink isn't multi-threaded, so it can really only run one script at an exact instant. It runs one script and then the other in such a quick succession that you don't realize it.
If you do no-wait-infinite-loop, the game locks up, because it is devoting itself to running that one script until it gets to a wait or the end of the script function.
As it is, variable scoping in the Dink engine is not reliable. Try something like this:
void main(void)
{
int &rand = random(1,100);
say("&rand", ¤t_sprite);
}
And attach it to multiple sprites on the same screen. They'll all say the same number (... I think).
I think ¤t_sprite, &enemy_sprite, &missile_target are special variables. They're not real globals, so they'll work in whatever script calls them.
Simeon: Sort of. Dink isn't multi-threaded, so it can really only run one script at an exact instant. It runs one script and then the other in such a quick succession that you don't realize it.
If you do no-wait-infinite-loop, the game locks up, because it is devoting itself to running that one script until it gets to a wait or the end of the script function.
As it is, variable scoping in the Dink engine is not reliable. Try something like this:
void main(void)
{
int &rand = random(1,100);
say("&rand", ¤t_sprite);
}
And attach it to multiple sprites on the same screen. They'll all say the same number (... I think).
void main(void)
{
int &rand = random(1,100);
say("&rand", ¤t_sprite);
}
The last few posts. Saying isn't affected, speed etc is.
{
int &rand = random(1,100);
say("&rand", ¤t_sprite);
}
The last few posts. Saying isn't affected, speed etc is.
I did (almost) exactly that experiment once, and it does exchange variables, which has never made sense to me.
I see what your saying... ¤t_sprite isn't declared in main.c. The others are though, which explains why Seth is paranoid about them (in the missile scripts he likes to assign &missile_target to a local.)
I had just guessed that they all really existed, so that &missile_target still has a value even when there's no damage proc running. But I could be totally wrong, I should test it...
I see what your saying... ¤t_sprite isn't declared in main.c. The others are though, which explains why Seth is paranoid about them (in the missile scripts he likes to assign &missile_target to a local.)
I had just guessed that they all really existed, so that &missile_target still has a value even when there's no damage proc running. But I could be totally wrong, I should test it...
They say it's a duck-worshipping village in the original game...
i looked at one of the screenshots, with dink and another guy standing, but it wasn't a screen! (as i saw it...)
will dink still have screens?
and is it possible to make movies in your D-mod?
will dink still have screens?
and is it possible to make movies in your D-mod?
That's the wrong URL. I should probably take that site down. :-/
The new site's over here: http://windemere.dinkworld.com/
The new site's over here: http://windemere.dinkworld.com/