Author
|
Topic: Script troubles
|
bdjnk |
posted 01-16- 06:32 PM CT (US)
I have this prob in my d-mod where I will have one script that needs to run on one sprite and the imediatly after have another sprite to run their script. As it is now the second script only runs once dink leaves and comes back into the screen. If anyone understood that, help me out and tell me how you think I should work it.
|
Beuc
|
posted 01-17- 06:14 AM CT (US)
I didn't really understood... Could you reformulate? |
bdjnk
|
posted 01-18- 09:21 PM CT (US)
what i want to have happen is as follows:a certain sprite to run a certain script when dink talks to it and for it to change the vision 1, easy. as soon as the above script finishes. i want a different script to run on a different sprite (only seen in vision 1). the way it is now the vision 1 sprite only runs it's script once dink leave a reenters the screen. i was thinking that there must be a straight forward command to do that but i searched through DinkCEd.hlp and the closest to what i want to do is sp_script(); which doesn't help at all. i was thinking that maybe i could make the base script tell both seprate scripts to run one after the other. or maybe there is a command to call up a different sprite's script and i just can't find it. please help a poor old fool out. |
Nexis
|
posted 01-19- 12:09 AM CT (US)
I didn't understand the question until it was rephrased too Beuc.Well anyways there's several diffent ways of doing it. First of all, visions can't be changed except in the base script which means that you basically have to reload the script to get that to work. My suggestion would be to not use visions and just create the sprite (there's some dink command that does it but I don't know what it is) and then attach the script to it (sp_attach I think). Of course this really only works well if you only have a few sprites and little or no difference between the screens. If you do have many things in the other visions then you'll want to reload the screen which can be done with a few commands that I don't remember. |
Drakeman
|
posted 01-19- 05:23 AM CT (US)
So Dink talks to some sprite (dude1), and then this makes another sprite (dude2) appear - if I understand things.You don't have to use visions, just put all the sprites there using the editor... then the dude2 is made invisible using the sp_nodraw() command in it's main if Dink hasn't talked to dude1. Once dude1 conversation has finished, just make dude2 sp_nodraw to 0. (To do this from the dude1 script you need to set a global variable to the sprite number of dude2 - something like &temphold = & current_sprite, in the main of the dude2 script, then in the dude1 script you do sp_nodraw(&temphold, 0) and up pops dude2.) I used sp_nodraw lots of times in SOB, and visions only rarely. |
bdjnk
|
posted 01-19- 01:48 PM CT (US)
you got the first part but let me rephrase againDink talks to some sprite (dude1), and then this makes another sprite (dude2) appears and imediatly run it's script. the dink engine only runs scripts if you activate them somehow, I want to know if there is a command for activating the script of (dude2) from within the script of (dude1) or somehow make (dude1)'s script autorun after (dude2)'s |
bdjnk
|
posted 01-19- 01:50 PM CT (US)
sorry, ignore the last post, i was tired and it is all messed up.I will figure it out eventualy. |
Drakeman
|
posted 01-19- 04:11 PM CT (US)
To make one script run from within another use external("script", "procedure"); or spawn("script"); Depending on if the "script" needs to run independantly or not.I think you need to use the external command here, but I could be wrong. So I'd put whatever you want dude2 to do once he gets activated in some procedure, will call it "dude2action" so you would go sp_nodraw(&temphold, 0); external("dude2", "dude2action"); //probably set some global variable to indicate that dude2 is now active from here on in, here too. &d2awake = 1; Does this help, or have I missed the plot entirely?
|
bdjnk
|
posted 01-19- 04:58 PM CT (US)
i figured out the prob by doing the following:int &girl; &girl = create_sprite(377, 127, 0, 0, 0); sp_pseq(&girl, 251); sp_pframe(&girl, 1); sp_script(&girl, "s1-girl"); and so the girl didn't even exist untill i ran the first script and by once you have an int which represents a seperate sprite sp_script(); works just fine. YES! I am a genius. (ok, not really, I noticed this was how seth made the store clerks in the original.) |