Nah colors inside code doens't work for me :<

Hey scorpion, this is one last favor I want to ask you :p it's about goto again, but a more complex one. I couldn't get it to work properly with local variables and the command continue;

could you please help me with this one? there is 4 gotos called several times, those gotos are Out: goback: loop: and skip:

I'm almost done with translating the whole project from c-script to lite-c, only the main menu code is left and this one

Code:


function select_magic()
{

wait(1);


set(bolt_text,VISIBLE); selected = bolt_selected;

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);}

set(arrow,VISIBLE);

while(key_shift == 1) {wait(1);}
while(1)
	{
	if (key_ctrl == 1) {goto goback;}

loop:
	if (selected == bolt_selected)
	{
		if (bolt_prop[available] == no)
		{
			if (key_s == 1) {selected = cure_selected; goto skip;}

			if (key_w == 1) {selected = fire_selected; goto skip;}
			selected = cure_selected; goto skip;
		}
		arrow.pos_x = 320; arrow.pos_y = 350;
		if (already_pushed == no)
		{
			if (key_s == 1) {selected = cure_selected; already_pushed = yes; goto loop;}
			if (key_w == 1) {selected = fire_selected; already_pushed = yes; goto loop;}
		}
	}
	if (selected == cure_selected)
	{
		if (cure_prop[available] == no)
		{
			if (key_s == 1) {selected = fire_selected; goto skip;}
			if (key_w == 1) {selected = bolt_selected; goto skip;}
			selected = fire_selected; goto skip;
		}
		arrow.pos_x = 320; arrow.pos_y = 390;
		if (already_pushed == no)
		{
			if (key_s == 1) {selected = fire_selected; already_pushed = yes; goto loop;}
			if (key_w == 1) {selected = bolt_selected; already_pushed = yes; goto loop;}
		}
	}
	if (selected == fire_selected)
	{
		if (fire_prop[available] == no)
		{
			if (key_s == 1) {selected = bolt_selected; goto skip;}
			if (key_w == 1) {selected = cure_selected; goto skip;}
			selected = fire_selected; goto skip;
		}
		arrow.pos_x = 320; arrow.pos_y = 430;
		if (already_pushed == no)
		{
			if (key_s == 1) {selected = bolt_selected; already_pushed = yes; goto loop;}
			if (key_w == 1) {selected = cure_selected; already_pushed = yes; goto loop;}
		}
	}
	if ((key_s == 1)||(key_w == 1)) {wait(-0.1);}
	already_pushed = no;
	
skip:
	if (key_shift == 1)

	{
		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);}

		reset(selector, VISIBLE);
		goto out;
	}


	wait(1);
}

goback:
    if (whos_turn == white_mage) {whitemage_turn();}
    if (whos_turn == heru) {heru_turn();}

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);
}




Last edited by Enduriel; 08/10/08 11:43.