This one's got me stumped...I have a hotspot in one room that when clicked is supposed to bring up a GUI window (gReflect) that's set to Popup Modal. Depending on what a certain global variable is set to (0 or 1) it will bring up one of two different images for the GUI background.
However, for some reason when I use the "gReflect.Visible = true;" command, nothing happens. The game just carries on through the scripting, displaying text and so on, but the GUI never appears. The global variable part works, and alters the text displayed, etc. accordingly. The GUI just doesn't go visible. Is this some specific condition of hotspots or something I don't understand?
No, not some special hotspot thing that I'm aware of. Can you post the code you're using?
Also, could there be some other code (e.g. in repeatedly_execute) that's turning the GUI back off? Can you get it Visible in anotehr way (with or without the rest of the script used)?
It pretty much says (parascripting from memory : ) in the "Look at Hotspot" script:
if (GetGlobalInt(23) == 0) {
Display("You take a closer look at the mirror...");
gReflect.Visible = true;
Wait(60);
Display("Hmmm. You can't see much from this angle.");
gReflect.Visible = false;
}
else if (GetGlobalInt(23) == 1) {
Display("You take another look in the mirror...");
gReflect.Visible = true;
Wait(60);
Display("Ah hah! Now you can see what that creep is up to!");
gReflect.Visible = false;
}
The dialogue's been made vague and cheesy to protect the puzzle a bit, but otherwise that's exactly it. It flows through the displaying of text just like it should, but the GUI never comes up. I've noticed sometimes in AGS certain scripting commands get run out of order (like the FaceCharacter command not getting run until after text displays, even if you set it to EBlock and put it before the Display command...weird, huh?) That's the only other thing I can think of, maybe it's somehow making it immediately false again before the text displays?
I just set up a quick test game with the code you posted and it worked no problem.
As Ashen already suggested, can you make it visible with gReflect.Visible=true at all?
Check your repeatedly_execute and especially repeatedly_execute
_always functions, that you aren't constantly disabling this GUI within there by any chance.
Also, put
Display("gReflect.Visible=%d", gReflect.Visible); just right after Wait(60) and before anything else. What does it report?
QuoteI've noticed sometimes in AGS certain scripting commands get run out of order (like the FaceCharacter command not getting run until after text displays, even if you set it to EBlock and put it before the Display command...weird, huh?)
Yeah, some functions work in a delayed-response fanshion, others just don't instantly update the screen (such as FaceCharacter under certain conditions):
Quote from: Manual: Character.FaceCharacterIf the character does not have Turning enabled, he will immediately turn to face the new direction and the BlockingStyle parameter has no effect. In this case, the screen will not be refreshed straight away -- if you want to see the character facing his new direction immediately, call Wait(1);
If I add in the Visible command just by itself at "Player Enters, After Fadein", it shows up just fine, so I know it *can* be seen...hmmm...
When I plugged in the Display line, Scorpiorus, it said that it equalled 1 (even though the GUI was still not visible).
Woah, okay, this is weird...I just tried //comment-ing out the gReflect.Visible = false; line at the end. That time the GUI popped up, but not until after all the text had been displayed and it should have been done. That's why it seems not to work...it was waiting 'til the end, and immediately making it not Visible again as soon as it came up. Any idea why? And thanks again!
A popup modal gui requires that it can grab the input for itself. To do this, all scripts have to finish. Therefore, using a Wait will not work with it. I suggest setting the GUI to Normal mode.
Afaik, popup modal GUIs should work fine too.
...butÃ, Strange Visitor,
Do you have the When interface disabled general option set to GUIs turn off by any chance?
If so, any popup modal as well as normal GUIs won't be visible while the game is in blocking mode (such as with Wait).
In that case, you can either set this option to something else or just change the GUI mode to Persistent instead of Popup modal.
Ah hah! That did the trick! I turned the When Interface Disabled option to GUIs Remain Unchanged, and now the GUI window pops up and goes away exactly when it's supposed to. Thanks a ton, everyone, this thread be solved! ;D