A very weird bug I ran into...
I ran into a very odd bug recently. I have something like this in the main of some of the sprites in my D-Mod:
void main(void)
{
if (&story == 5) sp_script(¤t_sprite, "s1-town");
sp_brain(¤t_sprite, 16);
sp_base_walk(¤t_sprite, 560);
sp_speed(¤t_sprite, 1);
}
However, when &story is 5, it will automatically run the void talk(void) of s1-town when the screen is loaded. So I came up with this 'solution':
void main(void)
{
int &crap = 5;
(misc checking and setting of vars, will speak sometimes)
}
void talk(void)
{
if (&crap == 5)
{
&crap = 0;
return;
}
(talkandcrap)
}
But this is kind of a pain... has anybody else had this problem, or found a way to fix it? I know I could just insert the stuff from s1-town right into the original script... but it is done for a reason not evident in the scripts.
void main(void)
{
if (&story == 5) sp_script(¤t_sprite, "s1-town");
sp_brain(¤t_sprite, 16);
sp_base_walk(¤t_sprite, 560);
sp_speed(¤t_sprite, 1);
}
However, when &story is 5, it will automatically run the void talk(void) of s1-town when the screen is loaded. So I came up with this 'solution':
void main(void)
{
int &crap = 5;
(misc checking and setting of vars, will speak sometimes)
}
void talk(void)
{
if (&crap == 5)
{
&crap = 0;
return;
}
(talkandcrap)
}
But this is kind of a pain... has anybody else had this problem, or found a way to fix it? I know I could just insert the stuff from s1-town right into the original script... but it is done for a reason not evident in the scripts.