PDA

View Full Version : Stopping program for OmegaGUI



splattergnome
20-01-2006, 12:51 AM
In my program, if you collide with certain sprites, a short script is activated which basically reads through a list of commands and runs them one by one, for example setting flags and triggers, or displaying messages to the player. However, that is the stumbling block.

Previously, I have used showmessage boxes for this functionality as a quick hack while I concentrated on other parts of the engine. However, I am using OmegaGUI now - and I made a basic dialog box which displays a text in a text field and an OK button which is used to replace the showmessage.

Here's the problem. I basically want to freeze the gameplay and timers of the game while people read the dialog boxes (no need to punish slow readers) - and I want each command of the script to be run after another. However - when I activate the GUI - well, there is no way to "freeze the game" until the person clicks on OK. The program will try to run the next command on the command list, whether it be flag setting or another dialog box.

Now, I tried a "hack", so to say, by simply addin:



// GUI Window activation above this
curGUI:=TRUE;
repeat
OmegaTimerTimer(self);
until curGUI:=FALSE;
// Deactivatation of GUI Window below this


I had hoped that this would simply run the main program loop (where there is a check to make sure that OmegaMove is not run whil curGUI) until the OK button is pressed - which would simply call curGUI:=FALSE, allowing people to freely act without progressing the main script loop... however, this didn't work - apparently OmegaGUI needs the time between ticks in order to work... I know the Window Code works as such (I tried it during start of the program to test), but I don't know what I can do to make sure that the program waits until I make a choice on the GUI.

Since this will come in handy in the future with other GUI windows popping up, I would be happy to see any help or ideas people might have to solve my problem. Thank you in advance,

splatty

LP
20-01-2006, 01:07 AM
Did you try calling Application.ProcessMessages() in your loop?

splattergnome
20-01-2006, 01:22 AM
Did you try calling Application.ProcessMessages() in your loop?

:oops:

Thank you very much, that was exactly what I needed. And I understand now what was missing - now the rest of my "scripted" GUI code will work perfectly. :-D

splatty

P.S. I am just surprised that you didn't use the opportunity to try to convert me to Afterwarp. ;)

LP
20-01-2006, 02:24 AM
P.S. I am just surprised that you didn't use the opportunity to try to convert me to Afterwarp. ;)
Why would I want that? :mrgreen: