Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Rui 'Trovatore' Pires on Sun 22/05/2005 13:01:26

Title: Question about priority in script - should this happen? [SOLVED]
Post by: Rui 'Trovatore' Pires on Sun 22/05/2005 13:01:26
Ok, I have the following code:

Ã,  Ã,  butContinueCtrl.NormalGraphic=58;
Ã,  Ã,  Wait(40);
Ã,  Ã,  gCtrlpanel.Visible=false;
Ã,  Ã,  mouse.Mode=eModeLookat;

Pretty simple. But oddly, and against what I would expect, the "Wait" command is the last thing to be executed. The GUI is turned off, and the mouse mode is changed (I don't know about the button, because that button is a part of the turned off GUI)...and THEN the game waits for 40 cycles before continuing. Is this supposed to happen?
Title: Re: Question about priority in script - should this happen?
Post by: Pumaman on Sun 22/05/2005 15:11:47
Are you sure you haven't got any other code somewhere else that could be causing it?

Can you provide an example game that has the problem?
Title: Re: Question about priority in script - should this happen?
Post by: Rui 'Trovatore' Pires on Sun 22/05/2005 15:23:53
Ok, uploading. While it's uploading, though, I have to say that I can't think of ANY code that might make the Wait to be processed last. I'll edit this when I have the download links (if I can upload them, that is. That is sometimes problematic)

EDIT - Ok, here it is. Sorry that it has to be 2 files. I saved it as a template, I found it the best way to make sure all the essentials are there.

http://12.22.230.41/MicroTech/Host/Files/Problem.part01.rarÃ,  Ã,  Ã,  Ã,  Ã, 
http://12.22.230.41/MicroTech/Host/Files/Problem.part02.rar

In order to see what I mean, in the first screen choose Start Game (ignore all those "file not found" errors that will pop up), and in the second screen move the cursor to the top right and click on the "Control Panel" button that'll pop up. In the control panel, press "Continue", on the lower left. What SHOULD happen, as per code, is that the graphic gets changed, the game should halt for one second, and then the GUI should turn itself off and the mouse mode should change back (it's a "pointer" for the GUI). Instead, what will happen is that the GUI, mouse and button changes happen at the same time, and after THAT the game waits for 40 cycles. You can try it out by trying to access either the control panel IMMEDIATELY after you close it, or by checking out the hotspot in the mirror (an object in that room), which should highlight the cursor UNLESS the game is paused or "Wait"ing.

Oh - I used the newest beta, the Refresh 2, but I upgraded mid-way - when I originally posted this I still used the first Refresh.

EDIT 2 - Oh, sorry. The code for that button can be found between lines 303 and 337 of the GLobal Script - I'm using a common "script" for all buttons in some things.
Title: Re: Question about priority in script - should this happen?
Post by: Pumaman on Sun 22/05/2005 16:30:47
Ah ok, this is just because you have the "When interface disabled" set to "GUIs Turn Off" in the game General Settings. That setting determines what happens while in a Wait(), so the GUI is being removed.
Title: Re: Question about priority in script - should this happen?
Post by: Rui 'Trovatore' Pires on Sun 22/05/2005 16:36:35
...gah. Ain't it amazing the things you overlook sometimes. Thanks.

<wears the DUNCE cap and goes sit in the corner>
Title: Re: Question about priority in script - should this happen? [SOLVED]
Post by: Pumaman on Sun 22/05/2005 16:44:57
Hehe don't worry, it took me a while to work it out as well  ;)
Title: Re: Question about priority in script - should this happen? [SOLVED]
Post by: Rui 'Trovatore' Pires on Sun 22/05/2005 16:56:28
<gives half of the hat to Pumaman>

;D

(j/k, accourse)