Hey people!
I've searched the forums for solutions to my problem, and after trying them, I still don't have any success. The AGS help file doesn't seem to address this, as far as I could find.
Here's my problem:
After importing my own graphics to use as GUI buttons to the ICONBAR GUI, I noticed that the inventory item picture that normally appears within the selected item icon (the blackened icon) no longer appears. It does in the sample game that comes with AGS.
Someone in the forum here suggested using the (INV) tag in the button's text. I tried is, and noticed that it makes two distorted images of the item appear. This is highly undesirable.
Someone else suggested using the SetInvDimensions(XX,XX); tag under the function game_start() tag. After testing, I didn't notice any improvements.
I can only assume that this is a scripting oversight, or that the problem occured durring the import of my custom graphics, since it WAS working prior to that.
My game is in 640 x 480 in High Color.
My global script is as follows:
=====================================
// main global script file
#sectionstart game_start // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
// called when the game starts, before the first room is loaded
GUIOff(STATUSLINE);
GUIOff(ICONBAR);
CentreGUI(QUITWINDOW);
CentreGUI(CONTROLPANEL);
CentreGUI(RESTARTWINDOW);
CentreGUI(INVENTORY);
SetInvDimensions(65,30);
}
#sectionend game_start // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
// put anything you want to happen every game cycle here
}
#sectionend repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
function show_inventory_window () {
// This demonstrates both types of inventory window - the first part is how to
// show the built-in inventory window, the second part uses the custom one.
// Un-comment one section or the other below.
/*
// ** DEFAULT INVENTORY WINDOW
InventoryScreen();
*/
// ** CUSTOM INVENTORY WINDOW
GUIOn (INVENTORY);
// switch to the Use cursor (to select items with)
SetCursorMode (MODE_USE);
// But, override the appearance to look like the arrow
SetMouseCursor (6);
}
#sectionstart on_key_press // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {
// called when a key is pressed. keycode holds the key's ASCII code
if (IsGamePaused() == 1) keycode=0; // game paused, so don't react to keypresses
if (keycode==17) QuitGame(1); // Ctrl-Q
if (keycode==363) SaveGameDialog(); // F5
if (keycode==365) RestoreGameDialog(); // F7
if (keycode==367) RestartGame(); // F9
if (keycode==434) SaveScreenShot("scrnshot.bmp"); // F12
if (keycode==9) show_inventory_window(); // Tab, show inventory
if (keycode==19) Debug(0,0); // Ctrl-S, give all inventory
if (keycode==22) Debug(1,0); // Ctrl-V, version
if (keycode==1) Debug(2,0); // Ctrl-A, show walkable areas
if (keycode==24) Debug(3,0); // Ctrl-X, teleport to room
}
#sectionend on_key_press // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart on_mouse_click // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}
}
#sectionend on_mouse_click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart interface_click // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
if (interface == ICONBAR) {
if (button == 4) { // show inventory
show_inventory_window ();
}
else if (button == 5) { // use selected inventory
if (character[ GetPlayerCharacter() ].activeinv >= 0)
SetCursorMode(4);
}
if (button == 6) {
GUIOn(CONTROLPANEL);
}
} // end if interface ICONBAR
if (interface == INVENTORY) {
// They clicked a button on the Inventory GUI
if (button == 1) {
// They pressed SELECT, so switch to the Get cursor
SetCursorMode (MODE_USE);
// But, override the appearance to look like the arrow
SetMouseCursor (6);
}
if (button == 2) {
// They pressed LOOK, so switch to that mode
SetActiveInventory(-1);
SetCursorMode(MODE_LOOK);
}
if (button == 3) {
// They pressed the OK button, close the GUI
GUIOff (INVENTORY);
SetDefaultCursor();
}
if ((button == 4) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)) {
// scroll down
game.top_inv_item = game.top_inv_item + game.items_per_line;
}
if ((button == 5) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - game.items_per_line;
}
}
if (interface == CONTROLPANEL) {
if (button == 1) { // save game
GUIOff(CONTROLPANEL);
SaveGameDialog();
}
if (button == 2) { // load game
GUIOff(CONTROLPANEL);
RestoreGameDialog();
}
if (button == 3) {
GUIOff(CONTROLPANEL);
GUIOn(RESTARTWINDOW);
}
if (button == 4) {
GUIOff(CONTROLPANEL);
GUIOn(QUITWINDOW);
}
if (button == 5) {
Display("Adventure Game Studio v2 by Chris Jones.");
}
if (button == 6) {
Display("Project Scooter Technical Demo v0.1 - 2005 Constructive Chaos");
Display("For updates, please visit www.constructivechaos.net.");
Display("Created using AGS.");
Display("Thank you for playing!");
}
if (button == 7) {
GUIOff(CONTROLPANEL);
}
}
if (interface == RESTARTWINDOW) {
if (button == 0) {
RestartGame ();
}
if (button == 1) {
GUIOff(RESTARTWINDOW);
}
}
if (interface == QUITWINDOW) {
if (button == 0) {
QuitGame(0);
}
if (button == 1) {
GUIOff(QUITWINDOW);
}
}
}
#sectionend interface_click // DO NOT EDIT OR REMOVE THIS LINE
=====================================
Thanks people! Any help would be great.
-Craig
What you should do is find the relevant button in the GUI editor, and put some text on it: @INVSHR@ for instance. You should search the manual for it as there are some variants on it.
Thanks for replying! Problem solved. ;D
However, the proper tag is (INVSHR), not @INVSHR@. I did eventually find this in the help file, although it was VERY tough to find.