📧 Message Board Archive

Scripting help wanted
I've got 2 scripts on 2 different screens: aim: sprite talks to Dink, then moves of screen. The sprite is exactly the same on both screens and for both movements (to move sprite of screen) I used:

move(&gar, 4, 20, 1);

move(&gar, 4, -10, 1);



But with one script the sprite walks away nicely of screen (as he should), while with the other script he just vanish somewhere in the middle of the screen, without ever reaching the end of the screen.



The only thing that is different about the scripts, is that in the one where he DOES move away nicely, the sprite is created as:

int &gar = create_sprite(-10, 165, 0, 343, 1);

and then moves on screen with:

move(&gar, 6, 90, 1);

while with the other one (where he vanish into thin air) he shows up directly on screen with script:

int &gar = create_sprite(214, 195, 0, 343, 1;



That's the only difference. On both screens he can walk of screen with the x/y# given. The sprite is exactly the same.

So, what is going on here?? Please help, 'cause I've run out of options!
Re: Scripting help wanted
: I've got 2 scripts on 2 different screens: aim: sprite talks to Dink, then moves of screen. The sprite is exactly the same on both screens and for both movements (to move sprite of screen) I used:

: move(&gar, 4, 20, 1);

: move(&gar, 4, -10, 1);

: But with one script the sprite walks away nicely of screen (as he should), while with the other script he just vanish somewhere in the middle of the screen, without ever reaching the end of the screen.

: The only thing that is different about the scripts, is that in the one where he DOES move away nicely, the sprite is created as:

: int &gar = create_sprite(-10, 165, 0, 343, 1);

: and then moves on screen with:

: move(&gar, 6, 90, 1);

: while with the other one (where he vanish into thin air) he shows up directly on screen with script:

: int &gar = create_sprite(214, 195, 0, 343, 1;

: That's the only difference. On both screens he can walk of screen with the x/y# given. The sprite is exactly the same.

: So, what is going on here?? Please help, 'cause I've run out of options!



Uhm, Ive studied it, let me see...

Ah yes,

try using:

move_stop(&gar, 4, 0, 1);

sp_nodraw(&gar, 1);



he now walks to the edge and then he disappears. I use it too, because -10 is to the right not to the left :) doesnt matter really, just use that.
Re: Scripting help wanted
: : I've got 2 scripts on 2 different screens: aim: sprite talks to Dink, then moves of screen. The sprite is exactly the same on both screens and for both movements (to move sprite of screen) I used:

: : move(&gar, 4, 20, 1);

: : move(&gar, 4, -10, 1);

: : But with one script the sprite walks away nicely of screen (as he should), while with the other script he just vanish somewhere in the middle of the screen, without ever reaching the end of the screen.

: : The only thing that is different about the scripts, is that in the one where he DOES move away nicely, the sprite is created as:

: : int &gar = create_sprite(-10, 165, 0, 343, 1);

: : and then moves on screen with:

: : move(&gar, 6, 90, 1);

: : while with the other one (where he vanish into thin air) he shows up directly on screen with script:

: : int &gar = create_sprite(214, 195, 0, 343, 1;

: : That's the only difference. On both screens he can walk of screen with the x/y# given. The sprite is exactly the same.

: : So, what is going on here?? Please help, 'cause I've run out of options!

: Uhm, Ive studied it, let me see...

: Ah yes,

: try using:

: move_stop(&gar, 4, 0, 1);

: sp_nodraw(&gar, 1);

: he now walks to the edge and then he disappears. I use it too, because -10 is to the right not to the left :) doesnt matter really, just use that.



-10 is to the left!
Re: Scripting help wanted
: : I've got 2 scripts on 2 different screens: aim: sprite talks to Dink, then moves of screen. The sprite is exactly the same on both screens and for both movements (to move sprite of screen) I used:

: : move(&gar, 4, 20, 1);

: : move(&gar, 4, -10, 1);

: : But with one script the sprite walks away nicely of screen (as he should), while with the other script he just vanish somewhere in the middle of the screen, without ever reaching the end of the screen.

: : The only thing that is different about the scripts, is that in the one where he DOES move away nicely, the sprite is created as:

: : int &gar = create_sprite(-10, 165, 0, 343, 1);

: : and then moves on screen with:

: : move(&gar, 6, 90, 1);

: : while with the other one (where he vanish into thin air) he shows up directly on screen with script:

: : int &gar = create_sprite(214, 195, 0, 343, 1;

: : That's the only difference. On both screens he can walk of screen with the x/y# given. The sprite is exactly the same.

: : So, what is going on here?? Please help, 'cause I've run out of options!

: Uhm, Ive studied it, let me see...

: Ah yes,

: try using:

: move_stop(&gar, 4, 0, 1);

: sp_nodraw(&gar, 1);

: he now walks to the edge and then he disappears. I use it too, because -10 is to the right not to the left :) doesnt matter really, just use that.



Great, I will try that! :) But it still doesnt make any sense why it does work in 1 script, but not in the other, does it? Cause with -10 he does go in the 'nicely working script' to the left!

And is sp_nodraw(&gar, 1); not the same as sp_active(&gar, 0);, but then sort of reversed? Cause in sp_nodraw() the # used is not drawn (so he is not there anymore), while in the other the active sprite is no # at all, so not active anymore (hence, he is not there anymore)?
Re: Scripting help wanted
Could you post the whole script? It's hard ro understand without any context. (you could replace dialog with XXXXXXXXs or something if you don't want to give away your plot.)

Re: Scripting help wanted
: Could you post the whole script? It's hard ro understand without any context. (you could replace dialog with XXXXXXXXs or something if you don't want to give away your plot.)



Sure, here they are...



Script 1: in this one the sprites vanishes halfway throughout his walk to the end of the sceen



void main(void)

{

if (&story == 13)

{

int&gar;

freeze(1);

int &gar = create_sprite(214, 195, 0, 343, 1);

sp_base_walk(&gar, 340);

sp_speed(&gar, 1);

wait(500);



//they say stuff

say_stop('''4Blabla.'', &gar);

wait(200);

say_stop(''Yup.'', 1);

wait(200);



move(&gar, 4, 20, 1);

move(&gar, 4, -10, 1);

wait(670);

sp_active(&gar, 0);



wait(500);

&story = 14;

unfreeze(1);

}

}





Script 2: in this one the sprite walks nicely of screen



void main(void)

{

if (&story == 4)

{

int &gar;

freeze(1);

int &gar = create_sprite(-10, 165, 0, 343, 1);

sp_base_walk(&gar, 340);

sp_speed(&gar, 1);



move(&gar, 6, 90, 1);

wait(670);



//they say stuff

say_stop('''4And blabla once more.'', &gar);

wait(200);

say_stop(''Really?'', 1);

wait(200);



move(&gar, 4, 20, 1);

move(&gar, 4, -10, 1);

wait(670);

sp_active(&gar, 0);



wait(500);

&story = 5;

unfreeze(1);

}

}



Both scripts work fine in every way; except for that strange dissapearing act in script 1.



In script 1 I've tried a bunch of things, like inserting a wait-command :

move(&gar, 4, 20, 1);

wait(670);

move(&gar, 4, -10, 1);

wait(670);

sp_active(&gar, 0);



and inserting sp_active(&gar, 1);-command like:

move(&gar, 4, 20, 1);

sp_active(&gar, 1);

move(&gar, 4, -10, 1);

wait(670);

sp_active(&gar, 0);



and also combinations of those. And I copied the move(&gar)-part of the working script to the non-working part, but it's still the same: stupid guy just vanishes. :(



Hope you can help! :)
use move_stop()!!!
void main(void)

{

if (&story == 13)

{

 freeze(1);

 int &gar = create_sprite(214, 195, 0, 343, 1);

 sp_base_walk(&gar, 340);

 sp_speed(&gar, 1);

 wait(500);



// they say stuff

 say_stop('''4Blabla.'', &gar);

 wait(200);

 say_stop(''Yup.'', 1);

 wait(200);



 move_stop(&gar, 4, -10, 1);

 wait(1);

 sp_active(&gar, 0);

 &story = 14;

 unfreeze(1);

}

}



Since in script 1, the sprite moves from x=214 to x=-10. It certainly takes more time than wait(670) to get to the final destination. Then, you de-activate the sprite-->disappear. A precaution: do not put wait(xxx) after you de-activate the sprite. The script might stop right there...
Re: use move_stop()!!!
: void main(void)

: {

:  if (&story == 13)

:  {

:  freeze(1);

:  int &gar = create_sprite(214, 195, 0, 343, 1);

:  sp_base_walk(&gar, 340);

:  sp_speed(&gar, 1);

:  wait(500);

: // they say stuff

:  say_stop('''4Blabla.'', &gar);

:  wait(200);

:  say_stop(''Yup.'', 1);

:  wait(200);

:  move_stop(&gar, 4, -10, 1);

:  wait(1);

:  sp_active(&gar, 0);

:  &story = 14;

:  unfreeze(1);

:  }

: }

: Since in script 1, the sprite moves from x=214 to x=-10. It certainly takes more time than wait(670) to get to the final destination. Then, you de-activate the sprite-->disappear. A precaution: do not put wait(xxx) after you de-activate the sprite. The script might stop right there...



Aha! :o  Thank you very much! :)

Re: Scripting help wanted
: I've got 2 scripts on 2 different screens: aim: sprite talks to Dink, then moves of screen. The sprite is exactly the same on both screens and for both movements (to move sprite of screen) I used:

: move(&gar, 4, 20, 1);

: move(&gar, 4, -10, 1);

: But with one script the sprite walks away nicely of screen (as he should), while with the other script he just vanish somewhere in the middle of the screen, without ever reaching the end of the screen.

: The only thing that is different about the scripts, is that in the one where he DOES move away nicely, the sprite is created as:

: int &gar = create_sprite(-10, 165, 0, 343, 1);

: and then moves on screen with:

: move(&gar, 6, 90, 1);

: while with the other one (where he vanish into thin air) he shows up directly on screen with script:

: int &gar = create_sprite(214, 195, 0, 343, 1;

: That's the only difference. On both screens he can walk of screen with the x/y# given. The sprite is exactly the same.

: So, what is going on here?? Please help, 'cause I've run out of options!



int &gar = create_sprite(214, 195, 0, 343, 1;

is wrong



int &gar = create_sprite(214, 195, 0, 343, 1);

is good

Re: Scripting help wanted
: : I've got 2 scripts on 2 different screens: aim: sprite talks to Dink, then moves of screen. The sprite is exactly the same on both screens and for both movements (to move sprite of screen) I used:

: : move(&gar, 4, 20, 1);

: : move(&gar, 4, -10, 1);

: : But with one script the sprite walks away nicely of screen (as he should), while with the other script he just vanish somewhere in the middle of the screen, without ever reaching the end of the screen.

: : The only thing that is different about the scripts, is that in the one where he DOES move away nicely, the sprite is created as:

: : int &gar = create_sprite(-10, 165, 0, 343, 1);

: : and then moves on screen with:

: : move(&gar, 6, 90, 1);

: : while with the other one (where he vanish into thin air) he shows up directly on screen with script:

: : int &gar = create_sprite(214, 195, 0, 343, 1;

: : That's the only difference. On both screens he can walk of screen with the x/y# given. The sprite is exactly the same.

: : So, what is going on here?? Please help, 'cause I've run out of options!

: int &gar = create_sprite(214, 195, 0, 343, 1;

: is wrong

: int &gar = create_sprite(214, 195, 0, 343, 1);

: is good



O, heck... Really good :) of you to notice, but... er... my mistake :( while typing, because in the script used the ) is there. Sorry bout that...

So the missing ) isnt the problem.