Reply to Re: Odd problems...
If you don't have an account, just leave the password field blank.
Great, thanks to everyone who helped me, I got this script working real smooth very quickly. What it does:
You cast the spell, it freezes you and all sprites of brain 9 and 10
EDIT: just added brain 16, won't bother with 3 and 4
An arrow appears above the first one. When you hit right or up, it goes to the next, and left or down goes to the previous. It cycles between all the enemies, and waits for you to hit shift or space to cancel (unfreezes all enemies and you, but does not cost mana) or hit ctrl to view it's stats. A choice selector comes up with all the enemy stats (hp, str, def, touch damage etc) in the title, and when you hit ctrl it goes on, unfreezes everyone and drains one mana.
It all works, except one minor thing. When I put this in:
&sp-touch = sp_touch_damage(&sprite, -1);
It always returns -1. All other stats turn up right, but touch damage is -1. Can anyone think of a good reason? I'll throw up the script for you guys to evaluate, too.
//magic scan
void use( void )
{
if (&mana_current < 1)
{
say("Not enough mana.", 1);
return;
}
int &count9 = 100;
int &count10 = 200;
int &count16 = 300;
int &total9;
int &total10;
int &total16;
int &sprite;
int &x;
int &y;
int &arrow;
&total9 = get_sprite_with_this_brain(9, 0);
if (&total9 == 0)
{
&total10 = get_sprite_with_this_brain(10, 0);
if (&total10 == 0)
{
&total16 = get_sprite_with_this_brain(16, 0);
if (&total16 == 0)goto none;
}
}
freeze(1);
loop9:
&total9 = get_sprite_with_this_brain(9, 0);
if (&total9 > 0)
{
&count9 += 1;
sp_brain(&total9, &count9);
freeze(&total9);
goto loop9;
}
loop10:
&total10 = get_sprite_with_this_brain(10, 0);
if (&total10 > 0)
{
&count10 += 1;
sp_brain(&total10, &count10);
freeze(&total10);
goto loop10;
}
loop16:
&total16 = get_sprite_with_this_brain(16, 0);
if (&total16 > 0)
{
&count16 += 1;
sp_brain(&total16, &count16);
freeze(&total16);
goto loop10;
}
&total9 = &count9;
&total10 = &count10;
&total16 = &count16;
//creating arrow off screen
&arrow = create_sprite(-100, -100, 6, 98, 1);
sp_que(&arrow, 20000);
sp_nohit(&arrow, 1);
sp_seq(&arrow, 98);
checkloop:
if (&count9 > 100)
{
&sprite = get_sprite_with_this_brain(&count9, 0);
&x = sp_x(&sprite, -1);
&y = sp_y(&sprite, -1);
&y -= 60;
&x += 5;
sp_x(&arrow, &x);
sp_y(&arrow, &y);
goto cont1;
}
if (&count10 > 200)
{
&sprite = get_sprite_with_this_brain(&count10, 0);
&x = sp_x(&sprite, -1);
&y = sp_y(&sprite, -1);
&y -= 60;
&x += 5;
sp_x(&arrow, &x);
sp_y(&arrow, &y);
goto cont1;
}
if (&count16 > 300)
{
&sprite = get_sprite_with_this_brain(&count16, 0);
&x = sp_x(&sprite, -1);
&y = sp_y(&sprite, -1);
&y -= 60;
&x += 5;
sp_x(&arrow, &x);
sp_y(&arrow, &y);
goto cont1;
}
cont1:
wait_for_button();
//1 = ctrl
//2 = space
//3 = shift
//12 = down
//14 = left
//16 = right
//18 = up
if (&result == 1) goto select;
if (&result == 2) goto select;
if (&result == 3) goto cancel;
if (&result == 12) goto previous;
if (&result == 14) goto previous;
if (&result == 16) goto next;
if (&result == 18) goto next;
next:
if (&count9 > 100)
{
&count9 -= 1;
if (&count9 == 100)
{
if (&total10 == 200)
{
if (&total16 == 300)
{
&count9 = &total9;
goto checkloop;
}
}
}
goto checkloop;
}
if (&count10 > 200)
{
&count10 -= 1;
if (&count10 == 200)
{
if (&total9 == 100)
{
if (&total16 == 300)
{
&count10 = &total10;
goto checkloop;
}
}
}
goto checkloop;
}
if (&count16 > 301)
{
&count16 -= 1;
if (&count16 == 300)
{
if (&total9 == 100)
{
if (&total10 == 200)
{
&count16 = &total16;
goto checkloop;
}
}
}
goto checkloop;
}
//all 0
&count9 = &total9;
&count10 = &total10;
&count16 = &total16;
goto checkloop;
previous:
if (&count16 < &total16)
{
&count16 += 1;
goto checkloop;
}
if (&count10 < &total10)
{
&count10 += 1;
goto checkloop;
}
if (&count9 < &total9)
{
&count9 += 1;
goto checkloop;
}
//all max - first check for any 16's...set to 301 if so. If not, check if there's any 10's, set to 201. if so, otherwise set 9's to 101
if (&total16 > 300)
{
&count16 = 301;
&count9 = 100;
&count10 = 200;
goto checkloop;
}
if(&total10 > 200)
{
&count9 = 100;
&count10 = 201;
goto checkloop;
}
&count9 = 101;
goto checkloop;
select:
int &sp-hp = sp_hitpoints(&sprite, -1);
int &sp-def = sp_defense(&sprite, -1);
int &sp-strength = sp_strength(&sprite, -1);
int &sp-touch = sp_touch_damage(&sprite, -1);
choice_start()
set_y 240
title_start();
Enemy Statistics:
Hitpoints = &sp-hp
Defense = &sp-def
Strength = &sp-strength
Touch Damage = &sp-touch
title_end();
"Good to know!"
choice_end()
goto end;
end:
&mana_current -= 1;
cancel:
&bleh = 10;
&bleh * &magic;
&magic_cost = &bleh;
&magic_level = 0;
draw_status();
sp_active(&arrow, 0);
&count9 = &total9;
&count10 = &total10;
loopunfreeze:
if (&count9 > 100)
{
&sprite = get_sprite_with_this_brain(&count9, 0);
unfreeze(&sprite);
sp_brain(&sprite, 9);
&count9 -= 1;
goto loopunfreeze;
}
if (&count10 > 200)
{
&sprite = get_sprite_with_this_brain(&count10, 0);
unfreeze(&sprite);
sp_brain(&sprite, 10);
&count10 -= 1;
goto loopunfreeze;
}
if (&count16 > 300)
{
&sprite = get_sprite_with_this_brain(&count16, 0);
unfreeze(&sprite);
sp_brain(&sprite, 16);
&count16 -= 1;
goto loopunfreeze;
}
unfreeze(1);
return;
none:
say("No targets to scan!", 1);
return;
}
void disarm(void)
{
kill_this_task();
}
void arm(void)
{
int &bleh = 10;
&bleh * &magic;
&magic_cost = &bleh;
&magic_level = 0;
}
void pickup(void)
{
}
void drop(void)
{
draw_status();
kill_this_task();
}
You cast the spell, it freezes you and all sprites of brain 9 and 10
EDIT: just added brain 16, won't bother with 3 and 4
An arrow appears above the first one. When you hit right or up, it goes to the next, and left or down goes to the previous. It cycles between all the enemies, and waits for you to hit shift or space to cancel (unfreezes all enemies and you, but does not cost mana) or hit ctrl to view it's stats. A choice selector comes up with all the enemy stats (hp, str, def, touch damage etc) in the title, and when you hit ctrl it goes on, unfreezes everyone and drains one mana.
It all works, except one minor thing. When I put this in:
&sp-touch = sp_touch_damage(&sprite, -1);
It always returns -1. All other stats turn up right, but touch damage is -1. Can anyone think of a good reason? I'll throw up the script for you guys to evaluate, too.
//magic scan
void use( void )
{
if (&mana_current < 1)
{
say("Not enough mana.", 1);
return;
}
int &count9 = 100;
int &count10 = 200;
int &count16 = 300;
int &total9;
int &total10;
int &total16;
int &sprite;
int &x;
int &y;
int &arrow;
&total9 = get_sprite_with_this_brain(9, 0);
if (&total9 == 0)
{
&total10 = get_sprite_with_this_brain(10, 0);
if (&total10 == 0)
{
&total16 = get_sprite_with_this_brain(16, 0);
if (&total16 == 0)goto none;
}
}
freeze(1);
loop9:
&total9 = get_sprite_with_this_brain(9, 0);
if (&total9 > 0)
{
&count9 += 1;
sp_brain(&total9, &count9);
freeze(&total9);
goto loop9;
}
loop10:
&total10 = get_sprite_with_this_brain(10, 0);
if (&total10 > 0)
{
&count10 += 1;
sp_brain(&total10, &count10);
freeze(&total10);
goto loop10;
}
loop16:
&total16 = get_sprite_with_this_brain(16, 0);
if (&total16 > 0)
{
&count16 += 1;
sp_brain(&total16, &count16);
freeze(&total16);
goto loop10;
}
&total9 = &count9;
&total10 = &count10;
&total16 = &count16;
//creating arrow off screen
&arrow = create_sprite(-100, -100, 6, 98, 1);
sp_que(&arrow, 20000);
sp_nohit(&arrow, 1);
sp_seq(&arrow, 98);
checkloop:
if (&count9 > 100)
{
&sprite = get_sprite_with_this_brain(&count9, 0);
&x = sp_x(&sprite, -1);
&y = sp_y(&sprite, -1);
&y -= 60;
&x += 5;
sp_x(&arrow, &x);
sp_y(&arrow, &y);
goto cont1;
}
if (&count10 > 200)
{
&sprite = get_sprite_with_this_brain(&count10, 0);
&x = sp_x(&sprite, -1);
&y = sp_y(&sprite, -1);
&y -= 60;
&x += 5;
sp_x(&arrow, &x);
sp_y(&arrow, &y);
goto cont1;
}
if (&count16 > 300)
{
&sprite = get_sprite_with_this_brain(&count16, 0);
&x = sp_x(&sprite, -1);
&y = sp_y(&sprite, -1);
&y -= 60;
&x += 5;
sp_x(&arrow, &x);
sp_y(&arrow, &y);
goto cont1;
}
cont1:
wait_for_button();
//1 = ctrl
//2 = space
//3 = shift
//12 = down
//14 = left
//16 = right
//18 = up
if (&result == 1) goto select;
if (&result == 2) goto select;
if (&result == 3) goto cancel;
if (&result == 12) goto previous;
if (&result == 14) goto previous;
if (&result == 16) goto next;
if (&result == 18) goto next;
next:
if (&count9 > 100)
{
&count9 -= 1;
if (&count9 == 100)
{
if (&total10 == 200)
{
if (&total16 == 300)
{
&count9 = &total9;
goto checkloop;
}
}
}
goto checkloop;
}
if (&count10 > 200)
{
&count10 -= 1;
if (&count10 == 200)
{
if (&total9 == 100)
{
if (&total16 == 300)
{
&count10 = &total10;
goto checkloop;
}
}
}
goto checkloop;
}
if (&count16 > 301)
{
&count16 -= 1;
if (&count16 == 300)
{
if (&total9 == 100)
{
if (&total10 == 200)
{
&count16 = &total16;
goto checkloop;
}
}
}
goto checkloop;
}
//all 0
&count9 = &total9;
&count10 = &total10;
&count16 = &total16;
goto checkloop;
previous:
if (&count16 < &total16)
{
&count16 += 1;
goto checkloop;
}
if (&count10 < &total10)
{
&count10 += 1;
goto checkloop;
}
if (&count9 < &total9)
{
&count9 += 1;
goto checkloop;
}
//all max - first check for any 16's...set to 301 if so. If not, check if there's any 10's, set to 201. if so, otherwise set 9's to 101
if (&total16 > 300)
{
&count16 = 301;
&count9 = 100;
&count10 = 200;
goto checkloop;
}
if(&total10 > 200)
{
&count9 = 100;
&count10 = 201;
goto checkloop;
}
&count9 = 101;
goto checkloop;
select:
int &sp-hp = sp_hitpoints(&sprite, -1);
int &sp-def = sp_defense(&sprite, -1);
int &sp-strength = sp_strength(&sprite, -1);
int &sp-touch = sp_touch_damage(&sprite, -1);
choice_start()
set_y 240
title_start();
Enemy Statistics:
Hitpoints = &sp-hp
Defense = &sp-def
Strength = &sp-strength
Touch Damage = &sp-touch
title_end();
"Good to know!"
choice_end()
goto end;
end:
&mana_current -= 1;
cancel:
&bleh = 10;
&bleh * &magic;
&magic_cost = &bleh;
&magic_level = 0;
draw_status();
sp_active(&arrow, 0);
&count9 = &total9;
&count10 = &total10;
loopunfreeze:
if (&count9 > 100)
{
&sprite = get_sprite_with_this_brain(&count9, 0);
unfreeze(&sprite);
sp_brain(&sprite, 9);
&count9 -= 1;
goto loopunfreeze;
}
if (&count10 > 200)
{
&sprite = get_sprite_with_this_brain(&count10, 0);
unfreeze(&sprite);
sp_brain(&sprite, 10);
&count10 -= 1;
goto loopunfreeze;
}
if (&count16 > 300)
{
&sprite = get_sprite_with_this_brain(&count16, 0);
unfreeze(&sprite);
sp_brain(&sprite, 16);
&count16 -= 1;
goto loopunfreeze;
}
unfreeze(1);
return;
none:
say("No targets to scan!", 1);
return;
}
void disarm(void)
{
kill_this_task();
}
void arm(void)
{
int &bleh = 10;
&bleh * &magic;
&magic_cost = &bleh;
&magic_level = 0;
}
void pickup(void)
{
}
void drop(void)
{
draw_status();
kill_this_task();
}