The -name command line operator for dedicated servers.
by Christopher Gardner · 06/28/2009 (4:46 am) · 2 comments
So, today I though, I've asked so many questions since I got here, it's time to give something back. This isn't a big humongus thing, but it works.
So this requires the editing of 3 script files:
scriptsAndAssests/main.cs
scriptsAndAssets/server/init.cs
Ok, so main.cs first
Add this to the end of the switch in the parse args function.
Now simply launch a dedicated server like so:
Goodbye
So this requires the editing of 3 script files:
scriptsAndAssests/main.cs
scriptsAndAssets/server/init.cs
Ok, so main.cs first
Add this to the end of the switch in the parse args function.
case "-name": //Case for the switch
$argUsed[%i]++; //....
if (%hasNextArg) { //If it has a next arg...
$NameIsDone = 1; //New global variable
$Pref::Server::Name = %nextArg; //Get the name of the server from the next argument
$argUsed[%i+1]++; //.....
%i++; //.....
}
else //Otherwise....
error("Error: Missing Command Line argument. Usage: -name <name_of_Server>"); //ACKKKK!!! ERROR MESSAGE!Now simply put the code below somewhere in the initDedicated() functionparseArgs();
Now simply launch a dedicated server like so:
YourGame.exe -dedicated -mission yourmission -name Your Server Name Here!
Goodbye
About the author
#2
After this:
Add this:
Don't forget the put a @ after the last line of the previous help line also.
07/24/2009 (5:07 pm)
also don't forget to add the lines in the help argument in the main.cs fileAfter this:
function displayHelp() {
Parent::displayHelp();
error(Add this:
" -name <name of server> For naming specific Server name\n"
Don't forget the put a @ after the last line of the previous help line also.
Torque 3D Owner Christopher Gardner
If you did this earlier and modifided your game, you can remove the parts in default.cs, they are not needed anymore.