Simple question: Using GUI.Visible

Started by wynni2, Wed 18/06/2008 05:33:35

Previous topic - Next topic

wynni2

this is an awfully simple question, and i'm actually a little embarrassed that i can't solve it. 

i made a gui that follows the mouse, displaying the name of the object under the cursor.  it works fine, but i only want this function to work in certain rooms.  so i set gFloatText.Visible=false; in the game_start function of Global.asc.

right now i'm just doing a single room to experiment with the program, and i want said gui to be visible in this room.  so at the top of the room script i added  a function that includes gFloatText.Visible = true; . 

when i test my game however, the gui is not visible.  i assume i'm missing some fundamental detail here, but i have no idea what. 


Gilbert

By "so at the top of the room script i added  a function that includes gFloatText.Visible = true;" I suppose you just added a function with random name containing the line. It doesn't work that way, as when does a function get executed depends on when you tell the game engine to, not by where it's located in a script.

To make the GUI visible for that particular room, you need to do it after the room is loaded. To do this, (assuming you are using AGS V3.0+) load up the room in the editor, click the 'events' icon (the lightning icon) in the bottom right info panel, select 'Enters room after fade in', click the '...' button on the right, the editor will fill-in automatically a name for the function for you and open the script editor, where you can add the line of code in.

Note also that as you only want the GUI to be visible in some specific rooms, you may turn it off when the player leaves the room, this can be done by setting the GUI's Visible property back to 'false' in the 'Leaves room' event.

wynni2

thanks, i figured i was missing something fundamental like that.

SMF spam blocked by CleanTalk