📧 Message Board Archive

screwy scripts
This script is suposed to give dink a axe afterh e punches a chest and it opens but it never unfreezes so sombody please look and see wha i did wrong.







//script for chest with metas axe in



void main( void)

{

 preload_seq(175);

}



void hit ( void )

{

 freeze(1);

 //play noise

 

 int &hold = sp_editor_num(&current_sprite);

 playsound(7, 22500, 0, 0, );

 if (&hold != 0)

 {

   //this was placed by the editor, lets make the chest stay open

   editor_type(&hold, 4);

   editor_seq(&hold, 175);

   editor_frame(&hold, 4);

   //type means show this seq/frame combo as background in the future

 }

 &save_x = sp_x(&current_sprite, -1);

 &save_y = sp_y(&current_sprite, -1);

 

 sp_seq(&current_sprite, 175);

 sp_script(&current_sprite, "");

 sp_notouch(&current_sprite, 1);

 sp_nohit(&current_sprite, 1);

 

 // get the axe

 

 playsound(21, 50000, 0, 0, );

 add_item("Item-axe, 438, 06");

 wait(1);

 say_stop("I GOTS METAS AXE", 1);

 wait(1);

 unfreeze(1);

 

}

Re: screwy scripts
I dont think Dink can interpret those winky faces dude...
Re: screwy scripts
: This script is suposed to give dink a axe afterh e punches a chest and it opens but it never unfreezes so sombody please look and see wha i did wrong.



: //script for chest with metas axe in



: void main( void)



: {



:  preload_seq(175);



: }



: void hit ( void )



: {



:  freeze(1);



:  //play noise



:  



:  int &hold = sp_editor_num(&current_sprite);



:  playsound(7, 22500, 0, 0, );



:  if (&hold != 0)



:  {



:   //this was placed by the editor, lets make the chest stay open



:   editor_type(&hold, 4);



:   editor_seq(&hold, 175);



:   editor_frame(&hold, 4);



:   //type means show this seq/frame combo as background in the future



:  }



:  &save_x = sp_x(&current_sprite, -1);



:  &save_y = sp_y(&current_sprite, -1);



:  



:  sp_seq(&current_sprite, 175);



:  sp_script(&current_sprite, "");



:  sp_notouch(&current_sprite, 1);



:  sp_nohit(&current_sprite, 1);



:  



:  // get the axe



:  



:  playsound(21, 50000, 0, 0, );



:  add_item("Item-axe, 438, 06");



:  wait(1);



:  say_stop("I GOTS METAS AXE", 1);



:  wait(1);



:  unfreeze(1);



:  



: }



Not sure if this will help, but your playsound line doesn't have the 5th value which it requires.  Maybe the script terminates because of that?
Re: screwy scripts
I also noticed another one or even two problems.



1. add_item("Item-axe", 438, 06);



instead of



  add_item("Item-axe, 438, 06");



2. sp_script(&current_sprite, "");



I still don't quite know how this works. I assume this command detaches the script from the sprite, but then where is the script going to attach? It is very likely that the script would disappear. Since you have

wait(1);

say_stop("I GOTS METAS AXE", 1);

wait(1);

  unfreeze(1);

after sp_script(&current_sprite, ""); the task might have finished before it reaches unfreeze(1).



Usually I put a script_attach(0) or a script_attach(1000) after all commands related to &current_sprite are done. And then put a kill_this_task() in the end to kill the task manually.