Is there any way to end the game? Besides the player quitting i mean
Returning to the title menu?
Do you mean making an ending sequence? You just add it in like you would the rest of your game.
But if you mean an actual command to quit out of the game and have the game close itself, you might be looking for the QuitGame command. From the AGS manual:
QuitGame
QuitGame(int ask_first)
Exits the game and returns to the operating system.
If ASK_FIRST is zero, it will exit immediately. If ASK_FIRST is not zero, it will first display a message box asking the user if they are sure they want to quit.
Example:
QuitGame(0);
will quit the game without asking the player to confirm.
Read the BFAQ (http://americangirlscouts.org/agswiki/index.php/Graphics%2C_Characters%2C_Text_%26_Rooms#How_to_end_your_game_.28win.2Flose.2Fdie.29_or_kill_off_your_character) (although the code sample is out of date).
Beyond that: you're really going to have to be less vague about what you want, if you expect answers.
Ooo! I like what Barbarian said. Thanks. To the rest who answered, nice try at answering my riddle (sorry) ;D
Edit: Actualy it didn't work. I wanted the gme to exit to DOS/Windows. I looked it up in the manual and it said to use AbortGame("string"..." ) but that didn't work either. I have just set it up simply. I have a room where the player is non-visible and is just "THE END" I want to have the player be able to click and it will exit to windows.
The QuitGame(0); command should work for you then.
You need to put it in a script to to make it work.
So, let's say you have the ending room where you might have your "THE END" message displayed.
From the room editor, click on the big "i" button at top.
From the choices, Right-Click on "Player enters room (after fadein)"
Then select "New Action".
Then select from the drop-down choices "Run script". Click on the "Edit Script" button.Ã, In the script add commands such as the following example:
Wait(150); QuitGame(0);
Then from script editor choose "File" and "Exit and save changes", and that should do it.
The Wait(150); commands will wait a few moments before exiting the game, so the player has a chance to read your "THE END" message or whatever you want to put up there. Of course you can adjust the 150 number to shorter or longer as you like.Ã, Anyways, that should work for you as you were looking for. Except that way the game will automatically exit after the Wait command finishes.
If you want the player to "Click" to exit. Then from the room editor, make a big "Hotspot", then on the Hotspot interaction you can add the QuiteGame(0); command in a script.
That is what I have done. I have one massive hotspot. But the QuitGame(0); script does not work for some reason.
Seems like something is being overlooked or the command is being placed in a way that it's not getting activated.Ã, Maybe on the Hotspot, put the code on the "On any click" part (I'm going my memory here as my AGS editor is not open at the moment).
If you still can't get it to work, post up your exact code here for us to see... or if that still fails to help, perhaps you can upload a zip copy of your project and someone here can take a look at it to see what might be wrong.
Good luck.
Babarians code should work, but myself... I had problems with the "On any click" part... maybe there's a bug?
This doesn't really add, but I thought it might be helpful for Wonko...
~Yurina
Slighty off topic (or maybe not), but:
'Any click on ...' doesn't count 'Walk to' (cursor mode 0), unless you've altered settings to make it. Could this be the problem? Try setting the mode to something else in 'Player enters room (after fadein)' - and possibly disabling 'Walk to' (http://www.adventuregamestudio.co.uk/manual/Mouse.DisableMode.htm), so the player can't go back by accident.
As an alternative, you could give the room it's own on_mouse_click, e.g.:
//Room script
function on_mouse_click(MouseButton button) {
QuitGame(0);
ClaimEvent();
}
This'll make any mouse click in the room quit the game. (You could also edit the global on_mouse_click to check the room, and quit if needed.)
If nothing else works, as Barbarian said, post your code for us to take a look at.