📧 Message Board Archive

scripting a seq.
So I have this door that I want to open when a lever on the wall is turned. I can remove the hardness o.k. ,but the seq. of the door swinging open is attached to the warp thing. Is there a way to script that seq. without a warp?Thanks....Ric
Re: scripting a seq.
:  So I have this door that I want to open when a lever on the wall is turned. I can remove the hardness o.k. ,but the seq. of the door swinging open is attached to the warp thing. Is there a way to script that seq. without a warp?Thanks....Ric



There sure is!  There are tons of different ways to it, too.  Now, since I'm going on a limited amount of information here, I'll just tell you how I'd make this work.  



It'll be in the post after this one, just to let people know I got this question covered.
Scripting the Switch
:  So I have this door that I want to open when a lever on the wall is turned. I can remove the hardness o.k. ,but the seq. of the door swinging open is attached to the warp thing. Is there a way to script that seq. without a warp?Thanks....Ric



First of all, I'd use one script, and I'd have it attached to the switch, let's call it "lever.c".  Now, within that script's main, we'd want to create the door, this will eliminate the need for creating the door in the DinkMapEditor.  By creating the door through the script we gain more control over it (ie. we'll already have an identifier, "&door", for the door)



Here's an example:



void main()

{

 preload_seq(840);

 int &door = create_sprite(164, 40, 0, 840, 1);

 sp_hard(&door, 0);

 draw_hard_sprite(&door);

}



Keep in mind that you'll probably have to change the non-zero values to fit your door's sequence and coordinates on the map.  Also, I've found that it's very important to add the preload_seq() command when you want to instantly create something with hardness.



Now, in the same script, we add something like the following:



void talk()

{

 sp_seq(&door, 840);

 sp_hard(&door, 1);

 draw_hard_sprite(&door);

}



This opens plays the door opening sequence, and removes its hardness.  Just remember that the number in the "sp_seq" will be the same as the door's.





This is probably more than you wanted to know, but it should give you some insite on advanced scripting that will help out a ton on procedures such as these.  Feel free to post again if this didn't help out. :)
more info?
: : So I have this door that I want to open when a lever on the wall is turned. I can remove the hardness o.k. ,but the seq. of the door swinging open is attached to the warp thing. Is there a way to script that seq. without a warp?Thanks....Ric



: There sure is! There are tons of different ways to it, too. Now, since I'm going on a limited amount of information here, I'll just tell you how I'd make this work.



: It'll be in the post after this one, just to let people know I got this question covered.



The door script has a loop looking for a &var change, If &var changes, sp_hard(1), and hopefully I can make the door swing open. I can also layer a door and change dot depth, but it doen't look as natural cause the door just skips from first frame to last.  
Advanced Scripting is the Key.
:  The door script has a loop looking for a &var change, If &var changes, sp_hard(1), and hopefully I can make the door swing open. I can also layer a door and change dot depth, but it doen't look as natural cause the door just skips from first frame to last.



Ah, then the above post should help you out majorly.  It sounds like you don't really need the &var, the loop, or even a script for the door!
Yes ...............
: : The door script has a loop looking for a &var change, If &var changes, sp_hard(1), and hopefully I can make the door swing open. I can also layer a door and change dot depth, but it doen't look as natural cause the door just skips from first frame to last.



: Ah, then the above post should help you out majorly. It sounds like you don't really need the &var, the loop, or even a script for the door!



Thats the info I was hoping for , thanks once again! Now Dink can break Martridge out of Jail with style.....
hmm...
void main ()

{

preload_seq(50);

int &door = create_sprite(492,219,5,50,1);

sp_hard(&door,0);

draw_hard_sprite(&door);

}

void talk ()

{

choice_start()

"Turn handle?"

"Leave"

choice_end()

 if (&result == 1)

 {

 sp_seq(&door,50);

 sp_hard(&door,1);

 draw_hard_sprite(&door);

 }

}

//well is brain 5 o.k.? (kill seq, leave last frm.) when I run this the door is created (hard) but talking didn't bring up the choice. See anything wrong? thanks........



Re: hmm...
: void main ()



: {



: preload_seq(50);



: int &door = create_sprite(492,219,5,50,1);



: sp_hard(&door,0);



: draw_hard_sprite(&door);



: }



: void talk ()



: {



: choice_start()



: "Turn handle?"



: "Leave"



: choice_end()



:  if (&result == 1)



:  {



:  sp_seq(&door,50);



:  sp_hard(&door,1);



:  draw_hard_sprite(&door);



:  }



: }



: //well is brain 5 o.k.? (kill seq, leave last frm.) when I run this the door is created (hard) but talking didn't bring up the choice. See anything wrong? thanks........



I tinkered and found out for myself brain 0 is it . thanks again.