sp_target() bug
Using sprite numbers for targetting:
sp_target(¤t_sprite, ##);
makes it target sp(##); -1
For example:
sp_target(¤t_sprite, 13);
actually does
sp_target(¤t_sprite, 12);
sp_target(¤t_sprite, ##);
makes it target sp(##); -1
For example:
sp_target(¤t_sprite, 13);
actually does
sp_target(¤t_sprite, 12);
Strange, I tested this and it doesn't seem to do this with me...
I tested it using this script:
void main(void)
{
int &testspr = create_sprite(544,50,0,421,2);
sp_target(¤t_sprite,&testspr);
int &difver = sp_target(¤t_sprite,-1);
say("&testspr &difver",1);
}
In my case Dink said 7 7. And when I looked at the bonca to wich this script was attached, it tried to attack the sprite I created.
Maybe it has to do with your version of Dink?
I have version 1.07 installed.
I tested it using this script:
void main(void)
{
int &testspr = create_sprite(544,50,0,421,2);
sp_target(¤t_sprite,&testspr);
int &difver = sp_target(¤t_sprite,-1);
say("&testspr &difver",1);
}
In my case Dink said 7 7. And when I looked at the bonca to wich this script was attached, it tried to attack the sprite I created.
Maybe it has to do with your version of Dink?

Even
int &target = sp(13);
sp_target(¤t_sprite, &target);
works right. But try targetting a sprite created by the editor directly, ie.
sp_target(¤t_sprite, 13);
int &target = sp(13);
sp_target(¤t_sprite, &target);
works right. But try targetting a sprite created by the editor directly, ie.
sp_target(¤t_sprite, 13);
13 is the sprite number as found in the editor, right? This is the sp_editor_num(##), or the "editor number". The sprite with "editor number" 1 will be the first sprite placed on the screen in the editor, not Dink. All script commands need "sprite numbers". Conversion is done with sp(##). Look at
int &crap = sp_editor_num(¤t_sprite);
int &trash = sp(&crap);
if (¤t_sprite == &trash)
{
say("Always says this if sprite is placed in the editor",¤t_sprite);
}
and:
int &crap = sp(13);
int &trash = sp_editor_num(&crap);
if (&trash == 13)
{
say("Always says this if sprite is placed in the editor",¤t_sprite);
}
int &crap = sp_editor_num(¤t_sprite);
int &trash = sp(&crap);
if (¤t_sprite == &trash)
{
say("Always says this if sprite is placed in the editor",¤t_sprite);
}
and:
int &crap = sp(13);
int &trash = sp_editor_num(&crap);
if (&trash == 13)
{
say("Always says this if sprite is placed in the editor",¤t_sprite);
}
