Reply to scripting trouble (2)
If you don't have an account, just leave the password field blank.
Here's a new script. I'm pretty sure this isn't another dumb mistake. This script is supposed to create a sprite, &barr, but it doesn't. I've tested over and over and it seems the x, y cords get screwed up. I've tried reverting them back to Dink's x and y right before the create_sprite command, but that still doesn't work. If it helps, the x cord ends up being 998, and the y cord ends up being 999.
Note: &bar_var; and &check_vars; are globals.
Problem solved, external error, doh!
void main( void )
{
freeze(1);
if (sp_dir(1, -1) == 1) sp_dir(1, 2);
if (sp_dir(1, -1) == 3) sp_dir(1, 2);
if (sp_dir(1, -1) == 7) sp_dir(1, 8);
if (sp_dir(1, -1) == 9) sp_dir(1, 8);
int &xxx = sp_x(1, -1);
int &yyy = sp_y(1, -1);
if (sp_dir(1, -1) == 2) { &xxx -= 1; &yyy += 19; } if (sp_dir(1, -1) == 4) { &xxx -= 28; &yyy -= 6; } if (sp_dir(1, -1) == 6) { &xxx += 25; &yyy -= 3; } if (sp_dir(1, -1) == 8) { &xxx -= 1; &yyy -= 14; }
sp_brain_parm(&check_vars, 10);
sp_brain(&check_vars, 12);
//&xxx = 100;
//&yyy = 100;
int &barr = create_sprite(&xxx, &yyy, 0, 39, 1);
sp_script(&barr, "bexplo");
int &crap_map = &player_map;
&crap_map *= 1000000;
int &crap_x = sp_x(&barr, -1);
&crap_x *= 1000;
int &crap_y = sp_y(&barr, -1);
&bar_var = 0;
&bar_var += &crap_y;
&bar_var += &crap_x;
&bar_var += &crap_map;
wait(1);
kill_this_item("s5-barrel");
unfreeze(1);
kill_this_task();
}
Note: &bar_var; and &check_vars; are globals.
Problem solved, external error, doh!
void main( void )
{
freeze(1);
if (sp_dir(1, -1) == 1) sp_dir(1, 2);
if (sp_dir(1, -1) == 3) sp_dir(1, 2);
if (sp_dir(1, -1) == 7) sp_dir(1, 8);
if (sp_dir(1, -1) == 9) sp_dir(1, 8);
int &xxx = sp_x(1, -1);
int &yyy = sp_y(1, -1);
if (sp_dir(1, -1) == 2) { &xxx -= 1; &yyy += 19; } if (sp_dir(1, -1) == 4) { &xxx -= 28; &yyy -= 6; } if (sp_dir(1, -1) == 6) { &xxx += 25; &yyy -= 3; } if (sp_dir(1, -1) == 8) { &xxx -= 1; &yyy -= 14; }
sp_brain_parm(&check_vars, 10);
sp_brain(&check_vars, 12);
//&xxx = 100;
//&yyy = 100;
int &barr = create_sprite(&xxx, &yyy, 0, 39, 1);
sp_script(&barr, "bexplo");
int &crap_map = &player_map;
&crap_map *= 1000000;
int &crap_x = sp_x(&barr, -1);
&crap_x *= 1000;
int &crap_y = sp_y(&barr, -1);
&bar_var = 0;
&bar_var += &crap_y;
&bar_var += &crap_x;
&bar_var += &crap_map;
wait(1);
kill_this_item("s5-barrel");
unfreeze(1);
kill_this_task();
}






