function main(){
display_count = 3;
item_selected = potion; //put what the 1st item is here
item_max = 1;
magic_selected = bolt_selected;
magic_max = 3; //change this when you learn more
select_magic = 1;
select_item = 2;
}
function check_magic(local_magic)
{
if (local_magic == bolt_selected)
{
if (bolt_prop[available] == yes) { return(1); } else { return(0); }
}
if (local_magic == cure_selected)
{
if (cure_prop[available] == yes) { return(1); } else { return(0); }
}
if (local_magic == fire_selected)
{
if (fire_prop[available] == yes) { return(1); } else { return(0); }
}
//Debug line here, unknown spell
}
function draw_magic()
{
if ((magic_max <= display_count) || (magic_selected == 0) || (magic_selected == 1))
{
if (cure_prop[available] == yes) {set(cure_text,VISIBLE);}
if (fire_prop[available] == yes) {set(fire_text,VISIBLE);}
if (know_cure == yes) {set(cure_text_gray,VISIBLE);}
if (know_fire == yes) {set(fire_text_gray,VISIBLE);}
arrow.pos_x = 320; arrow.pos_y = 350 + magic_selected * 40;
}
else
{
if (magic_selected == magic_max) //the clever bit
{
}
}
}
function select_magic()
{
set(bolt_text,VISIBLE);
draw_magic();
set(arrow,VISIBLE);
while (key_shift == 1) {wait(1);}
while (1){
wait(1); //wait for user input
if (key_ctrl)
{
if (whos_turn == white_mage) {whitemage_turn();} //your original goback:
if (whos_turn == heru) {heru_turn();}
break;
}
if (key_w) //move up
{
temp = magic_selected; //remembers its start position
if (temp == magic_max-1) { temp = 0; } else { temp += 1; }
while (temp != magic_selected) //while it's not found where it started from
{
if (check_magic(temp)) //finds if the magic is usable
{
selected_magic = temp;
draw_magic();
break;
}
else
{
if (temp == magic_max-1) { temp = 0; } else { temp += 1; }
}
}
wait(-0.1);
}
if (key_s) //move down
{
temp = magic_selected; //remembers its start position
if (temp == 0) { temp = magic_max-1; } else { temp -= 1; }
while (temp != magic_selected) //while it's not found where it started from
{
if (check_magic(temp)) //finds if the magic is usable
{
selected_magic = temp;
draw_magic();
break;
}
else
{
if (temp == 0) { temp = magic_max-1; } else { temp -= 1; }
}
}
wait(-0.1);
}
if (key_shift)
{
selected = magic_selected;
if ((whos_turn == heru) || (whos_turn == white_mage)) //only needs this check if more possible outcomes for whos_turn
{
if (selected == bolt_selected) {select_target(whos_turn,bolt_prop);}
if (selected == cure_selected) {select_target(whos_turn,cure_prop);}
if (selected == fire_selected) {select_target(whos_turn,fire_prop);}
}
reset(selector, VISIBLE);
break; //your original out:
}
}
reset(bolt_text,VISIBLE);
reset(cure_text,VISIBLE);
reset(fire_text,VISIBLE);
reset(bolt_text_gray,VISIBLE);
reset(cure_text_gray,VISIBLE);
reset(fire_text_gray,VISIBLE);
reset(arrow,VISIBLE);
}