Things dont happen in order ??

Started by SinSin, Fri 18/05/2007 19:41:42

Previous topic - Next topic

SinSin

I have this wierd problem that things dont happen the way they should do
With this i mean by the following
Code: ags
  // script for Hotspot 2 (Play): Any click on hotspot
FadeOut (5);
Player.ChangeRoom(9, 41, 90);
Wait (100);
FadeIn (5);

This should make the screen fade out quite quickly
Change the room and set the character at the given coords
wait for 100 game cycles
Fade in quite quickly

This to my understanding reads correct but what happens is this

Fade out
Wait
Fade in
Switch rooms
Fade in again

WTH is going on ive read the manual  and this seems correct or am i wrong

Sin
Currently working on a project!

Ghost

I read somewhere that AGS does some of its internal routines in a fixed order that overrides scripts, so the problem's probably that you call all code from one room while part of it should apply to another room.
Maybe you could call the wait command in the "before fade in" section of the room you're transporting the player to? Should work.

Ashen

I guess you missed this bit of the manual:
Quote from: Character.ChangeRoom
IMPORTANT: This command does not change the room immediately; instead, it will perform the actual room change once your script function has finished (This is to avoid problems with unloading the script while it is still running). This means that you should not use any other commands which rely on the new room (object positionings, and so on) after this command within the same function.

So, the ChangeRoom executing after the FadeIn and Wait makes sense. What if you move those bits to the next room. Actually, it might fade in automatically on the room change, so just try the Wait in 'Player enters room (before fadein)' (as Ghost suggested while I was typing).
I know what you're thinking ... Don't think that.

SinSin

#3
AGS wont let me do this

I took the Part of the code saying Wait and placed it in the room 9 before fade in script
The game ran (and did the same as i stated previously except it faded again after the fist time )and after i quit it it said that it had placed the script into the after fade in actions
Currently working on a project!

SinSin

Sorted it
Took the Wait out  of the script before Fade in
And also took the fade in out of the hotspot script for Play
Lol does that make sense
::)
Currently working on a project!

SMF spam blocked by CleanTalk