ENIGMA Forums

Outsourcing saves money => Programming Help => Topic started by: Darkstar2 on April 26, 2014, 02:28:07 pm

Title: Does ENIGMA support command-line args ?
Post by: Darkstar2 on April 26, 2014, 02: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 ?
Title: Re: Does ENIGMA support command-line args ?
Post by: Goombert on April 26, 2014, 04: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
Title: Re: Does ENIGMA support command-line args ?
Post by: Darkstar2 on April 26, 2014, 09:40:52 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
Title: Re: Does ENIGMA support command-line args ?
Post by: Goombert on April 26, 2014, 11:15:42 pm
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.
Title: Re: Does ENIGMA support command-line args ?
Post by: TheExDeus on April 27, 2014, 05:45:55 am
Quote
GAME.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".
Title: Re: Does ENIGMA support command-line args ?
Post by: Josh @ Dreamland on April 27, 2014, 10:22:10 pm
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.
Title: Re: Does ENIGMA support command-line args ?
Post by: Darkstar2 on April 27, 2014, 11:42:51 pm
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.