📧 Message Board Archive

but Milobones,......
please bear with me, the last time I used a loop was in Basic. ( ya, i'm old...)

If I do it this way won't watch all the townsfolk?

void main (void)

{

int &i;

int &bad = &evil;

}

void hit (void)

{

say_stop("'4Thug! Suffer our justice!",&current_sprite);

sp_target(&current_sprite,1);

}

loophere;

if (&i < 5000);

{

if (&evil > &bad ) sp_target(&current_sprite,1);

wait (250);

&i += ;

goto loophere;

}

// next is the void talk stuff....



if I do it this way the guard looks for a change in &evil made by townsfolk being hit ( &evil +=1)



Is this syntax ok?..................Ric
Re: but Milobones,......
void main (void)

{

int &i;

int &bad = &evil;

}



void hit (void)

{

say_stop("'4Thug! Suffer our justice!",&current_sprite);

sp_target(&current_sprite,1);

}

loophere;

if (&i < 5000);

{

if (&evil > &bad ) sp_target(&current_sprite,1);

wait (250);

&i += ;

goto loophere;

}





I *think* that everything has to be within a procedure... since main() is called at birth, it is a decent choice for such stuff.



Oh, one more thing, &i was a very stupid variable choice on my part... if you have another variable name that begins with "&i" you might have troubles.
Re: but Milobones,......
I'd do it something like this:



void main (void)

{

 int &bad = &evil;

loophere:

   if (&evil > &bad )       sp_target(&current_sprite,1);

   wait(250);

   goto loophere;

 }

}



What was &i for? Was there some reason you want the guards to stop paying attantion after 20 minutes? If you were thinking it's bad to have an infite loop, don't worry, It's okay as long as there's a delay in it. Also note that a loop label ends with : not ; And like I said before, set the guard's brain to 9 if it isn't to start with.
Re: but Milobones,......
: I'd do it something like this:



: void main (void)



: {



:  int &bad = &evil;



: loophere:



:   if (&evil > &bad ) sp_target(&current_sprite,1);



:   wait(250);



:   goto loophere;



:  }



: }



: What was &i for? Was there some reason you want the guards to stop paying attantion after 20 minutes? If you were thinking it's bad to have an infite loop, don't worry, It's okay as long as there's a delay in it. Also note that a loop label ends with : not ; And like I said before, set the guard's brain to 9 if it isn't to start with.



enlightening..Thanks a bunch..............Ric
Re: but Milobones,......
: void main (void)



: {



: int &i;



: int &bad = &evil;



: }



: void hit (void)



: {



: say_stop("'4Thug! Suffer our justice!",&current_sprite);



: sp_target(&current_sprite,1);



: }



: loophere;



: if (&i < 5000);



: {



: if (&evil > &bad ) sp_target(&current_sprite,1);



: wait (250);



: &i += ;



: goto loophere;



: }



: I *think* that everything has to be within a procedure... since main() is called at birth, it is a decent choice for such stuff.



: Oh, one more thing, &i was a very stupid variable choice on my part... if you have another variable name that begins with "&i" you might have troubles.



I changed the &i (good idea for the future.) I think the loop is in one proc. if I get your meaning. In my efforts, I ended up debugging several other things but the guard still isn't reading the attack on others. maybe I'll try a change storywise. Or do you think this is a good aproach? Thanks once again............Ric

Re: but Milobones,......
: : void main (void)

: : {

: : int &i;

: : int &bad = &evil;

: : }

: : void hit (void)

: : {

: : say_stop("'4Thug! Suffer our justice!",&current_sprite);

: : sp_target(&current_sprite,1);

: : }

: : loophere;

: : if (&i < 5000);

: : {

: : if (&evil > &bad ) sp_target(&current_sprite,1);

: : wait (250);

: : &i += ;

: : goto loophere;

: : }



: : I *think* that everything has to be within a procedure... since main() is called at birth, it is a decent choice for such stuff.



: : Oh, one more thing, &i was a very stupid variable choice on my part... if you have another variable name that begins with "&i" you might have troubles.



:  I changed the &i (good idea for the future.) I think the loop is in one proc. if I get your meaning. In my efforts, I ended up debugging several other things but the guard still isn't reading the attack on others. maybe I'll try a change storywise. Or do you think this is a good aproach? Thanks once again............Ric



The loop isn't in a procedure.  For example...



//This is good

void main(void) {

say("Aha!',1);

}

void talk(void) {

say("Aha Again!",1);

}



//This is bad

void main(void) {

say("Aha!",1);

}

say("Aha Again!",1);



Everything in a script has to be within the brackets of main, hit, talk, damage, or some other "void BLAH (void)".  The loop isn't, so that loop code is never run.
Re: but Milobones,......
: : : void main (void)



: : : {



: : : int &i;



: : : int &bad = &evil;



: : : }



: : : void hit (void)



: : : {



: : : say_stop("'4Thug! Suffer our justice!",&current_sprite);



: : : sp_target(&current_sprite,1);



: : : }



: : : loophere;



: : : if (&i < 5000);



: : : {



: : : if (&evil > &bad ) sp_target(&current_sprite,1);



: : : wait (250);



: : : &i += ;



: : : goto loophere;



: : : }



: : : I *think* that everything has to be within a procedure... since main() is called at birth, it is a decent choice for such stuff.



: : : Oh, one more thing, &i was a very stupid variable choice on my part... if you have another variable name that begins with "&i" you might have troubles.



: : I changed the &i (good idea for the future.) I think the loop is in one proc. if I get your meaning. In my efforts, I ended up debugging several other things but the guard still isn't reading the attack on others. maybe I'll try a change storywise. Or do you think this is a good aproach? Thanks once again............Ric



: The loop isn't in a procedure. For example...



: //This is good



: void main(void) {



: say("Aha!',1);



: }



: void talk(void) {



: say("Aha Again!",1);



: }



: //This is bad



: void main(void) {



: say("Aha!",1);



: }



: say("Aha Again!",1);



: Everything in a script has to be within the brackets of main, hit, talk, damage, or some other "void BLAH (void)". The loop isn't, so that loop code is never run.



I'm starting to see, (i think..)

void hit (void)

{

loophere;

if &i < 5000;

{

//and so forth..........Ric
Re: but Milobones,......
: Everything in a script has to be within the brackets of main, hit, talk, damage, or some other "void BLAH (void)". The loop isn't, so that loop code is never run.



In theory, yes. But this works anyway:



void main ( void )

{

 say_stop("Inside brackets.", 1);

 goto outside;

inside:

 say_stop("Inside brackets.", 1);

}



outside:

 say_stop("Outside brackets!", 1);

 goto inside;

// stop scrip from falling off the edge of the world.
Re: but Milobones,......
: : Everything in a script has to be within the brackets of main, hit, talk, damage, or some other "void BLAH (void)". The loop isn't, so that loop code is never run.



: In theory, yes. But this works anyway:



: void main ( void )

: {

:  say_stop("Inside brackets.", 1);

:  goto outside;

: inside:

:  say_stop("Inside brackets.", 1);

: }

: outside:

:  say_stop("Outside brackets!", 1);

:  goto inside;

: // stop scrip from falling off the edge of the world.



Wait no it doesn't, it needs return; at the end of main. Or it turns into a loop. (which goes to show, just because you can do weird things like this, doens't mean you should)



Sorry if I'm confusing you Ric, pay no attention. :)
Re: but Milobones,......
: : : Everything in a script has to be within the brackets of main, hit, talk, damage, or some other "void BLAH (void)". The loop isn't, so that loop code is never run.



: : In theory, yes. But this works anyway:



: : void main ( void )



: : {



: : say_stop("Inside brackets.", 1);



: : goto outside;



: : inside:



: : say_stop("Inside brackets.", 1);



: : }



: : outside:



: : say_stop("Outside brackets!", 1);



: : goto inside;



: : // stop scrip from falling off the edge of the world.



: Wait no it doesn't, it needs return; at the end of main. Or it turns into a loop. (which goes to show, just because you can do weird things like this, doens't mean you should)



: Sorry if I'm confusing you Ric, pay no attention. :)



I'm learning a lot from this too! thanx....Ric