I did this code in the global script so it will be like monkey island when you press f1 the quit gui comes up.But nothing seems to happen. Help?
if (b==0) keycode=0;
if (b==1) keycode=1;
if (keycode==359) GUIOn (1);
Did you put it in the on_key_press() function?
What is the variable b for?
If it can only be either 0 or 1 then
if (keycode==359) GUIOn (1);
would never be true since you reset the keycode variable in both instances.
or, if you really want to do it that way, try this instead:
if (keycode==359) GUIOn (1);
if (b==0) keycode=0;
if (b==1) keycode=1;
I put this code in my Repeatedly execute part:
on_key_press (359) { GUIOn (1)}
And its saying unidentified token when saving, what is the deal?
Try putting under the part of the global script that has:
"function on_key_press(int keycode)"
And I tested to see if I could use my F1 key to open up my inventory GUI and it worked fine. I added the following command:
if (keycode==359) {GUIOn(INVENTORY);}
Ã, Ã, You could probably do something similar to enable your GUI? Instead of using the specific GUI number (as I know that can change sometimes according to how you program things), use the GUI name instead perhaps, so regardless of the GUI number, the name of a GUI should still be associated with it. Well, either way should work fine I guess?Ã, ;)
*Edit: If you just want to bring up the default Quit GUI when you press the F1 key, then I think it would be:
if (keycode==359) {QuitGame(1); }
Actually i did use that. But i did something that allowed you only to bring it up from room 2, removed it, and i still cant bring it up in room 1. It just flashes when i press f1. Any ideas?
Show us your code please? You probably didn't remove it properly, I'd guess
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==359) GUIOn (1);
if (keycode==434) SaveScreenShot("scrnshot.bmp"); // F12
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
}
There used to be something that said if b==1 keycode=0, but removed it and its still flashing in room 1. I cant understand why. Maybe you know.
Quote from: Tanker on Thu 17/06/2004 13:24:50
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==359) GUIOn (1);
Ã, if (keycode==434) SaveScreenShot("scrnshot.bmp");Ã, // F12
Ã, 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
}
There used to be something that said if b==1 keycode=0, but removed it and its still flashing in room 1. I cant understand why. Maybe you know.
Well, looking at the global script from a freshly started new game, that part of the code looks like:
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
}
Ã, Ã, So, maybe just use that, but instead of Ctrl-Q for quitting the game: if (keycode==17)Ã, QuitGame(1);
...change it to: if (keycode==359) QuitGame(1);
Quote from: Barbarian on Thu 17/06/2004 13:53:22
Ã, Ã, So, maybe just use that, but instead of Ctrl-Q for quitting the game: if (keycode==17)Ã, QuitGame(1);
...change it to: if (keycode==359) QuitGame(1);
You mean change it to (keycode==359) GuiOn(1);
Right?
Yes, put GuiOn(1) instead and see if it works.
Nope it still flashes!
What do you mean by 'flashes', does the GUI come up and then quickly disappear?
Maybe your GUI is being turned off somewhere else?
Are you doing this:
if (IsGUIOn (1) == 0) {
if (keycode == 42) GUIOn (1);
}
if (IsGUIOn (1) == 1) {
if (keycode == 42) GUIOff (1);
}
See what I mean? It may be the case that the same key turns the GUI back off?
Quote from: Scorpiorus on Fri 18/06/2004 14:11:56
What do you mean by 'flashes', does the GUI come up and then quickly disappear?
Yes thats what it does.
But then how come it onlyh flashes in that room?
Check that room script... you probably have a GUIOFF in your repeatedly execute when you meant for it to be in the before fadein interaction...
PlayMusic (1);
GUIOff (1);
GUIOff (0); <= (:o)
if (cut==3) {
ObjectOn (0);
ObjectOn (1);
Why watever do you mean? ::)
;)