test 2
Code:
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_selected = magic_selected; //remembers its start position
			if (temp_selected == magic_max-1) { temp_selected = 0; } else { temp_selected += 1; }

			while (temp_selected != magic_selected) //while it's not found where it started from
			{
				if (check_magic(temp_selected)) //finds if the magic is usable
				{
					selected_magic = temp_selected;
					draw_magic();
					break;
				}
				else
				{
					if (temp_selected == magic_max-1) { temp_selected = 0; } else { temp_selected += 1; }
				}
			}
			wait(-0.1);
		}

		if (key_s) //move down
		{
			temp_selected = magic_selected; //remembers its start position
			if (temp_selected == 0) { temp_selected = magic_max-1; } else { temp_selected -= 1; }

			while (temp_selected != magic_selected) //while it's not found where it started from
			{
				if (check_magic(temp_selected)) //finds if the magic is usable
				{
					selected_magic = temp_selected;
					draw_magic();
					break;
				}
				else
				{
					if (temp_selected == 0) { temp_selected = magic_max-1; } else { temp_selected -= 1; }
				}
			}
			wait(-0.1);
		}

		if (key_shift)
		{
			selected = magic_selected;
			if ((whos_turn == heru) && (selected == bolt_selected)) {select_target(heru,bolt_prop);}
			if ((whos_turn == heru) && (selected == cure_selected)) {select_target(heru,cure_prop);}
			if ((whos_turn == heru) && (selected == fire_selected)) {select_target(heru,fire_prop);}

			if ((whos_turn == white_mage) && (selected == bolt_selected)) {select_target(white_mage,bolt_prop);}
			if ((whos_turn == white_mage) && (selected == cure_selected)) {select_target(white_mage,cure_prop);}
			if ((whos_turn == white_mage) && (selected == fire_selected)) {select_target(white_mage,fire_prop);}
/*			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);
}

function draw_magic()
{
	if ((magic_max <= display_count) || (magic_selected == 0) || (magic_selected == 1))
	{
		beep;
		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 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
}