Wow, that's looking really good! I love those backgrounds, and the characters are great. It's always nice do do something else entirely, and it sounds like fun to me.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Cluey on Thu 07/07/2005 15:53:09Frankly, I hope they fucking rot in hell.Here, here...
QuoteYes, like I mentioned, a simpler way is just calling directly on_key_press() within interface_click() (see my last post). However, a more systematic (and more readible) way is to put those codes into functions, like:
There is one more modification to do, and that is copy the preparation codes from on_key_press to interface_click, otherwise the save/load GUIs wont read the previously saved games when you click on their icon in the iconbar, only when you open them using the hotkeys.
function SaveGUI(){
//blah blabla
}
function LoadGUI(){
//blah blabla
}
// main global script file
string text;int index;
#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
GUIOn(QUITDIALOG);
if (keycode==363) //SaveGameDialog(); // F5
//SetTextBoxText(5,0,""); // Clear Text box
//ListBoxSaveGameList(5,1); // Fill List Box with saved games
//index=ListBoxGetNumItems(5,1); // Count how many saved games there are
//if (index>19){ // If saved games 20 (maximum)
//Display("You must overwrite a previously saved game."); // Display warning
//}
GUIOn(SAVEDIALOG); // Bring Save interface on
if (keycode==365) //RestoreGameDialog(); // F7
//ListBoxSaveGameList(4,0); // Fill List box with saved games
GUIOn(LOADDIALOG); // Bring restore Interface on
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
}
#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);
}
else if (button == 6) // save game
GUIOn (SAVEDIALOG);
//SaveGameDialog();
else if (button == 7) // load game
GUIOn (LOADDIALOG);
//RestoreGameDialog();
else if (button == 8) // quit
GUIOn (QUITDIALOG);
//QuitGame(1);
else if (button == 9) // about
Display("The Majestic Conspiracy (c) 2005 Tim Hengeveld.");
} // 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 == QUITDIALOG) {
if (button == 0) {
QuitGame (0);
}
if (button == 1) {
GUIOff (QUITDIALOG);
}
}
if (interface== LOADDIALOG) { // if Restore interface
index=ListBoxSaveGameList(4,0); // Fill List box with saved games
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
}
if (interface== SAVEDIALOG) { // if save interface
SetTextBoxText(5,0,""); // Clear Text box
index=ListBoxSaveGameList(5,1); // Fill List Box with saved games
index=ListBoxGetNumItems(5,1); // Count how many saved games there are
if (index>19){ // If saved games 20 (maximum)
Display("You must overwrite a previously saved game."); // Display warning
}
if (button==0) { // if enter is pressed
index=ListBoxGetNumItems(5,1); // 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,1); // 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
}
}
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.084 seconds with 14 queries.