FadeOut/FadeIn woes (yes, this old chestnut again...)

Started by paolo, Sun 14/09/2008 10:31:05

Previous topic - Next topic

paolo

I'm having problems with my script actions happening in the right order with FadeOut and FadeIn. This question has been asked before several times on this board, and I'm aware that FadeOut and FadeIn work in mysterious ways :D but I don't see anything that helps me with my problem.

Here's what I want to do:

* Fade to black
* Wait a moment
* Change character's views
* Fade back up

The idea is that the character gets changed while the screen is faded out.

Here's my (slightly disguised) code:

Code: ags

FadeOut(2);
Wait(10);
cFred.ChangeView(3);
cFred.SpeechView = 4;
FadeIn(2);
Display("blah blah blah");
cFred.Say("Fred says something here.");


And here's what happens:

* Screen fades to black
* Game pauses (verified by changing 10 to 100)
* Screen fades back in
* "blah blah blah" is displayed
* Fred's view changes
* Fred says "Fred says something here."

So the views are changed after the FadeIn and Display commands have executed, as if changing view has to wait for blocking actions to complete. Is this true? How can I get this to work without messing around with testing stuff in repeatedly_execute (which would probably work, but seems to be unnecessarily complicated)?

I'm using v2.71, by the way.

Thanks for any help.

Akatosh

I'm not sure if that helps in this case, too, but sometimes such problems can be fixed by inserting a Wait(1); at the right point (after changing the views) so the game engine has time to update.

paolo

Quote from: Akatosh on Sun 14/09/2008 10:40:06
I'm not sure if that helps in this case, too, but sometimes such problems can be fixed by inserting a Wait(1); at the right point (after changing the views) so the game engine has time to update.

Flaming Nora, would you believe it, it worked!

I am surprised, because I know of this trick for functions that can block optionally (that is, functions that have an eBlock/eNoBlock parameter) but this is not the case for ChangeView.

Thank you so much! You've just saved me from hours of debugging hell.

SMF spam blocked by CleanTalk