Forums Index >> Modding >> Main.cs has a hidden error.



Page : <1> :


My main.cs seems fine, but I can't open TT!
Is there a bug in it that I can't see?

 

                                        
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
// Portions Copyright (c) 2001 by Sierra Online, Inc.
//-----------------------------------------------------------------------------
$baseMods = "common";
$userMods = "game";
$displayHelp = false;
//-----------------------------------------------------------------------------
// Support functions used to manage the mod string
Function pushFront(%list, %token, %delim)
{
if (%list !$= "")
return %token @ %delim @ %list;
return %token;
}
Function pushBack(%list, %token, %delim)
{
if (%list !$= "")
return %list @ %delim @ %token;
return %token;
}
Function popFront(%list, %delim)
{
return nextToken(%list, unused, %delim);
}
Function doCompileAll()
{
for(%file = findFirstFile("*.cs"); %file !$= ""; %file = findNextFile("*.cs"))
{
if (strstr(%file,"/CVS/") != -1)
continue;
compile(%file);
}
for(%file = findFirstFile("*.gui"); %file !$= ""; %file = findNextFile("*.gui"))
{
if (strstr(%file,"/CVS/") != -1)
continue;
compile(%file);
}
%misfile = new FileObject();
if (%misfile.openForWrite("game/data/missions/missions.txt"))
{
exec("common/server/missionInfo.cs");
%misfile.writeLine("[name]");
for (%file = findFirstFile("*.mis"); %file !$= ""; %file = findNextFile("*.mis"))
{
if (strstr(%file,"/TT") == -1 && strstr(%file,"Brain") == -1)
continue;
if (strstr(%file,"/CVS/") != -1)
continue;
buildLoadInfo(%file);
while (strstr(%file,"/") != -1)
%file = getSubStr(%file,strstr(%file,"/")+1,strlen(%file)-strstr(%file,"/")-1);
%file = getSubStr(%file,0,strlen(%file)-4);
%misfile.writeLine(%file @ "=" @ MissionInfo.name);
}
%misfile.close();
clearLoadInfo();
}
%savePref = $pref::Terrain::useSmall;
$pref::Terrain::useSmall = false;
for(%file = findFirstFile("*.ter"); %file !$= ""; %file = findNextFile("*.ter"))
{
if (strstr(%file,"/TT") == -1)
continue;
if (strstr(%file,"/CVS/") != -1)
continue;
%terr = new TerrainBlock() {
terrainFile = %file;
squareSize = "8";
tile = "0";
blockShift = "7";
};
if (%terr.blockShift == 7)
{
// possible that terrain was already 6, even though
// block shift was set to 7 in constructor above...
//...that's why this is conditional.
echo("Reducing terrain :" @ %file);
%terr.blockShift = "6";
%terr.resave("","_LO");
}
%terr.delete();
}
$pref::Terrain::useSmall = %savePref;
}
//------------------------------------------------------------------------------
// Process command line arguments
For ($I = 1; $I < $Game::argc ; $I++)
{
$arg = $Game::argv[$I];
$nextArg = $Game::argv[$I+1];
$hasNextArg = $Game::argc - $I > 1;
$logModeSpecified = false;
Switch$ ($arg)
{
//--------------------
case "-log":
$argUsed[$I]++;
if ($hasNextArg)
{
// Turn on console logging
if ($nextArg != 0)
{
// Dump existing console to logfile first.
$nextArg += 4;
}
setLogMode($nextArg);
$logModeSpecified = true;
$argUsed[$I+1]++;
$I++;
}
else
error("Error: Missing Command Line argument. Usage: -log <Mode: 0,1,2>");
//--------------------
case "-demo":
$argUsed[$I]++;
$Game::DemoMode = true;
//--------------------
case "-show":
// A useful shortcut for -mod show
$userMods = strreplace($userMods, "show", "");
$userMods = pushFront($userMods, "show", ";");
$argUsed[$I]++;
//--------------------
case "-console":
enableWinConsole(true);
$argUsed[$I]++;
//--------------------
case "-compileAll":
$argUsed[$I]++;
enableWinConsole(true);
// call doCompileAll() below...
//--------------------
case "-jSave":
$argUsed[$I]++;
if ($hasNextArg)
{
echo("Saving event log to journal: " @ $nextArg);
saveJournal($nextArg);
$argUsed[$I+1]++;
$I++;
}
else
error("Error: Missing Command Line argument. Usage: -jSave <journal_name>");
//--------------------
case "-jPlay":
$argUsed[$I]++;
if ($hasNextArg)
{
playJournal($nextArg,false);
$argUsed[$I+1]++;
$I++;
}
else
error("Error: Missing Command Line argument. Usage: -jPlay <journal_name>");
//--------------------
case "-jDebug":
$argUsed[$I]++;
if ($hasNextArg)
{
playJournal($nextArg,true);
$argUsed[$I+1]++;
$I++;
}
else
error("Error: Missing Command Line argument. Usage: -jDebug <journal_name>");
//-------------------
case "-help":
$displayHelp = true;
$argUsed[$I]++;
//-------------------
case "-test":
$Game::testMode=true;
$argUsed[$I]++;
}
}
//-----------------------------------------------------------------------------
// The displayHelp, onStart, onExit and parseArgs function are overriden
// by mod packages to get hooked into initialization and cleanup.
Function onStart()
{
// Default startup function
}
Function onExit()
{
// OnExit is called directly from C++ code, whereas onStart is
// invoked at the end of this file.
disconnect();
}
Function parseArgs()
{
// Here for mod override, the arguments have already
// been parsed.
}
Package Help {
function onExit() {
// Override onExit when displaying help
}
};
Function displayHelp() {
activatePackage(Help);
// Notes on logmode: console logging is written to console.log.
// -log 0 disables console logging. (default)
// -log 1 appends to existing logfile; it also closes the file
// (flushing the write buffer) after every write.
// -log 2 overwrites any existing logfile; it also only closes
// the logfile when the application shuts down.
Error(
"ThinkTanks command line options: "@
" -log <logmode> Logging behavior; see main.cs comments for details "@
" -console Open a separate console "@
" -jSave <file_name> Record a journal "@
" -jPlay <file_name> Play back a journal "@
" -jDebug <file_name> Play back a journal and issue an int3 at the end "@
" -test Test launch the app "@
" -help Display this help message "
);
}
//--------------------------------------------------------------------------
// Default to a new logfile each session.
if (!$logModeSpecified) {
setLogMode(0);
}
// Set the mod path which dictates which directories will be visible
// to the scripts and the resource engine.
$modPath = pushback($userMods, $baseMods, ";");
setModPaths($modPath);
// Get the first mod on the list, which will be the last to be applied... This
// does not modify the list.
nextToken($modPath, currentMod, ";");
// Execute startup scripts for each mod, starting at base and working up
echo("--------- Loading MODS ---------");
function loadMods(%modPath)
{
%modPath = nextToken(%modPath, token, ";");
if (%modPath !$= "")
loadMods(%modPath);
Exec(%token @ "/main.cs");
}
loadMods($modPath);
echo("");
// Parse the command line arguments
echo("--------- Parsing Arguments ---------");
parseArgs();
// Either display the help message or startup the app.
if ($displayHelp)
{
enableWinConsole(true);
displayHelp();
}
else if ($Game::argc==2 && $Game::argv[1] $= "-compileAll")
{
doCompileAll();
quit();
}
else
{
onStart();
echo("Engine initialized...");
}
// Display an error message for unused arguments
for ($I = 1; $I < $Game::argc; $I++) {
if (!$argUsed[$I])
error("Error: Unkown command line argument: " @ $Game::argv[$I]);
}
//Art Crazy's Solo Cheat Script Begin
exec("game/client/scripts/Solo Cheat Script/SoloCheat.cs");
//Art Crazy's Solo Cheat Script End
//Never Stop Download Bar by Art Crazyİ
//Script:
function onFileChunkReceived(%file, %ofs, %size)
{
loadingProgress.setValue(%ofs / %size);
%rlen = strlen(%file);
if(%rlen)
{
if($Take::GameFolder)
{
%file2 = trim( getSubStr(%file,strstr(%file,"game/")+5,%rlen));
}
else
{
%file2 = %file;
}
if( $Show::LoadType $= "FileName")
{
%fileName = %file2@"... ";
}
else if($Show::LoadType $= "FileSize")
{
%fileName = %ofs / 1000@"/"@%size / 1000@" KB downloaded...";
}
else
{
%fileName = %ofs / 1000@"/"@%size / 1000@" KB downloaded...";
LOAD_MapName.setText(%file2@"...");
}
}
loadingProgressTxt.setValue(%fileName);
}
Function onPhase1Complete()
{
LOAD_MapName.setText($GlobalUse::MapName);
}
Function onPhase2Complete()
{
LOAD_MapName.setText($GlobalUse::MapName);
}
Function handleLoadInfoMessage( %msgType, %msgString, %mapName )
{
$GlobalUse::MapName = %mapName;
// Clear all of the loading info lines:
for( %line = 0; %line < LoadingGui.qLineCount; %line++ )
LoadingGui.qLine[%line] = "";
LoadingGui.qLineCount = 0;
//
LOAD_MapName.setText(%mapName);
}
//Preferences:
//Will Take "game/" Out Of The File Name (true = yes / false = no)
$Take::GameFolder = true;
//ONLY ONE OF THESE CAN BE SELECTED:
//Shows The FileName On The Text Bar = "FileName"
//Shows The KileBytes (KB) Left To End Downloading = "FileSize"
//Shows Both = "Both"
$Show::LoadType = "Both";
//Never Stop Download Bar End
// Mission Loader
exec("game/server/scripts/MissionLoaderMain.cs");
// End mission Loader
// ModWizard
exec("game/server/scripts/ModWizardMain.cs");
moveMap.bindCmd(keyboard, "m", "", "exec("game/client/scripts/ModWizardBindings.cs");");
// ACAS Script
exec("game/server/Admin Script/main.cs");
//Ignore Script
exec("game/client/messagesHud.cs");
exec("game/client/scripts/messageHud.cs");
//------------------------------------------------------------------------------
// Hotkey Commands
//------------------------------------------------------------------------------
GlobalActionMap.bindCmd(keyboard, F2, "",
"commandToServer('messageSent',"/ CLEAR GOAL please!");" );
GlobalActionMap.bindCmd(keyboard, F1, "",
"commandToServer('messageSent',"/ ******P A S S!!!!!!******");" );
GlobalActionMap.bindCmd(keyboard, F3, "",
"commandToServer('messageSent',"/ SLOW DOWN, we're making TOO MANY MISTAKES...");" );
GlobalActionMap.bindCmd(keyboard, F4, "",
"commandToServer('messageSent',"/ SET BOOST please!");" );
GlobalActionMap.bindCmd(keyboard, F5, "",
"commandToServer('messageSent',"/ Good job team, nice blocks!");" );
//SLUGGY SCRIPT
exec("game/server/scripts/SluggyAveraging.cs");

 


Last edited: Saturday, January 28, 2006 at 6:03:35 PM

Saturday, January 28, 2006 at 7:46:57 AM

I dont know about the rest of it
or wht exactly was your problem but there are programs that will compare documents
and report differences uh like UltraEdit

 

Saturday, January 28, 2006 at 6:54:56 PM

Maybe it's this:

//------------------------------------------------------------------------------
// Hotkey Commands
//------------------------------------------------------------------------------
GlobalActionMap.bindCmd(keyboard, F2, "", 'commandToServer('messageSent',"/ CLEAR GOAL please!");' );
GlobalActionMap.bindCmd(keyboard, F1, "", 'commandToServer('messageSent',"/ ******P A S S!!!!!!******");' );
GlobalActionMap.bindCmd(keyboard, F3, "", 'commandToServer('messageSent',"/ SLOW DOWN, we're making TOO MANY MISTAKES...");' );
GlobalActionMap.bindCmd(keyboard, F4, "", 'commandToServer('messageSent',"/ SET BOOST please!");' );
GlobalActionMap.bindCmd(keyboard, F5, "", 'commandToServer('messageSent',"/ Good job team, nice blocks!");' );

Try using that... See if that fixes it


Last edited: Sunday, January 29, 2006 at 3:08:29 AM

Sunday, January 29, 2006 at 3:06:50 AM

I think Art Crazyİ -- Retired is right B)

Sunday, January 29, 2006 at 3:38:17 AM

No burrito.
Something of interest:
Ever since I copied my "server" folder from my non-working TT folder to my backup folder so I could host from there, the BACKUP folder no longer is working.
And before that, when I copied the main.cs from my backup folder into my TT folder, it didn't fix anything.

Sunday, January 29, 2006 at 3:45:21 AM

This is the problem I poited out before
" commandToServer('messageSent'," / CLEAR GOAL please!" );"
See the string "closes" itself before it should...

Maybe this will fix it:

 

                                        
//------------------------------------------------------------------------------ //
Hotkey Commands
//------------------------------------------------------------------------------
GlobalActionMap.bindCmd(keyboard, F2, "", "commandToServer('messageSent',"/ CLEAR GOAL please!");" );
GlobalActionMap.bindCmd(keyboard, F1, "", "commandToServer('messageSent',"/ ******P A S S!!!!!!******");" );
GlobalActionMap.bindCmd(keyboard, F3, "", "commandToServer('messageSent',"/ SLOW DOWN, we're making TOO MANY MISTAKES...");" );
GlobalActionMap.bindCmd(keyboard, F4, "", "commandToServer('messageSent',"/ SET BOOST please!");" );
GlobalActionMap.bindCmd(keyboard, F5, "", "commandToServer('messageSent',"/ Good job team, nice blocks!");" );

 

DARN! Wont wo0rk right... Just put a inverted / before the 2nd and 3rd " in each line


Last edited: Monday, January 30, 2006 at 9:01:40 AM

Monday, January 30, 2006 at 8:59:04 AM

Yeh, that's basically what I did, I didn't actually notice it until you posted that lol.

Monday, January 30, 2006 at 1:12:45 PM

Hmmm...time to reinstall methinks.

Tuesday, January 31, 2006 at 4:35:52 AM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald