Front end GUI

Started by Pixelton, Sat 03/04/2010 12:46:59

Previous topic - Next topic

Pixelton

I'm not so sharp when it comes to AGS script and while I am making steady progress theres still alot of black holes. At the moment I'm trying to create a main menu gui (art wise this has been done) I'm just fuzzy on the code behind the buttons.

I have a simple "Start", "Load" and "Quit" button on my main menu. The Start just needs to go to a room, while load brings up the usual load dialogue box....is obviously quite self explanatory.

For the Start button I tried using a simple 'character.ChangeRoom(2);' but that doesnt seem to do anything so I'm abit at a loss at even that simple of a task. Any help is much appreciated in getting the GUI working.

MB.
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

tzachs

Have you linked the button click event to the function?
You have to do it in the designer of the gui, select the button, and then press the lighting bolt in the right bottom area, you will see the 'click' event with a '...' button, you have to click it, it will generate the function for you and you have to put the character.ChangeRoom in there.

If you did it and it doesn't work, the only other thing I can think of is that maybe the character that you changed the room for isn't the player character.

Pixelton

oh yeah I have done that...its just not playing ball. I'm still messing about to to see if I can get it working but no luck yet.
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Danman

The way I did this. ( I don't know it is buggy or anything but I doubt it.)

I made an object that is the button. Linked it to a Any click. Then player.changeroom function.  
It works with me.  

But sounds like what tzachs said.



Pixelton

#4
ah so you made your main menu GUI from not really using the GUI functions in AGS? I only have one character and he is the playable.

----
Actually I cant seem to get any of the buttons to work...I set my quit button to:   QuitGame(1);
I expected my game to close and it didn't.... confused. I might just have to build my menu from object sprites as Danman suggested - I'm not too comfortable with GUIs - the reason for trying to make a main menu...I thought....I have to dip my toe at some point into GUI scripting.

Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

tzachs

Try to put a breakpoint in the character.ChangeRoom line (right click the line in the code editor and click on toggle breakpoint). Then run the game and press on the button, see if it stops on that line. This will let you know if the problem is with the linking of the event or something else.

There's no need to use Danman's method, the GUI should do just fine...

Also try to look at densimng tutorials about guis, maybe it could also help you:
http://www.youtube.com/user/densming#p/c/21DB402CB4DAEAEF/37/7-GeX7E0Mss
http://www.youtube.com/user/densming#p/c/21DB402CB4DAEAEF/38/801LgME8MJ0

Pixelton

Yeah the video tutorials are great, I;ve already watched through them about 4 times now :) great learning material.

I put a breakpoint in my change room function and on clicking the button I dont get any kind of feedback so it looks like its just not linked (this is also the same for the Quit button).
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

tzachs

When you're in the designer and press on the lighting bolt for your button, is the name of the function written next to the click identical to one of your function with the changeroom? Is the function located in the global script?
Try also to delete the function name and pressing the '...' again and placing the code there again...
If that still doesn't help, maybe you can upload a sample project with the problm, and I'll try to look at it.

Pixelton

Yes I have checked over my functions and it all seems correct...bare in mind my script knowledge is pretty bad still so it could well be wrong in a number of areas.

Here is a link to the project file.

www.blacktreeuk.net/download/Visitors.zip

Thanks for this Tzacks I'm sure you have better things to do with your time! haha.

Mark.
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Khris

Set gMain's Clickable property to true :)

Pixelton

oh boy...that simple :(

I have noticed a strange behaviour with the load save game window whe nits called using my gMain GUI. When the window is displayed it's buttons (cancel & Restore) dont seem to be working. Am I going about calling the load screen in the correct way or is there another kind of command I need to be using instead of   show_restore_game_dialog();

Cheers Guys your all stars!
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Matti

You can't click the buttons because the load GUI is behind the gmain GUI. Set the loading GUI's zOrder to something higher than 1.

Pixelton

Ah great just saw the draw order property, thanks for that...you guys have really helped me out...like a crash course in AGS GUIs! hehe

Cheers Guys.
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

SMF spam blocked by CleanTalk