OK, I see the problem. You need to take everything afterÃ, function interface_click(int interface, int button) { out ofÃ, function on_key_press(int keycode) { and put it in toÃ, function interface_click(int interface, int button) { (which you can see at the bottom of the second picture you posted.)
So, you should have:
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)Ã, InterfaceOn(3);Ã, Ã, // Ctrl-Q
Ã, if (keycode==363) GUIOn(5);Ã, Ã, // F5 Save GUI
Ã, if (keycode==365) GUIOn(4);Ã, // F7 Load GUI
Ã, 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
}
Then, further down the script (line 105 in the second screenshot):
function interface_click(int interface, int button) {
Ã, if (interface == ICONBAR) {
Ã, // whatever is already here
Ã, }Ã, // end ICONBAR
Ã, if (interface == INVENTORY) {
Ã, Ã, // whateverÃ, is already here
Ã, } // end INVENTORY
Ã, if (interface == 3) {
Ã, // Quit Gui interactions
Ã, } // end Quit GUI
if (interface==4) { // if Restore interface
Ã, string text;
Ã, int index;
Ã, if (button==1) {// if cancel is pressed
Ã, Ã, InterfaceOff(4); // Close interface
Ã, }
Ã, else {
Ã, Ã, Ã, index=ListBoxGetSelected(4,0); // else get the selected game
Ã, Ã, Ã, RestoreGameSlot(savegameindex[index]);
Ã, } // restore the game
} // end Load GUI
if (interface==5) { // if save interface
Ã, string text;
Ã, int index;
Ã, if (button==0) { // if enter is pressed
Ã, Ã, index=ListBoxGetNumItems(5,3);Ã, // Count saved games
Ã, Ã, if (index<20) { // if less than 20
Ã, Ã, Ã, GetTextBoxText(5,0,text); // Get the typed text
Ã, Ã, Ã, InterfaceOff(5); // Close interface
Ã, Ã, Ã, SaveGameSlot(index+1,text);
Ã, Ã, } // Save game (text as description)
Ã, Ã, else { // if saved games are 20
Ã, Ã, Ã, index=ListBoxGetSelected(5,3); // Get the selected save game
Ã, Ã, Ã, GetTextBoxText(5,0,text); // Get the typed text
Ã, Ã, Ã, InterfaceOff(5); // Close the interface
Ã, Ã, Ã, SaveGameSlot(savegameindex[index],text);
Ã, Ã, } // Overwrite the selected game
Ã, }
Ã, if (button==2) InterfaceOff(5); // if cancel is pressed close interface
} // end Save GUI
} // end function interface_click.
Edited, as I realised I hadn't changed the InterfaceOff()'s and GetTextBoxText()'s and that.
So, you should have:
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)Ã, InterfaceOn(3);Ã, Ã, // Ctrl-Q
Ã, if (keycode==363) GUIOn(5);Ã, Ã, // F5 Save GUI
Ã, if (keycode==365) GUIOn(4);Ã, // F7 Load GUI
Ã, 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
}
Then, further down the script (line 105 in the second screenshot):
function interface_click(int interface, int button) {
Ã, if (interface == ICONBAR) {
Ã, // whatever is already here
Ã, }Ã, // end ICONBAR
Ã, if (interface == INVENTORY) {
Ã, Ã, // whateverÃ, is already here
Ã, } // end INVENTORY
Ã, if (interface == 3) {
Ã, // Quit Gui interactions
Ã, } // end Quit GUI
if (interface==4) { // if Restore interface
Ã, string text;
Ã, int index;
Ã, if (button==1) {// if cancel is pressed
Ã, Ã, InterfaceOff(4); // Close interface
Ã, }
Ã, else {
Ã, Ã, Ã, index=ListBoxGetSelected(4,0); // else get the selected game
Ã, Ã, Ã, RestoreGameSlot(savegameindex[index]);
Ã, } // restore the game
} // end Load GUI
if (interface==5) { // if save interface
Ã, string text;
Ã, int index;
Ã, if (button==0) { // if enter is pressed
Ã, Ã, index=ListBoxGetNumItems(5,3);Ã, // Count saved games
Ã, Ã, if (index<20) { // if less than 20
Ã, Ã, Ã, GetTextBoxText(5,0,text); // Get the typed text
Ã, Ã, Ã, InterfaceOff(5); // Close interface
Ã, Ã, Ã, SaveGameSlot(index+1,text);
Ã, Ã, } // Save game (text as description)
Ã, Ã, else { // if saved games are 20
Ã, Ã, Ã, index=ListBoxGetSelected(5,3); // Get the selected save game
Ã, Ã, Ã, GetTextBoxText(5,0,text); // Get the typed text
Ã, Ã, Ã, InterfaceOff(5); // Close the interface
Ã, Ã, Ã, SaveGameSlot(savegameindex[index],text);
Ã, Ã, } // Overwrite the selected game
Ã, }
Ã, if (button==2) InterfaceOff(5); // if cancel is pressed close interface
} // end Save GUI
} // end function interface_click.
Edited, as I realised I hadn't changed the InterfaceOff()'s and GetTextBoxText()'s and that.