Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Estaog on Sat 19/03/2005 22:37:28

Title: Gui wont show up.
Post by: Estaog on Sat 19/03/2005 22:37:28
I feel kinda stupid for asking this, but the gui wont show up:

(http://www.2dadventure.com/ags/Error.gif)

Now "persistent" should mean it will me be there from the beginning, but it just wont show up. The other gui shows up no problem. Is there something I forgot to do?
Title: Re: Gui wont show up.
Post by: DoorKnobHandle on Sat 19/03/2005 22:41:52
It is showing up - but off-screen... That means, that your x and y coordinates are so high, the gui is outside the screen.

You have to use coordinates from 0 to 320 for x and from 0 to 200 for y, whatever your resolution is! The point ( 0, 200 ) for example is always the left lower corner...
Title: Re: Gui wont show up.
Post by: Estaog on Sat 19/03/2005 22:51:29
Ahh thanks forgot that, Now that this is solved, i have another problem, how do i tell it to show a variable (instead of the "@error@")?
Title: Re: Gui wont show up.
Post by: DoorKnobHandle on Sat 19/03/2005 22:56:02
double post ;)

now that is somewhat advanced...

here we go:

- you create a 'gui label' element on your gui.
- you select it and memorize it's id number (you can see it in the object properties window title!). Let's assume it is object 4 for this example...
- now you go in your script.
- and into your repeatedly execute function...
- there you add this somewhere between the brackets:


function repeatedly_execute ( )
{
   // somewhere in this function add this line
   SetLabelText ( 1 , 4, var );
]


This sets the label number 4 on GUI number 1 to the string variable 'var' every game cycle...

Ask if you need further help!

Title: Re: Gui wont show up.
Post by: Estaog on Sun 20/03/2005 08:00:16
Wait, those it have to be a string, or can I use an integer? Because strings cannot be imported into rooms and such, which is what I want.
Title: Re: Gui wont show up.
Post by: DoorKnobHandle on Sun 20/03/2005 10:56:18
If you want to display an integer value, you will have to convert it!


string buffer;
StrFormat ( buffer, "%d", var );
SetLabelText ( 1,  4, buffer );


This piece creates a string variable named 'buffer', then it fills 'buffer' with the content from your int variable 'var' and then it prints it out on GUI 1, object 4...

Is that what you needed?
Title: Re: Gui wont show up.
Post by: Estaog on Sun 20/03/2005 12:02:52
Yep, works fine now.

Another problem: The test game function doesn't seem to work properly with my new computer. About 1/4 times I run it acts all weird. Like for when I quit it a small white window appears in the corner, like the game didn't exit properly, and then I have to use the "end now" function. Also sometimes it gives me an error that the engine didn't close properly, and that I should write here if the problem persists. I know the test game function doesn't work well with some computers, but i just wanted to know if I could fix it or something.
Title: Re: Gui wont show up.
Post by: MrColossal on Sun 20/03/2005 23:43:32
I personally never use test game because it can cause problems, I just leave the compile folder open on my desktop and run the game from there, hitting test game doesn't really save me any more time than going "alt tab, click click"
Title: Re: Gui wont show up.
Post by: Estaog on Mon 21/03/2005 13:28:38
Yea i guess so.