Pause screen problem

Started by Shaque, Tue 12/12/2006 07:38:41

Previous topic - Next topic

Shaque

G'day friends. Such a wonderfully resourcefull forum that I rarely need to post anything at most times, but this time I'm a little miffed (as I usually get ), but my issues are answered quite appropriately and very quickly when I get stuck, so here goes...

I have made myself a nice little pause screen for my 800 x 600 hi-colour game. Basically, its a small 320 x 120 box within an 800 x 600 GUI with the words "Game Paused - Click mouse to continue", but it's a graphic, not a text box. In the area around the box, every second pixel is black with every other the transparent colour, making it appear as though the screen tinted when the game is paused. It's a very nice effect.

Now here's my problem... Room0 is the splash screen of my game with all GUI's made invisible and the player hidden (obviously). The space bar activates the pause even here and when you unpause the game, all GUI's become visible like I want them to in the global script. The thing is, I don't want the pause GUI to be active while on the splash screen. I've tried disabling the interface but that just stops me from quitting or continuing the game. The game works fine otherwise, no scripting errors.

Q. Can I disable the space key until room1?

While I'm on it, I've not found anything in the help files or online, unless I have not read everything...

Q. I have @SCORE@/@TOTALSCORE@ on the left side of my status bar, @OVERHOTSPOT@ in the middle, but I would like the room description on the right. How do I display the room description without calling a script in every room? Is there a GUI token that handles room descriptions?

Thanks in advance...
Knowledge is a right, wisdom is a choice.

monkey0506

#1
Code: ags
// on_key_press
if (keycode == ' ') { // 32
  if (player.Room) { // if (player.Room != 0) {
    // blah
   }
  }


And there's currently no way to get a room's description from the script, but you may consider using custom properties.

strazer

#2
It doesn't sound like he needs to change the room description at run-time. I don't think you should pimp your modules if they are not needed.

SSH

strazer, room custom properties are an AGS feature...

But I think the Shadow module would work excellently here ;)
12

Shaque

Even though I have no idea what you guys just said, that little piece of code was useful. I didn't know how to tell the script not to execute if I was in a certain room, so I did it this way:
Code: ags

sectionstart on_key_press
  if (player.Room !=0) {
		if (keycode==32) PauseGame(); {
    mouse.Visible = false;
    gMenu.Visible = false;
    gStatus.Visible = false;
    gInventory.Visible = false;
    gPause.Visible = true;
		}
	}

and this to re-enable it once the game starts:
Code: ags

#sectionstart on_mouse_click 
function on_mouse_click(MouseButton button) {
  if (IsGamePaused() == 1) {
    UnPauseGame();
		gMenu.Visible = true;
		gPause.Visible = false;
		gStatus.Visible = true;
		mouse.Visible = true;
	}
}

Well, that worked. The pause screen doesn't come up anymore on the splash screen, although I still wish I could stop the inventory window from opening there. Yes, I know... I'm a clean freak. Most people wouldn't bother if the game works smoothly, but I like to sweep the dust off everything I can.

With the room descriptions. maybe I should have mentioned that I run a variable called "Location" upon entry of every room, including the splash. I set Location = XX (RoomXX). In the game, my character finds map pages for his little book (ala MYST... ish) and the overlay will show only those maps that are found while the character is in that area or display the message "You don't have a map for that area."

As I don't really understand much about  creating properties, do you think that doing so will be a better method of handling descriptions, locations and map overlays in the properties rather than in simple numeric variables? I'm a bit thick with all this, so please... treat me like a complete idiot. Thanks again in advance.
Knowledge is a right, wisdom is a choice.

strazer

Quote from: SSH on Tue 12/12/2006 09:43:51
strazer, room custom properties are an AGS feature...

I know. Before his edit, monkey suggested to use his Properties module.

Khris

In the on_key_press-code you posted, PauseGame(); was outside the brackets.
(Did you retype the code? Looks like it. Why don't you copy&paste it here?)
Code: ags
function on_key_press(int keycode) {
  if (keycode==32 && player.Room !=0) {
    PauseGame();
    mouse.Visible = false;
    gMenu.Visible = false;
    gStatus.Visible = false;
    gInventory.Visible = false;
    gPause.Visible = true;
  }
  ...
}


Quote from: Shaque on Tue 12/12/2006 10:53:50The pause screen doesn't come up anymore on the splash screen, although I still wish I could stop the inventory window from opening there.
Well, how is the inventory window opened? By a keypress? Or by clicking somewhere? We can't tell you how to intercept it unless we know how it's done.

About your map/location stuff:
I didn't fully understand you, but you seem to use a variable to keep track of the current location. AGS does this for you, you can get the current room by checking player.room anytime.

Custom properties are static bools, ints or strings that can be assigned to every hotspot, character, object and room. Static as in they can't change in-game.
They're perfect for naming rooms.

SMF spam blocked by CleanTalk