Script Interrupted
Hello,
I'm having some new trouble with a script...
This time I want to make a cutscene that happens when the player is still controling Dink, sort of:
//Dink is teleported here from another screen
void main ( void )
{
if (&story == 8)
{
freeze(1);
say_stop("Ouch! My head!", 1);
wait(300);
say_stop("Where am I?", 1);
wait(300);
say_stop("Dang! I'm trapped!", 1);
wait(300);
unfreeze(1);
wait(5000);
//Then the guard appears and talk to Dink but there's no need for posting this

}
As you can see the script has a pause of 5 secs before the guard appears and talk to Dink, meanwhile, Dink is unfreezed, so the player can wander on the prision cell before he comes.
But if I press the "talk" button, the game interrupt the script and the player is locked forever at the cell

How can I make the script work the same way but without the interrupt problem?
after the wait(5000); use the spawn command. That's what I would've done it, like this:
wait(5000);
spawn("guard");
where "guard" is a separate script where the guard appears and Dink is frozen.
wait(5000);
spawn("guard");
where "guard" is a separate script where the guard appears and Dink is frozen.
I don't think that's what he meant, Quiz. He wants to not stop Dink talking when he presses space. Sorry, Castman. This goes so deep into DinkC that I can't help you. The most easiest way would probably be changing the script for spacebar button, but even then it would be hard.
Making a new spacebar script? That doesn't exactly sound like the easy way out.
The easy way out is by making a new global (&dstalk in this example) and setting it to 1 if you don't want the guard to come in, and to 0 if he's free to come in.
So your script looks something like this:
void main ( void )
{
if (&story == 8)
{
freeze(1);
say_stop("Ouch! My head!", 1);
wait(300);
say_stop("Where am I?", 1);
wait(300);
say_stop("Dang! I'm trapped!", 1);
wait(300);
unfreeze(1);
wait(5000);
loop:
if (&dstalk == 1)
{
wait(500);
goto loop;
}
//Here goes the rest of the script.
}
In the script you don't want to interupt you do something like this:
void talk(void)
{
&dstalk = 1;
freeze(1);
say_stop("I'm having a lengthy conversation with myself here",1);
say_stop("Conversing with yourself is normal in prison",1);
say_stop("Really!",1);
unfreeze(1);
&dstalk = 0;
}
If this is not what you meant you should check Quiztis's answer, though I wouldn't see why you'd spawn a new script, you can attach the entire script to the screen in the first place.
The easy way out is by making a new global (&dstalk in this example) and setting it to 1 if you don't want the guard to come in, and to 0 if he's free to come in.
So your script looks something like this:
void main ( void )
{
if (&story == 8)
{
freeze(1);
say_stop("Ouch! My head!", 1);
wait(300);
say_stop("Where am I?", 1);
wait(300);
say_stop("Dang! I'm trapped!", 1);
wait(300);
unfreeze(1);
wait(5000);
loop:
if (&dstalk == 1)
{
wait(500);
goto loop;
}
//Here goes the rest of the script.
}
In the script you don't want to interupt you do something like this:
void talk(void)
{
&dstalk = 1;
freeze(1);
say_stop("I'm having a lengthy conversation with myself here",1);
say_stop("Conversing with yourself is normal in prison",1);
say_stop("Really!",1);
unfreeze(1);
&dstalk = 0;
}
If this is not what you meant you should check Quiztis's answer, though I wouldn't see why you'd spawn a new script, you can attach the entire script to the screen in the first place.
I think he means that the script gets interrupted when the player presses space, that is, the part after the wait(5000); doesn't run unless Dink stays civil in his cell.
Seems kind of weird that pressing space would interrupt the script... That shouldn't happen unless it's attached to something on the screen the player can interact with, I think.
Seems kind of weird that pressing space would interrupt the script... That shouldn't happen unless it's attached to something on the screen the player can interact with, I think.
Thanks everybody ^^
Scratcher is right, during that "wait(5000)" time (5 secs) if you press the space button the script is interrupted and the next part is skipped, would be the same of adding "return;" after the "wait"... The script stops working
But the script is attached to the screen, not on sprites...
As I see, all the script examples you guys wrote here will not solve the problem... That's 'cos the changes are coming after that "wait" thing, so if I press "talk" the script will stop worknig and nothing after that 'wait' will work
I've already tried loops, variables, but that would need the script to be reactivated after the player press "talk", what I don't know how to do
I want to know how to make the script keep running without the need of freeze the player inside the prision cell.
^^
Scratcher is right, during that "wait(5000)" time (5 secs) if you press the space button the script is interrupted and the next part is skipped, would be the same of adding "return;" after the "wait"... The script stops working

But the script is attached to the screen, not on sprites...
As I see, all the script examples you guys wrote here will not solve the problem... That's 'cos the changes are coming after that "wait" thing, so if I press "talk" the script will stop worknig and nothing after that 'wait' will work

I've already tried loops, variables, but that would need the script to be reactivated after the player press "talk", what I don't know how to do

I want to know how to make the script keep running without the need of freeze the player inside the prision cell.
^^