Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: BowsetteGamer on Tue 03/01/2023 19:14:18

Title: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Tue 03/01/2023 19:14:18
Let me explain, I want to create a game menu that when I press start the game, I am transported to the real video game, I would like to know if that can be done, it is to save me the guis and have to create things within the game, I want to know if it is possible to do an external game menu  ??? 
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: eri0o on Tue 03/01/2023 19:39:10
Can you explain a bit more of what you are trying to do, why and what you want to achieve?

Technically an AGS game can run another AGS game, just not sure if this is the question.
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Khris on Tue 03/01/2023 20:02:36
It sounds like you're describing a launcher?
Since an AGS game is just an .exe file (in the context of a launcher) this is not really a question about AGS, more one about creating a Win32 GUI app with a "run exe" button I guess.

Edit:
Creating a 2nd AGS game with sprites and GUIs to launch the actual game so you don't have to include the launcher resources into the main game sounds like bollocks to me so has to be a translation issue.
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Crimson Wizard on Tue 03/01/2023 21:23:33
I'm too not quite certain about the reasons, but there's RunAGSGame function that lets to run another AGS game from the first one (and so forth): https://adventuregamestudio.github.io/ags-manual/Globalfunctions_General.html#runagsgame
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: heltenjon on Tue 03/01/2023 22:06:57
Interesting command. So I guess one could use this to fuse a game made in chapters or make a compilation of shorties, for example? (Apropos of nothing, the interactive fiction Annual Competition usually has a Frame game in which the player may choose which other game to play, but they may also be run normally, using whatever interpreter it's made with.)
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 03:31:25
Quote from: eri0o on Tue 03/01/2023 19:39:10Can you explain a bit more of what you are trying to do, why and what you want to achieve?

Technically an AGS game can run another AGS game, just not sure if this is the question.
well I have 70% of the game finished; When I started it, I didn't consider putting a game menu on it, but I wanted the game to start at once and that's it, and the fact is that since I already have the game done, if I start making the menu it would be complicated for me, so I thought and if I make a game that works as a menu and then I program it so that the menu game closes and runs the real game, and well I was wondering if that was possible
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 03:38:48
Quote from: Khris on Tue 03/01/2023 20:02:36It sounds like you're describing a launcher?
Since an AGS game is just an .exe file (in the context of a launcher) this is not really a question about AGS, more one about creating a Win32 GUI app with a "run exe" button I guess.

Edit:
Creating a 2nd AGS game with sprites and GUIs to launch the actual game so you don't have to include the launcher resources into the main game sounds like bollocks to me so has to be a translation issue.
exactly as you described is what I'm trying to do, but listen, it's not nonsense, it's that there are many things that I don't understand about the ags engine and I'm working on a game that I really like and I'm doing it with my own content, it's not a translation error, in fact this is my first post since most of the things I've done in the game is based on the documentation that the engine gives you but it's in English and I don't understand much English, I already discovered that the command is runAGSgame, the question I now have is, what function does data fulfill, that is, does it know that it is:

RunAGSgame ("Mygame.exe", 0, 51);

"51" represents the data but what function does it have there, is it optional, what is that?
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 03:43:05
Quote from: heltenjon on Tue 03/01/2023 22:06:57Interesting command. So I guess one could use this to fuse a game made in chapters or make a compilation of shorties, for example? (Apropos of nothing, the interactive fiction Annual Competition usually has a Frame game in which the player may choose which other game to play, but they may also be run normally, using whatever interpreter it's made with.)
Exactly that was what I thought, to merge so that the programming work does not present errors or anything like that, and thus you can put other things on them and work unitarily in each part of your game without having to specify everything in the same game. Let's say that we are making 5 Age of Empires maps, in ags, imagine putting the 5 maps in a single game, now if you have a menu you will create a selector and it will be easier for you.
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 03:50:23
Well thank you very much to everyone, those who helped me with the command, I began to test and test with RunAGSgame and the results were what I expected, Thank you "Crimson Wizard" for helping me, but I have a question "what is the data in this command?", which is the "51" that is expressed to me in the dynamic help of AGS and the data is necessary, is it optional, what is that for?

What I'm looking for is that one game functions as a menu and the other is the game as such without any functions, attributes or anything like that for the original game because all that is in the original game, the menu is just a menu and it executes the another game
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: glurex on Wed 04/01/2023 05:11:34
Quote from: BowsetteGamer on Wed 04/01/2023 03:31:25
Quote from: eri0o on Tue 03/01/2023 19:39:10Can you explain a bit more of what you are trying to do, why and what you want to achieve?

Technically an AGS game can run another AGS game, just not sure if this is the question.
well I have 70% of the game finished; When I started it, I didn't consider putting a game menu on it, but I wanted the game to start at once and that's it, and the fact is that since I already have the game done, if I start making the menu it would be complicated for me, so I thought and if I make a game that works as a menu and then I program it so that the menu game closes and runs the real game, and well I was wondering if that was possible

Maybe I'm not understanding well. But what's the problem with make a new room with the game menu? You have to set the player (and make it invisible) to start in that room and in the Start option of the menu telport that character to the first room (where your game starts, and make player visible again if needed).
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Khris on Wed 04/01/2023 09:08:42
That's what I was afraid of: you want to do this because you don't know that there's a much easier way.
Maintaining two games and publishing two exes just because you want to add a title screen to a 70% finished game is also bollocks :)

Also, the data parameter is explained right inside the manual entry you mention:
QuoteDATA allows you to pass an integer through to the next game. The value you pass here will be accessible to the loaded game by it reading the game.previous_game_data variable.

The 51 is just an example value.

Anyway, this is known as the xy problem (https://xyproblem.info/).
Instead simply ask "I have a game that is 70% done, how do I add a title screen to it?"
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Matti on Wed 04/01/2023 09:37:04
Khris is right.

As Glurex said it's quite simple to add a menu: You only need a new room, a GUI, and a few small functions in the global script for the different buttons: Continue, New Game, Quit.. Nothing else needs to be added to the game.
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: heltenjon on Wed 04/01/2023 13:38:21
Hmmm...I meant my comment above not as an explanation to the IP, but more as a question about when this command will be useful; what is it intended for? Sorry if it was misleading for you, BowsetteGamer!  :-[

I can think of three instances, but they may not what the creators of the command had in mind:

1 and 2: If I already have several games made, and they are too small to release separately, or if they have been released as chapters and I want to merge them.

3. If multiple devs work on different parts of a story and wants to merge them into one game.

Will the command be useful for that, or will it be a false friend?
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 17:13:11
Quote from: Khris on Wed 04/01/2023 09:08:42That's what I was afraid of: you want to do this because you don't know that there's a much easier way.
Maintaining two games and publishing two exes just because you want to add a title screen to a 70% finished game is also bollocks :)

Also, the data parameter is explained right inside the manual entry you mention:
QuoteDATA allows you to pass an integer through to the next game. The value you pass here will be accessible to the loaded game by it reading the game.previous_game_data variable.

The 51 is just an example value.

Anyway, this is known as the xy problem (https://xyproblem.info/).
Instead simply ask "I have a game that is 70% done, how do I add a title screen to it?"

Kris obviously read the manual, that's where I got the doubt, what I was referring to is:
 there is 51 (apart from obviously being an example), the question is what is that "51", because I can put "0" and that's it, but how does the game take it, as false, null or create a variable, what I would like to know is; regardless of the number that it puts, what does the number do, I know it is data but it is the section of the file or it is a file called "51", excuse me if I do not understand, the fact is that the manual is there, but there are things that one says ; aha but what happens with this, okay it's DATA and it passes me the files from the old to the new one, but because of the number, it wasn't easier to put "ags.dat" for example there if I understand, but it gives me a numerical value, here's the doubt.
Now I have a question, I know you prefer the in-game menu, I already did that and actually created it in a previous game, that's why I decided to create an external menu. but listen because you are afraid to create 2 games, we can not compress that and create a zip or rar file and upload it to the net, maybe the file will be less heavy and if the player has any doubts, we put a README.txt and that is all

Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 17:17:23
Quote from: glurex on Wed 04/01/2023 05:11:34
Quote from: BowsetteGamer on Wed 04/01/2023 03:31:25
Quote from: eri0o on Tue 03/01/2023 19:39:10Can you explain a bit more of what you are trying to do, why and what you want to achieve?

Technically an AGS game can run another AGS game, just not sure if this is the question.
well I have 70% of the game finished; When I started it, I didn't consider putting a game menu on it, but I wanted the game to start at once and that's it, and the fact is that since I already have the game done, if I start making the menu it would be complicated for me, so I thought and if I make a game that works as a menu and then I program it so that the menu game closes and runs the real game, and well I was wondering if that was possible

Maybe I'm not understanding well. But what's the problem with make a new room with the game menu? You have to set the player (and make it invisible) to start in that room and in the Start option of the menu telport that character to the first room (where your game starts, and make player visible again if needed).

There is no problem with making a menu within the game, the fact is that my game uses many variables, many functions and I don't want to get confused, apart from the fact that it has a large number of characters and I want to make a menu that is pretty decorative and looks good I don't want just the start game and an image downloaded from the net that serves as a background, something good is what I want and that's why I want to do it separately so that everything fulfills a unique function and it can be seen that effort was put into it and it's not just tell story and that's it
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 17:32:54
Well, regarding the question of the post, it's okay because I will put a title screen inside the game, the case was to create a gui launcher, I don't know if you are thinking that I am doing a graphic adventure, my game is actually an isometric rpg, I'm also remastering virgin interactive's monopoly, and well I still have no idea how to put the command that executes the dice roll, does anyone here know the game "Rome AD92" I've also been creating part of that, actually I'm creating 3 games, they are still in their demo version but they need to be finished, with respect to the rpg it is pure fighting in the demo I have not added a story yet, but the notion of the game is like all rpgs; fighting and adventure and well that's the game I'm trying to make but it has a lot of characters imagine loading one more title on top and making it look aesthetic and work. Something that I like about AGS is that you can also make an Age of Empires, so I would also like to create one, which is why I need the launcher gui.  ;-D
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 18:06:34
In my opinion there is a big difference between making this menu
(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTGfSutZHWttbSyDC-2Xr1Lqb9zCqqMxyH_fg&usqp=CAU)
and where people when entering the game say: oh my god I want to try this, because there is a great job it is not just to put a start game and that's it.
(https://i.ytimg.com/vi/eu_m14ilqyM/hqdefault.jpg)
You have to put decoration, creativity and a nice sound and if you put a retro style on it that's great, and in the background that animations can be seen, but for me that requires a lot of work in the real game so I prefer to create the launcher gui
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Cassiebsg on Wed 04/01/2023 18:16:03
Yes, as everyone already said, just add a room or a GUI to the almost finished game. Much easier to do than creating a new game just to launch the game.

The GUI option is the "easiest" since you can then allow the player to access the menu at any time (like, if you want to add Load/Save/Settings options to it).

Just create a new menu, make it visible from the start, and make sure its set to pause the game. Add a "Start game" button, where all you need to do is hide the menu GUI when you click it, and your game will just start exactly like you want to (since when you hide the menu, the game will be unpaused and start).

EDIT: But you can do a nice cool menu inside the game, it doesn't need to be simple, can be as complicated as you like. I don't see the need for creating a "new game" just so you get a menu. But it's your game, if you want a "game menu" that all it serves is launching the real game, then you're of course free to do so. :)
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 18:28:16
Quote from: Cassiebsg on Wed 04/01/2023 18:16:03Yes, as everyone already said, just add a room or a GUI to the almost finished game. Much easier to do than creating a new game just to launch the game.

The GUI option is the "easiest" since you can then allow the player to access the menu at any time (like, if you want to add Load/Save/Settings options to it).

Just create a new menu, make it visible from the start, and make sure its set to pause the game. Add a "Start game" button, where all you need to do is hide the menu GUI when you click it, and your game will just start exactly like you want to (since when you hide the menu, the game will be unpaused and start).

EDIT: But you can do a nice cool menu inside the game, it doesn't need to be simple, can be as complicated as you like. I don't see the need for creating a "new game" just so you get a menu. But it's your game, if you want a "game menu" that all it serves is launching the real game, then you're of course free to do so. :)
and animations can be added to the gui at different specific points, because I want to add animations to the menu
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Wed 04/01/2023 18:33:40
Quote from: BowsetteGamer on Wed 04/01/2023 18:28:16But you can do a nice cool menu inside the game, it doesn't need to be simple, can be as complicated as you like. I don't see the need for creating a "new game" just so you get a menu. But it's your game, if you want a "game menu" that all it serves is launching the real game, then you're of course free to do so. :)

That is true but the advice that everyone is giving me is good, I just want answers to my doubts as a secondary help to that of the manual, because to be honest there are things that are understood and others not or at least there are doubts about it
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Cassiebsg on Wed 04/01/2023 20:22:25
Yes, you can add animations to the GUI, buttons can have animations in them. And they don't need to be "clickable" or even static.

Here's a game I made sometime go with an animated menu: https://www.adventuregamestudio.co.uk/site/games/game/2201-unexpected-at-the-rising-star/

Or this one that not only is a great game, it also has a very cool animated menu: https://www.adventuregamestudio.co.uk/site/games/game/2520-if-on-a-winter-s-night-four-travelers/
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Matti on Wed 04/01/2023 22:23:48
Yes, everything you mention is pretty much possible and doesn't require a lot of work. I don't see any reason why the (however fancy) menu shouldn't be part of the game (or the same executable).

I say finish your game, then make a backup (which you should of course do regularly), then concentrate on making the menu/title screen as the last missing part of your game, done  :)
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Thu 05/01/2023 03:49:38
Quote from: Matti on Wed 04/01/2023 22:23:48Yes, everything you mention is pretty much possible and doesn't require a lot of work. I don't see any reason why the (however fancy) menu shouldn't be part of the game (or the same executable).

I say finish your game, then make a backup (which you should of course do regularly), then concentrate on making the menu/title screen as the last missing part of your game, done  :)
I like this, thank you very much, I already have 85% of the demo done, I like what you propose :)
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Thu 05/01/2023 03:51:29
Quote from: Cassiebsg on Wed 04/01/2023 20:22:25Yes, you can add animations to the GUI, buttons can have animations in them. And they don't need to be "clickable" or even static.

Here's a game I made sometime go with an animated menu: https://www.adventuregamestudio.co.uk/site/games/game/2201-unexpected-at-the-rising-star/

Or this one that not only is a great game, it also has a very cool animated menu: https://www.adventuregamestudio.co.uk/site/games/game/2520-if-on-a-winter-s-night-four-travelers/
Woa, great, thanks for sharing your games with me, I'll take a look at them, a question, do you like games set in Roman times?
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Khris on Thu 05/01/2023 10:46:29
If you want a complicated title / intro, make it a separate exe. You have my blessing :)
However what Cassie brought up is a very good counterpoint: if this is actually a menu screen that is supposed to appear when you pause the game, putting it in a separate exe is, you guessed it: bollocks ;-D

Also, the 51 is an integer. Like the manual entry explicitly states. An integer is a whole number, and you can use it to send some information to the 2nd game, like for instance the player's score, or their health, or how many toenail clippings they have in their inventory from the previous game.
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Fri 06/01/2023 01:55:01
Quote from: Khris on Thu 05/01/2023 10:46:29If you want a complicated title / intro, make it a separate exe. You have my blessing :)
However what Cassie brought up is a very good counterpoint: if this is actually a menu screen that is supposed to appear when you pause the game, putting it in a separate exe is, you guessed it: bollocks ;-D

Also, the 51 is an integer. Like the manual entry explicitly states. An integer is a whole number, and you can use it to send some information to the 2nd game, like for instance the player's score, or their health, or how many toenail clippings they have in their inventory from the previous game.
hmmmm okay thanks, and if I put the data in "0", it means that nothing happens to the real game, I ask this is to confirm
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Khris on Fri 06/01/2023 01:59:55
You can read the value by accessing game.previous_game_data but you can simply not do that. Which means the number you put in the call doesn't matter at all. This isn't a big deal.
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: BowsetteGamer on Fri 06/01/2023 02:02:38
Quote from: Khris on Fri 06/01/2023 01:59:55You can read the value by accessing game.previous_game_data but you can simply not do that. Which means the number you put in the call doesn't matter at all. This isn't a big deal.
ah ok thanks for your help kris ;-D
Title: Re: HELP How can I execute a command from a game that switches me to another game?
Post by: Snarky on Fri 06/01/2023 14:59:34
As a sort of general programming tip (not just limited to AGS): when variables, fields or arguments are called "data," it often means that the values don't have any pre-defined meanings or uses, but that it's up to you to define and use it however you like.