Whenever I hit the inventory button, the game displays "AGS Engine by Chris Jones". Why would it do this?
I am using the RON GUI from the RON template. The code:
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);
Ã, Ã, }
Ã, Ã, else if (button == 6)Ã, Ã, // save game
Ã, Ã, Ã, Save();
Ã, Ã, else if (button == 7)Ã, Ã, // load game
Ã, Ã, Ã, Load();
Ã, Ã, else if (button == 8)Ã, Ã, // quit
Ã, Ã, Ã, QuitGame(1);
Ã, Ã, else if (button == 9)Ã, Ã, // about
Ã, Ã, Ã, Display("RON: Sorcerer's Apprentice by XTChrisTX.");
Ã, Ã, Ã, Display("AGS Engine by Chris Jones.");
Ã, }Ã, // 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);
Ã, Ã, Ã, GUIOn(ICONBAR);
Ã, Ã, Ã, 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 == SAVE) { // if save interface
Ã, Ã, if (button == 3) {
Ã, Ã, Ã, ListBoxGetItemText(SAVE, 3, ListBoxGetSelected(SAVE, 3), text);
Ã, Ã, Ã, SetTextBoxText(SAVE, 1, text);
Ã, Ã, Ã, index = 21;
Ã, Ã, }
Ã, Ã, if (button == 1 || button == 5) {
Ã, Ã, Ã, GetTextBoxText(SAVE,1,text); // Get the typed text
Ã, Ã, Ã, if (StrCaseComp(text, "") != 0) { // If text not empty
Ã, Ã, Ã, Ã, InterfaceOff(SAVE); // Close interface
Ã, Ã, Ã, Ã, SetDefaultCursor();
Ã, Ã, Ã, Ã, if (index < 20) { // if less than 20
Ã, Ã, Ã, Ã, Ã, index = ListBoxGetNumItems(SAVE,3);
Ã, Ã, Ã, Ã, Ã, SaveGameSlot(index+1,text); // Save game (text as description)
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, Ã, else { // if saved games are 20
Ã, Ã, Ã, Ã, Ã, index = ListBoxGetSelected(SAVE,3); // Get the selected save game
Ã, Ã, Ã, Ã, Ã, SaveGameSlot(savegameindex[index],text);Ã, // Overwrite the selected game
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, }
Ã, Ã, }
Ã, Ã, if (button == 4) {
Ã, Ã, Ã, InterfaceOff(SAVE); // if cancel is pressed close interface
Ã, Ã, Ã, SetDefaultCursor();
Ã, Ã, }
Ã, }
Ã, if (interface == LOAD) {
Ã, Ã, if (button == 1) { // if cancel is pressed
Ã, Ã, Ã, InterfaceOff(LOAD); Ã, Ã, Ã, Ã, // Close interface
Ã, Ã, Ã, SetDefaultCursor();
Ã, Ã, }
Ã, Ã, else if (button == 3) {
Ã, Ã, Ã, index = ListBoxGetSelected(LOAD,0); // else get the selected game
Ã, Ã, Ã, RestoreGameSlot(savegameindex[index]); // restore the game
Ã, Ã, }
Ã, }
Check your brackets.
else if (button == 9) // about
Display("RON: Sorcerer's Apprentice by XTChrisTX.");
Display("AGS Engine by Chris Jones.");
...should be:
else if (button == 9) // about
{
Display("RON: Sorcerer's Apprentice by XTChrisTX.");
Display("AGS Engine by Chris Jones.");
}
You can leave the {-} out if you have only 1 statement after the if, but for two or more, you need them!
Thanks, but now I am experiencing an even stranger glitch. With the revised code, it says the nested functions are not supported on line 206.
#sectionstart inventory3_aÃ, // DO NOT EDIT OR REMOVE THIS LINE
function inventory3_a() {
Ã, // script for inventory3: Look at inventory item
Display ("It's your wallet.");Ã,Â
}
#sectionend inventory3_aÃ, // DO NOT EDIT OR REMOVE THIS LINE
This means you forgot a closing brace in the function before this latest code you posted.
The error means that the function inventory3_a can't be inside of another function, hence the function before it hasn't been closed properly.