Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,643 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Command Arguments... #20805
12/07/03 11:38
12/07/03 11:38

A
Anonymous OP
Unregistered
Anonymous OP
Unregistered
A



Hi. I have a question. Can an engine accept command arguments? For example, if I want to have a user to select a resolution, color depth, tripple buffering on/off, etc. right from a dialog box that I made using Visual C#. I know 3DGS doesn't support C# but I just want my program to pass on the parameters (meaning command arguments).

Here's an example in C#:

Code:

/// <summary>
/// When a user click an Okay button, the game starts. This button will send the command
/// arguments to the engine. For example of command arguments, see the example in "//"
/// below.
/// </summary>
/// <param name
private void Okay_Clicked(object sender, System.EventArgs e)
{
Process ExecEngine;
ExecEngine.StartInfo.FileName = "C:\\MyProject\\SimpleGame\\SimpleGame.exe";
// Here's an example of passing command arguments to a file called SimpleGame.exe:
// -res:7 -color:32 -anis:2 -tb:1 -sd:24
ExecEngine.Arguments = resolution + " "
+ colordepth + " "
+ anisotropic_filter + " "
+ tripple_buffer + " "
+ shadow_depth;
ExecEngine.Start();
}



So the question is: Can the engine accept command arguments? I know that the example that I showed you is incorrect (but maybe it is... ) but I just want to know.

Anyway, this topic is engine-related.

Re: Command Arguments... #20806
12/07/03 11:47
12/07/03 11:47
Joined: Oct 2003
Posts: 1,258
Virginia, USA
qwerty823 Offline
Senior Developer
qwerty823  Offline
Senior Developer

Joined: Oct 2003
Posts: 1,258
Virginia, USA
The only way I know how to do that is using the -d (used to define values).

Then in your code, you can use IFDEF, or just use the defined values.

So to do video mode from outside, you can do something like this:

// This will start our prog in 800x600x32 fullscreen

yourprog.exe -d VIDEO_MODE,7 -d VIDEO_DEPTH,32 -d VIDEO_SCREEN,1

And this in your code.

var video_mode = VIDEO_MODE;
var video_depth = VIDEO_DEPTH;
var video_screen = VIDEO_SCREEN;

Granted I havent tested it, but I have done something simalar using DEFINE from another file.


Never argue with an idiot. They drag you down to their level then beat you with experience
Re: Command Arguments... [Re: qwerty823] #20807
12/13/03 06:56
12/13/03 06:56
Joined: Oct 2002
Posts: 119
Whirabomber Offline
Member
Whirabomber  Offline
Member

Joined: Oct 2002
Posts: 119
Or just toss the data into a text file that is read by your program at runtime. It would make the settings a little more "permanent".

Re: Command Arguments... #20808
12/13/03 07:21
12/13/03 07:21
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
do a search in the manual on command line

one of the options is this.

Quote:


-d name[,value]
Defines the given name for further evaluation in the script through IFDEF. This has the same effect as giving DEFINE name; or DEFINE name,value; within the script. Note that in the second case there must be just a comma, and not any spaces between name and value in the command line. This way, arbitrary game options, like starting screen resolution, difficulty grade etc., can be set via the command line.







think this is what your after

look up your c# programming too on passing data direcly into you main() at start of runtime i.e. main ( resolution,bits,d3d_onoff) and what ever.


Last edited by Grimber; 12/13/03 07:29.
Re: Command Arguments... [Re: Whirabomber] #20809
12/13/03 10:16
12/13/03 10:16
Joined: Oct 2003
Posts: 1,258
Virginia, USA
qwerty823 Offline
Senior Developer
qwerty823  Offline
Senior Developer

Joined: Oct 2003
Posts: 1,258
Virginia, USA
That doesnt work for variables that must be defined at startup, and cant be changed at runtime. The only way i know to change them is using the -d method.


Never argue with an idiot. They drag you down to their level then beat you with experience
Re: Command Arguments... [Re: Grimber] #20810
12/13/03 10:38
12/13/03 10:38

A
Anonymous OP
Unregistered
Anonymous OP
Unregistered
A



Okay. so if I want to pass the command arguments like starting the resolution, color depth, etc.,

when I want to launch a game in a command line, do I do it like:

"mygame.exe -d Resolution[8],ColorDepth[32]" etc.?

If this isn't right, then can you give me an example? Not in C# but when you pass the command arguments in a command line.

And how will I do this in C-Script?

Do I do this like:

var video_mode = RESOLUTION,8;
var video_depth = COLORDEPTH,32;
// etc.

?

If yes, then if I don't pass any of the command arguments to my game, then since I had entered a number after a comma in the C-Script, the program will take a default that I had set in those predefined variables, right?

Re: Command Arguments... #20811
12/13/03 12:21
12/13/03 12:21
Joined: Oct 2003
Posts: 1,258
Virginia, USA
qwerty823 Offline
Senior Developer
qwerty823  Offline
Senior Developer

Joined: Oct 2003
Posts: 1,258
Virginia, USA
Heres how I would do it:

C-Script:
ifndef VID_MODE;
define VID_MODE,8; // Change the 8 to your default mode
endif;

ifndef VID_DEPTH;
define VID_DEPTH,32; // Change the 32 to your default depth
endif;

video_mode = VID_MODE;
video_depth = VID_DEPTH;

The ifndef checks to see if those were defined (from the command line), and if not it defines them to whatever you want the defaults to be.

And start the game like so:

mygame.exe -d VID_DEPTH,8 -d VID_MODE,32

You could also do it other ways, like:

mygame.exe -d VID800X600X32

ifdef VID800X600X32;
video_mode = 8;
video_depth = 32;
endif;

// Repeat the above for all other modes you want.
// If you dont define one, you get the acknex.exe defaults.



Never argue with an idiot. They drag you down to their level then beat you with experience
Re: Command Arguments... [Re: qwerty823] #20812
12/13/03 15:13
12/13/03 15:13

A
Anonymous OP
Unregistered
Anonymous OP
Unregistered
A



Thank you for your help!


Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1