Hey AGS land! I am in need of some help with my code for my main icon bar. I had before created my own custom quit screen It worked fine everything was going swell untill I tried to add a custom save and restore screen to it. Now the interfaces all will pop up on the screen but the buttons dont work for some apparent reason. Oh yeah and the save and load screens pop up but they don't really work either. I have mad sure to enable the left click mode to (Run Script) in the AGS GUI interface I think some of my brackets are put in the wrong places. Can anyone proof read this and tell me if it looks funky. Or if anyone has any suggestions please feel free to let me know ok. Here is my code
function interface_click(int interface, int button) {
if (interface == ICONBAR) {
if (button == 4) { // show inventory
show_inventory_window();
}
else if (button == 4) { // use selected inventory
if (character[ GetPlayerCharacter() ].activeinv >= 0)
SetCursorMode(4);
}
else if (button == 5) { // save game
GUIOn(7);
}
else if (button == 6) { // load game
GUIOn(8);
}
else if(button == 7) { //
GUIOn(3);
int quit_message = Random(6);
if(quit_message==0) {
SetLabelText(3, 1, "Oh I'm sorry! A Little Too Much?");
SetButtonPic(3, 2, 1, 386);
}
else if (quit_message==1) {
SetLabelText(3, 1, "Once a Poser! Always a Poser!");
SetButtonPic(3, 2, 1, 386);
}
else if (quit_message==2) {
SetLabelText(3, 1, "Signing up are we?");
SetButtonPic(3, 2, 1, 389);
}
else if (quit_message==3) {
SetLabelText(3, 1, "Crashed Out!");
SetButtonPic(3, 2, 1, 390);
}
else if (quit_message==4) {
SetLabelText(3, 1, "Going to Work?");
SetButtonPic(3, 2, 1, 388);
}
else if (quit_message==5) {
SetLabelText(3, 1, "Bitchin out?");
SetButtonPic(3, 2, 1, 387);
}
else if (quit_message==5) {
SetLabelText(3, 1, "Looking for a way out?");
SetButtonPic(3, 2, 1, 391);
}
}
if (interface == QUITGAME) {
if (button == 3) {
GUIOff(3);
}
if (button == 0) {
QuitGame(0);
}
}
if (interface==SAVEGAME) {
SetMouseCursor(8);
if (button==3) {
index=ListBoxGetNumItems(7,5); // Count saved games
if (index<9) {
GetTextBoxText(7,2,text); // Get the typed text
InterfaceOff(7); // Close interface
SaveGameSlot(index+1,text); } // Save game (text as description)
else { // if saved games are 20
index=ListBoxGetSelected(7,5); // Get the selected save game
GetTextBoxText(7,2,text); // Get the typed text
InterfaceOff(7); // Close the interface
SaveGameSlot(savegameindex
[index],text); } // Overwrite the selected game
}
if (button==4) InterfaceOff(7);
}
}
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);
}
else if (button == 2) {
// They pressed LOOK, so switch to that mode
SetActiveInventory(-1);
SetCursorMode(MODE_LOOK);
}
else if (button == 3) {
// They pressed the OK button, close the GUI
GUIOff (INVENTORY);
SetDefaultCursor();
}
else 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;
}
else if ((button == 5) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - game.items_per_line;
}
}
}
Like I said a bracket or two must be out of place but I need some help locating it
thanks
Daniel
Winebarger
P.S I am having trouble with my custom save and restore screen? They look good and all but they don't save and they don't cancel out. I need help with that as well (just thought I would add this on)?
function interface_click(int interface, int button) {
if (interface == ICONBAR) {
if (button == 4) { // show inventory
show_inventory_window();
}
else if (button == 4) { // use selected inventory
if (character[ GetPlayerCharacter() ].activeinv >= 0)
SetCursorMode(4);
}
else if (button == 5) { // save game
GUIOn(7);
}
else if (button == 6) { // load game
GUIOn(8);
}
else if(button == 7) { //
GUIOn(3);
int quit_message = Random(6);
if(quit_message==0) {
SetLabelText(3, 1, "Oh I'm sorry! A Little Too Much?");
SetButtonPic(3, 2, 1, 386);
}
else if (quit_message==1) {
SetLabelText(3, 1, "Once a Poser! Always a Poser!");
SetButtonPic(3, 2, 1, 386);
}
else if (quit_message==2) {
SetLabelText(3, 1, "Signing up are we?");
SetButtonPic(3, 2, 1, 389);
}
else if (quit_message==3) {
SetLabelText(3, 1, "Crashed Out!");
SetButtonPic(3, 2, 1, 390);
}
else if (quit_message==4) {
SetLabelText(3, 1, "Going to Work?");
SetButtonPic(3, 2, 1, 388);
}
else if (quit_message==5) {
SetLabelText(3, 1, "Bitchin out?");
SetButtonPic(3, 2, 1, 387);
}
else if (quit_message==5) {
SetLabelText(3, 1, "Looking for a way out?");
SetButtonPic(3, 2, 1, 391);
}
}
if (interface == QUITGAME) {
if (button == 3) {
GUIOff(3);
}
if (button == 0) {
QuitGame(0);
}
}
if (interface==SAVEGAME) {
SetMouseCursor(8);
if (button==3) {
index=ListBoxGetNumItems(7,5); // Count saved games
if (index<9) {
GetTextBoxText(7,2,text); // Get the typed text
InterfaceOff(7); // Close interface
SaveGameSlot(index+1,text); } // Save game (text as description)
else { // if saved games are 20
index=ListBoxGetSelected(7,5); // Get the selected save game
GetTextBoxText(7,2,text); // Get the typed text
InterfaceOff(7); // Close the interface
SaveGameSlot(savegameindex
[index],text); } // Overwrite the selected game
}
if (button==4) InterfaceOff(7);
}
}
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);
}
else if (button == 2) {
// They pressed LOOK, so switch to that mode
SetActiveInventory(-1);
SetCursorMode(MODE_LOOK);
}
else if (button == 3) {
// They pressed the OK button, close the GUI
GUIOff (INVENTORY);
SetDefaultCursor();
}
else 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;
}
else if ((button == 5) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - game.items_per_line;
}
}
}
Like I said a bracket or two must be out of place but I need some help locating it
thanks
Daniel
Winebarger
P.S I am having trouble with my custom save and restore screen? They look good and all but they don't save and they don't cancel out. I need help with that as well (just thought I would add this on)?