Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: nativo on Mon 23/07/2007 02:12:30

Title: Object not visible before a message display
Post by: nativo on Mon 23/07/2007 02:12:30
I have setup a hotspot in a room and when the character talks to it a dialog is executed.  Once the character asks a certain question, this sets a global variable to true and stops the dialog.  When execution returns to the hotspot script, the next event is to run another script.  In this script, I have the following commands:

if (<global variable> == 0) {
oPohn.Visible = true;
display("some text");
}

oPohn is an object in the room.

When I test the game the message displays first and then the object becomes visible  which is the opposite of what I would expect given the order of the statements.  If I take the message out then the object becomes visible right away.  I'm at a loss to work out why this is happening and what I can do about it.

I did check the manual and the closest I could come to explaining it was the idea of blocking functions but to me, this still doesn't explain it as I was under the impression that a blocking function would not affect commands preceeding it. 

Bascially, what I'm trying to emulate is there is a statue in a room.  When the character gives a certain command to the statue it's face changes into something else and gives you some information.  I am using the object as it's face.  I am happy to hear alternative approaches to this scene as well as answers to the above problem.

Thank you!
Title: Re: Object not visible before a message display
Post by: Gilbert on Mon 23/07/2007 02:25:16
That's probably because the screen wasn't refreshed and the Display() blocked it, try adding a Wait() in between and see if it helps:

if (<global variable> == 0) {
oPohn.Visible = true;
Wait(1);
display("some text");
}

Title: Re: Object not visible before a message display
Post by: nativo on Tue 24/07/2007 03:14:54
Thanks for the help!  This worked perfectly!  I didn't think that the message would block the screen refresh.