1 registered members (henrybane),
1,246
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Enduriel
OP
Member
|
OP
Member
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
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
can you contact me on windows messenger, jks_here@hotmail.com ![smile smile](/ubb7/images/graemlins/default_dark/smile.gif) 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
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
test 1
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
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
test 2
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
}
|
|
|
|