Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Rocco on June 30, 2005, 09:44:25 PM

Title: main menu scene for all situations
Post by: Rocco on June 30, 2005, 09:44:25 PM
hi,

i use a menu scene at the beginning of the game, and want to use it also during the game,
when the player press Esc.

is this in the meaning of the engine, or is it better to use *.window objects for the menu?

problem:
i didnt found a variable where i can query the scene(String) which is loaded now, or the scene loaded before?
i thougt it could work like this:

var oldscene = scene.activescene;
Game.ChangeScene("scenes\Room\menu.scene");

and pressing resume game back to the game:
Game.ChangeScene(oldscene);

is this possible?
thx for hints
rocco


Title: Re: main menu scene for all situations
Post by: Mnemonic on June 30, 2005, 10:01:27 PM
I would probably use a window for this purpose, but the scene approach would work too. You'd have to hide the actor though, and show him again when leaving the menu. The attribute you're looking for is Game.PrevSceneFilename, i.e. you'd call:

Game.ChangeScene(Game.PrevSceneFilename);
Title: Re: main menu scene for all situations
Post by: Rocco on June 30, 2005, 10:57:59 PM
thx, i only searched the scene object for this attribute.
i work on a myst style game, there is no actor to hide.
Title: Re: main menu scene for all situations
Post by: TheDerman on July 02, 2005, 03:02:37 PM
I used a "scene" menu at the start of the game as the first scene loaded, and then a full screen window when the player presses "Esc", made to match that first scene - this works perfectly.

How would a menu scene work with the load and save options? If you save with a window menu you get returned to the scene, and similarly if you load the game, you get put into the scene where you saved. Presumabley if using a "scene" menu, you'd get put back to the menu scene each time you saved and loaded, rather than where you want to be...

Would it work to add "Game.ChangeScene(Game.PrevSceneFilename);" to the load and save scripts, after the code that handles those things? Would that be "savename.script" for save, and "load.script" for load?

I think that might work for save, but would it work with load? Would the previous scene value be stored in the save, to be used AFTER the game was loaded next time round?

My "scene" menu isn't setup to save so I can't test this without redoing some things - I'm just wondering about it.
Title: Re: main menu scene for all situations
Post by: Mnemonic on July 02, 2005, 03:25:34 PM
Yes, it will work. The Scene.PrevSceneFilename attribute gets saved and restored respectively.
Title: Re: main menu scene for all situations
Post by: Rocco on July 05, 2005, 01:05:46 PM
Can I Query the scene which is currently active - like PrevSceneFilename??

cause i dont want the sierra style rightcklick-actions in the menu-scene.
also for the keypress command it would be useful for me,
in a game scene <Esc> returns to menu scene, in menu <Esc> shut down the game.
Title: Re: main menu scene for all situations
Post by: Jerrot on July 05, 2005, 01:22:28 PM
Can I Query the scene which is currently active - like PrevSceneFilename??

You can use Scene.Name for this. (I'm not sure whether Scene.Filename exists as well though)

EDIT: As Mnemonic just told me they both do exist, they just missed the documentation somehow. :)
Title: Re: main menu scene for all situations
Post by: Rocco on July 05, 2005, 02:49:35 PM
ohh thx, its often better to try some things out.
I did it now with scene.name, which was a bit more scripting.
another question:
is it possible to activate a click event in script??
my case - i want to store the latest used cursor and
reassign it if the player resumes the game.
one thing is to insert the switch statement in all possibilities,
but with Game.RightMouseClick it could be much easier.
is there a command for this??
Title: Re: main menu scene for all situations
Post by: Mnemonic on July 05, 2005, 03:23:39 PM
You'd better put the cursor setting code into a function and then call the function whenever needed.
But if you insist on simulating the mouse click, you can achieve it by calling this:

Game.ApplyEvent("RightClick");
Title: Re: main menu scene for all situations
Post by: Rocco on July 05, 2005, 05:12:27 PM
big thanks, the rightClick cursor thing looks good now.
but other things are not so easy for me.
As TheDerman wrote, when i load a saved game, it starts in the menuscreen.
I tried some things with AfterLoad, to determine when i have to use the Game.ChangeScene(Game.PrevSceneFilename); command
but without success, which script place i have to put this command??
another question, i have an Start-new-game Button in the menu, is there a command to reset the whole game??
Title: Re: main menu scene for all situations
Post by: Mnemonic on July 05, 2005, 05:31:56 PM
As TheDerman wrote, when i load a saved game, it starts in the menuscreen.
I tried some things with AfterLoad, to determine when i have to use the Game.ChangeScene(Game.PrevSceneFilename); command
but without success, which script place i have to put this command??
Put the ChangeScene right after the Game.SaveGame() call. That's the point where the game continues after loading a saved game.


another question, i have an Start-new-game Button in the menu, is there a command to reset the whole game??
Yes, there's Game.Reset() (surprise! ;))
Title: Re: main menu scene for all situations
Post by: Rocco on July 05, 2005, 05:59:38 PM
Put the ChangeScene right after the Game.SaveGame() call. That's the point where the game continues after loading a saved game.
thanks :-))))

Yes, there's Game.Reset() (surprise! ;))
lol, sorry for beeing such a pain in the neck.
i think your engine is really great, and when im finished with the GUI things,
i will make it open source, maybe its useful for other newbies.
the problem is there are not much examples for newbies, and the engine is rather complex,
ok, the reset command was not so well hidden in the documentation that nobody can find it, but....

thx  ;D


 
Title: Re: main menu scene for all situations
Post by: Rocco on July 05, 2005, 06:29:51 PM
ok, next problem,
the save-game thumbnail show the menu scene.
is it possible to make a screenshot of the prevScene??
thx,
Title: Re: main menu scene for all situations
Post by: Mnemonic on July 05, 2005, 06:50:03 PM
ok, next problem,
the save-game thumbnail show the menu scene.
is it possible to make a screenshot of the prevScene??
thx,
Hm, right, that's a problem. No, it's not possible for the saved game to get a picture of a previous scene. You could manually take a picture of the scene before entering the menu scene (using Game.TakeScreenshotEx()), but you'd have to store/display the screenshot yourself, i.e. you couldn't use the built-in savegame thumbnail functionality...