Author Topic: [Resource] Custom Game Parameters  (Read 1488 times)

You may know of these already, "-dedicated", "-mod editor", "-gamemode slayer", etc. Turns out, they're easily accessible and can be mounted to your advantage. This might not be necessary for some people, but if you're running something with an advanced back-end, this could come in handy.

In this example I used "-maxcash value" to set $maxcash.
Code: [Select]
for (%a = 1; %a < $Game::argc; %a++)
{
%nextArg = $Game::argv[%a+1];
%hasNextArg = $Game::argc - %a > 1;
if($Game::argv[%a] $= "-maxcash")
{
$argUsed[%a]++;
if(%hasNextArg)
{
$maxcash = %nextArg;
$argUsed[%a+1]++;
$a++;
}
else
{
error("Error: Missing Command Line argument. Usage: -maxcash <parem>");
}
}
}

That's basically it.
« Last Edit: November 05, 2013, 10:31:52 AM by Subpixel »


Yup. This is how the launcher bypass was discovered.

Needs more switch$

Did you just learn about switches or something?

Hmm, that's pretty interesting. Thanks for posting, it's always nice to know about little tips and tricks like this.
« Last Edit: November 05, 2013, 05:26:56 AM by Zelothix »

Needs more switch$
Where would a switch even work in this script?

Code: [Select]
for (%a = 1; %a < $Game::argc; %a++)
{
%nextArg = $Game::argv[%a+1];
%hasNextArg = $Game::argc - %a > 1;
switch$($Game::argv[%a])
{
case "-maxcash":
$argUsed[%a]++;
if(%hasNextArg)
{
$maxcash = %nextArg;
$argUsed[%a+1]++;
$a++;
}
else
{
error("Error: Missing Command Line argument. Usage: -maxcash <parem>");
}
}
}

i think it processes faster, and looks cleaner than a billion if else if if if things
Did you just learn about switches or something?
did you just get super aggressive this month or something? you've gone after me twice in the past week

Needs more switch$
Switch statements execute no faster than if/else statements, nor are logically any different. Since the only difference between the two is aesthetics and there's only one case in OP's code, it really wasn't worth mentioning in the first place

I don't understand what this is for?

I don't understand what this is for?
Parameters for the EXE file, just like "-gamemode slayer" or "-dedicated".

Switch statements execute no faster than if/else statements, nor are logically any different. Since the only difference between the two is aesthetics and there's only one case in OP's code, it really wasn't worth mentioning in the first place
I thought they executed faster

My main point was aesthetics if you have a lot of these things going on.