Reply to Re: could use some help with my script
If you don't have an account, just leave the password field blank.
Edit: Ok I was late too, and could well be talking rubbish anyway so go with what you have now
It would probably be easier not to use the editor_stuff for something like this and just set the sequence and frame normally depending on whether the fence should be open or closed. Open/closed could be stored in a global variable, or there is a trick you can use by 'abusing' editor_seq etc....
Here:
You could just make &open into a global variable and leave out all editor stuff if you preferred, but this is a handy trick.
And I didn't test that, so I hope it works
It would probably be easier not to use the editor_stuff for something like this and just set the sequence and frame normally depending on whether the fence should be open or closed. Open/closed could be stored in a global variable, or there is a trick you can use by 'abusing' editor_seq etc....
Here:
void main (void) { //preload_seq not really needed int &donk = sp_editor_num(¤t_sprite); int &open = editor_seq(&donk, -1); //Not using editor_seq as the real sequence here, but just giving it //a value of 0 or 1 to see if the fence is open. //See further down for where this is set... //Main is run when entering the screen so you need to check here if the fence is open if (&open == 1) { //Fence open sp_pseq(¤t_sprite, 36); //sp_seq is for animations, use sp_pseq for non-moving stuff sp_pframe(¤t_sprite, 5); //same as seq and pseq sp_hard(¤t_sprite, 0); //sp_hard is weird - 0 is hard, 1 is not hard draw_hard_sprite(¤t_sprite); } if (&open == 0) { //Fence closed sp_pseq(¤t_sprite, 35); sp_pframe(¤t_sprite, 5); sp_hard(¤t_sprite, 1); draw_hard_sprite(¤t_sprite); } } void talk (void) { freeze(1); if (&open == 0) { //Fence is closed. choice_start(); "Open fence" "Leave fence" choice_end(); if (&result == 1) { //procedure for opening the fence wait(400); playsound(7, 22050, 0, 0, 0); sp_pseq(¤t_sprite, 36); sp_hard(¤t_sprite, 1); draw_hard_sprite(¤t_sprite); //Set editor_seq so it remembers if it's open or closed editor_seq(&donk, 1); &open = 1; } unfreeze(1); return; //return basically means "stop here". //So it doesn't matter that &open has just been set to 1 //because the next part won't run until you talk to the fence again. } if (&open == 1) { //Fence is open. choice_start(); "Close fence" "Leave fence" choice_end(); if (&result == 1) { //procedure for closing the fence move_stop(1, 2, 300, 1); move_stop(1, 4, 73, 1); wait(200); playsound(7, 22050, 0, 0, 0); sp_pseq(¤t_sprite, 35); sp_hard(¤t_sprite, 0); draw_hard_sprite(¤t_sprite); //Set editor_seq so it remembers if it's open or closed editor_seq(&donk, 0); &open = 0; } } unfreeze(1); }
You could just make &open into a global variable and leave out all editor stuff if you preferred, but this is a handy trick.
And I didn't test that, so I hope it works