Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: jg23666 on Mon 16/09/2013 00:06:27

Title: Creating a Custom Icon Bar
Post by: jg23666 on Mon 16/09/2013 00:06:27
I would like to create a custom icon bar with only three buttons: "Look", "Inventory", and "Control Panel".  I have a few questions about how to go about this and I didn't see the answers in the manual.  any help would be greatly appreciated!

1. I have started with the default template.  I would like to delete the unneeded buttons, like "walk", from the icon bar.  According to the manual and wiki, "To delete a GUI button, right-click it and choose Delete."  However if I do this, the game refuses to run, reporting an error like "GlobalScript.asc(338): Error (line 338): undefined symbol 'btnIconSave'".  How can I delete the unneeded buttons without breaking my game?

2.  The default game template seems to contain a nice Sierra-style control panel called "gPanel".  How can I add a button that goes to this panel?

3.  I want my game to have a very simple interface, where left-click interacts, right-click does nothing, and clicking the "Look" button in the icon bar displays a description for the current room.  How can I make a "look" button that displays a room-dependent description when clicked?

Title: Re: Creating a Custom Icon Bar
Post by: Ghost on Mon 16/09/2013 01:35:01
Hi there! The problems you're facing are common (and have been asked a couple of times already), but still:

1) When you delete a button (or any GUI element, or GUI), and there are still references to it in any of AGS's script files, the game will refuse to run. If you delete a button that is referenced in the script, you need to remove these references, too! There is no workaround here; you need to do that manually.

2) gPanel is a GUI and GUIs have a "Visible" property. All you need to do is to create a button and add the following command to it's script:
Code (ags) Select

    gPanel.Visible = true;

Note: you'll need a way to make gPanel invisble again!

3) There are several ways to achieve this. One quite simple way is a CUSTOM PROPERTY. There is more detail about them in the manual, but basically it works like this:
Create a new custom property of type string, call it "Description", limit it to "Rooms", and then make a button with the following code:
Code (ags) Select

    String description = Room.GetTextProperty("Description");
    Display("The room's description: %s", description); // make a "Display"