Pages: 1
Author Topic: Does ENIGMA support command-line args ?  (43,134 Views)
Offline (Unknown gender) Darkstar2

Member
Joined: Jan 2014
Posts: 1,238
View profile
Posted on: April 26, 2014, 07:28:07 PM
Example, I compile my game and call it game.exe.

I launch my game with game.exe /config
in this case my command line argument would be "/config".

IS it possible to pass along execution arguments to an ENIGMA program ?

I think this was possible with GM8.

If so, how do you do it ?
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #1 Posted on: April 26, 2014, 09:52:57 PM
That's possible but you have to interpret the command line yourself, we are not and never will build anything that forces that on all games.

http://enigma-dev.org/docs/Wiki/Parameter_string
http://enigma-dev.org/docs/Wiki/Parameter_count
http://enigma-dev.org/docs/Wiki/Environment_get_variable
Offline (Unknown gender) Darkstar2

Member
Joined: Jan 2014
Posts: 1,238
View profile
Reply #2 Posted on: April 27, 2014, 02:40:52 AM
Quote from: Robert B Colton on April 26, 2014, 09:52:57 PM
That's possible but you have to interpret the command line yourself, we are not and never will build anything that forces that on all games.

I don't understand what do you mean by that last part ?  As far as the first part, by interpreting yourself do you mean the command line is passed as one string, and that I would have to manually isolate all commands and interpret them ?
example
GAME.EXE  /cheat /secrets
would return a string "/cheat /secrets" and I would
have to isolate both /cheat and /secrets ?
If so that is not a problem.

As far as the second part, confused :D

BTW the show message does nothing for me in ENIGMA, displays nothing nowhere :D
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #3 Posted on: April 27, 2014, 04:15:42 AM
Yes you'll have to parse the command line arguments yourself. And what do you mean show_mesage don't work? Look in ENIGMA settings and make sure Win32 widgets is set, it's working fine here.
Offline (Unknown gender) TheExDeus

Developer
Joined: Apr 2008
Posts: 1,860
View profile
Reply #4 Posted on: April 27, 2014, 10:45:55 AM
QuoteGAME.EXE  /cheat /secrets
That will return two parameters, so parameter_count() will return 2. Then parameter_string(0) will return "/cheat" and parameter_string(1) will return "/secrets".
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #5 Posted on: April 28, 2014, 03:22:10 AM
That doesn't sound right. If it's compliant, parameter_count() should give 3, with parameter_string giving "GAME.EXE", "/cheat", and "/secrets" for 0, 1, and 2, respectively.
Offline (Unknown gender) Darkstar2

Member
Joined: Jan 2014
Posts: 1,238
View profile
Reply #6 Posted on: April 28, 2014, 04:42:51 AM
Quote from: Josh @ Dreamland on April 28, 2014, 03:22:10 AM
That doesn't sound right. If it's compliant, parameter_count() should give 3, with parameter_string giving "GAME.EXE", "/cheat", and "/secrets" for 0, 1, and 2, respectively.

Thanks ! Indeed Josh is correct.

Tested it, it does include the file you ran as string 0, followed by the rest.  So this function is compliant and working as it should.
Pages: 1