Running a game with command line arguments?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
fizzhog
Newbie
Posts: 13
Joined: Wed Apr 27, 2016 6:56 am
Contact:

Running a game with command line arguments?

#1 Post by fizzhog » Sat Feb 03, 2018 1:17 pm

I'm making a game that is in sections and only some are made with Ren'py. All controlled from a launcher made with Clickteam Fusion.

I want to be able to run a Ren'py game multiple times but each time I run it I want it to start at a different point in the game. I was thinking that perhaps I could run the Ren'py game with a command line argument that could in some way provide a variable for use in a conditional statement at the start of the game allowing a jump to the appropriate label. Is this possible or am I thinking about this problem in entirely the wrong way?
gamelike things for persons

http://www.fizzhog.com

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Running a game with command line arguments?

#2 Post by Ocelot » Sat Feb 03, 2018 1:54 pm

Why not separate it into several games?
< < insert Rick Cook quote here > >

User avatar
fizzhog
Newbie
Posts: 13
Joined: Wed Apr 27, 2016 6:56 am
Contact:

Re: Running a game with command line arguments?

#3 Post by fizzhog » Sat Feb 03, 2018 1:57 pm

I was thinking about keeping the overall file size down. Could I do as you suggest and have the separate exe files share the same game assets, libraries, etc?
gamelike things for persons

http://www.fizzhog.com

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Running a game with command line arguments?

#4 Post by Ocelot » Sat Feb 03, 2018 2:08 pm

You can share assets between RenPy games. For example you can have assets directory alongside game directories and use relative paths in those games:

Code: Select all

image foo = "../assets/images/1.jpg"
Here ../ means one level up
< < insert Rick Cook quote here > >

User avatar
fizzhog
Newbie
Posts: 13
Joined: Wed Apr 27, 2016 6:56 am
Contact:

Re: Running a game with command line arguments?

#5 Post by fizzhog » Sat Feb 03, 2018 5:00 pm

OK that seems to work. Thanks.

For anyone else reading this with the same problem this is what I did.

I made two test games and made Windows x86 builds (this game is Windows only as some of the other non-Ren'py parts are made with software that can only build for Windows).

Folders as follows:

TopLevelFolder
----MyNonRenpyLauncher.exe
----AssetsFolder
----RenpyGamesFolder
--------game (folder)
--------lib (folder)
--------renpy (folder)
--------renpygame1.exe
--------renpygame1.py
--------renpygame2.exe
--------renpygame2.py

The only additional step was in the lib\windows-i686 folder I needed to make sure that I had copied the game exe files from the individual lib\windows-i686 build folders.

Doing this I ended up with two games that share assets and Ren'py system files, libraries, etc.

If anyone spots anything wrong with this please say and I'll edit it to avoid leading anyone else astray.
gamelike things for persons

http://www.fizzhog.com

Post Reply

Who is online

Users browsing this forum: Google [Bot]