an eNoBlock animation will never happen

Started by bx83, Sun 25/02/2018 23:17:38

Previous topic - Next topic

bx83

I've probably asked this before, but humour me.

I'm trying to run an animation at the begining of each question in a dialog:

Code: ags

@2
cJulius.LockView(82);
cJulius.Animate(2,0,eOnce,eBlock);
cJulius.SayBubble("&1301 'What's your favourite character?'");
...


However, the animation is a bit too long - ~2 seconds. Because it's blocking, I can't skip it, even as it delays every single question. BUT If I change it to eNoBlock, it doesn't happen.
Same for the following:

Code: ags

@1
cJulius.LockView(82);
while (!cJulius.Animating) {
	cJulius.Animate(2,0,eOnce,eNoBlock);
}


and

Code: ags

@1
cJulius.LockView(82);	//read's script
cJulius.Animate(2,0,eOnce,eNoBlock);
cJulius.UnlockView();


and

Code: ags

@1
cJulius.LockView(82);	//read's script
cJulius.Animate(2,0,eOnce,eNoBlock);
*all the other lines*
cJulius.UnlockView();


Basically, how can I get a NoBlocking view to just play, once; but if I click or press space-bar it moves on instantly to the next animation (talking)?

bx83

(Also tried with the second argument to animating to 1; 0 is illegal. Same thing; animation doesn't play.)

Crimson Wizard

#2
Ofcourse non-blocking animation does not play, there is SayBubble right after, which probably starts speech animation for the same character.


Whenever you want player to be able to skip over a blocking sequence, use cutscene:
Code: ags

StartCutscene(eSkipAnyKey);
cJulius.Animate(2,0,eOnce,eBlock);
EndCutscene();

not completely certain if it works in dialog script, but hopefully it does.



Only for the information, if you still want to use non-blocking animation (maybe in another place), the way to wait for non-blocking animation is this:
Code: ags

cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating){
    Wait(1);
}


But if you want it to be skippable, inside cutscene:
Code: ags

StartCutscene(eSkipAnyKey);
cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating && !Game.SkippingCutscene){
    Wait(1);
}
EndCutscene();


If there is no cutscene, you may do something like this -
Code: ags

cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating && !IsKeyPressed(eKeyEscape)){
    Wait(1);
}

Which may be improved by replacing IsKeyPressed with some function that detects all keys and mouse clicks necessary. AFAIK there was some module that was doing checks, but I cannot remember it right away.



bx83

QuotecJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating){
    Wait(1);
}

Doesn't work (in a dialogue script).

QuoteStartCutscene(eSkipAnyKey);
cJulius.Animate(2,0,eOnce,eBlock);
EndCutscene();

Doesn't work; can't skip seen, even though a timer doesn't appear.

QuoteStartCutscene(eSkipAnyKey);
cJulius.Animate(2,0,eOnce,eNoBlock);
EndCutscene();

Doesn't work, animation doesn't play (for more than one frame).

QuoteStartCutscene(eSkipAnyKey);
   cJulius.Animate(2,0,eOnce,eNoBlock);
   while (cJulius.Animating && !Game.SkippingCutscene){
      Wait(1);
   }
EndCutscene();

Doesn't work; timer appears, doesn't allow skipping.

QuotecJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating && !IsKeyPressed(eKeyEscape)){
    Wait(1);
}

DOES WORK - in a dialogue script, anyway. Now I start the journey of finding out how to say 'If the user clicks the left mouse button'...

bx83

QuotecJulius.LockView(82);   //'reading script' animation
cJulius.Animate(2,0,eOnce,eNoBlock);
while (cJulius.Animating && !WaitMouseKey(1)){
    Wait(1);
}

This works, and wait's for a mouse button :)

SMF spam blocked by CleanTalk