Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: how do you use goto OUTSIDE brackets? [Re: Enduriel] #220864
08/10/08 12:51
08/10/08 12:51
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
change
Code:
while(1)
to
Code:
while(1){
wait(1);


Last edited by MrGuest; 08/10/08 12:52. Reason: and see prev post
Re: how do you use goto OUTSIDE brackets? [Re: Enduriel] #220865
08/10/08 12:57
08/10/08 12:57
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline OP
Member
Enduriel  Offline OP
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
Found the problem.. when bolt is selected. if I press W it freezes but it should go to cure when fire isnt' available. when cure is selected and I press S it should go back to bolt if fire isn't available!

Last edited by Enduriel; 08/10/08 13:00.
Re: how do you use goto OUTSIDE brackets? [Re: Enduriel] #220878
08/10/08 13:10
08/10/08 13:10
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
can you contact me on windows messenger, jks_here@hotmail.com smile trying to get a few things straight in my head and without being able to test things it's a bit difficult

Last edited by MrGuest; 08/10/08 13:11.
Re: how do you use goto OUTSIDE brackets? [Re: Enduriel] #220891
08/10/08 15:13
08/10/08 15:13
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
test 1
Code:
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);
}


Re: how do you use goto OUTSIDE brackets? [Re: MrGuest] #220907
08/10/08 18:47
08/10/08 18:47
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
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
}


Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1