Need alot help here
by Cinderella Games · in Torque Game Engine · 02/12/2008 (2:56 am) · 2 replies
Hello, im a nub, and im trying to learn torque script recently from this book, i have a brief knowledge in C++.
everything is ok until i reach Chapter4, its really hard for me to understand the concept of the codes, i will list one of the code from that chapter and label my question, so this will be long, i apologize for that:
i delete all comments just coz it make this thread looks messed up
my question will be inside () besides the statement
$usageFlag = false;
$logModeEnabled = true;
SetLogMode(2); (what is that?)
function OnExit() (says to be pass error into this function but how?)
{
}
function ParseArgs()
{
for($i = 1; $i < $Game::argc ; $i++) (what is how can $Game::argc work her if it hasn't given a value?)
{
$currentarg = $Game::argv[$i];
$nextArgument = $Game::argv[$i+1];
$nextArgExists = $Game::argc-$i > 1;
$logModeEnabled = false;
switch$($currentarg)
{
case "-?":
$usageFlag = true;
$argumentFlag[$i] = true;
case "-h":
$usageFlag = true;
$argumentFlag[$i] = true;
}
}
}
function Usage()
{
Echo("\n\nemaga4 command line options:\n\n" @ " -h, -? display this message\n" );
} ( i actually dont understand how @ works)
function LoadAddOns(%list)
{
if (%list $= "")
return;
%list = NextToken(%list, token, ";"); (NextToken? come from where?)
LoadAddOns(%list);(where is LoadAddOns from)
Exec(%token @ "/main.cs"); (adjust if im wrong, so is %token from main.cs and this statement is to execute it?)
}
ParseArgs();
if ($usageFlag)
{
EnableWinConsole(true); (one again what is EnableWinConsole and Usage, Quit)
Usage();
EnableWinConsole(false);
Quit();
}
else
{
for ($i = 1; $i < $Game::argc; $i++)
{
if (!$argumentFlag[$i])
Error("Error: Unknown command line argument: " @ $Game::argv[$i]);
}
if (!$logModeEnabled)
{
SetLogMode(6); (once again SetLogMode?)
}
$pathList = $addonList !$= "" ? $addonList @ ";control;common" : "control;common";
(hoho this part is one of the confuseist thing i ever seen)
SetModPaths($pathList);(SetModPaths? what is that)
Exec("common/main.cs");
Exec("control/main.cs");
Echo("--------- Loading Add-ons ---------");
LoadAddOns($addonList);
Echo("Engine initialization complete.");
OnStart();
}
kk thatz all, well not all, it just one of the codes that i confused with lol...
and if there is some question made any of u 'lol' in front of ur screen, ill lol with u too :)
and thanks for check out my nub questions, ty more for give me the answer!
everything is ok until i reach Chapter4, its really hard for me to understand the concept of the codes, i will list one of the code from that chapter and label my question, so this will be long, i apologize for that:
i delete all comments just coz it make this thread looks messed up
my question will be inside () besides the statement
$usageFlag = false;
$logModeEnabled = true;
SetLogMode(2); (what is that?)
function OnExit() (says to be pass error into this function but how?)
{
}
function ParseArgs()
{
for($i = 1; $i < $Game::argc ; $i++) (what is how can $Game::argc work her if it hasn't given a value?)
{
$currentarg = $Game::argv[$i];
$nextArgument = $Game::argv[$i+1];
$nextArgExists = $Game::argc-$i > 1;
$logModeEnabled = false;
switch$($currentarg)
{
case "-?":
$usageFlag = true;
$argumentFlag[$i] = true;
case "-h":
$usageFlag = true;
$argumentFlag[$i] = true;
}
}
}
function Usage()
{
Echo("\n\nemaga4 command line options:\n\n" @ " -h, -? display this message\n" );
} ( i actually dont understand how @ works)
function LoadAddOns(%list)
{
if (%list $= "")
return;
%list = NextToken(%list, token, ";"); (NextToken? come from where?)
LoadAddOns(%list);(where is LoadAddOns from)
Exec(%token @ "/main.cs"); (adjust if im wrong, so is %token from main.cs and this statement is to execute it?)
}
ParseArgs();
if ($usageFlag)
{
EnableWinConsole(true); (one again what is EnableWinConsole and Usage, Quit)
Usage();
EnableWinConsole(false);
Quit();
}
else
{
for ($i = 1; $i < $Game::argc; $i++)
{
if (!$argumentFlag[$i])
Error("Error: Unknown command line argument: " @ $Game::argv[$i]);
}
if (!$logModeEnabled)
{
SetLogMode(6); (once again SetLogMode?)
}
$pathList = $addonList !$= "" ? $addonList @ ";control;common" : "control;common";
(hoho this part is one of the confuseist thing i ever seen)
SetModPaths($pathList);(SetModPaths? what is that)
Exec("common/main.cs");
Exec("control/main.cs");
Echo("--------- Loading Add-ons ---------");
LoadAddOns($addonList);
Echo("Engine initialization complete.");
OnStart();
}
kk thatz all, well not all, it just one of the codes that i confused with lol...
and if there is some question made any of u 'lol' in front of ur screen, ill lol with u too :)
and thanks for check out my nub questions, ty more for give me the answer!
About the author
Recent Threads
#2
woo that is defintly helpful, and i wouldnt noticed there is a great website there to help the nub questions
And thanks for answering so quick and detailed :)
02/12/2008 (3:51 am)
@andywoo that is defintly helpful, and i wouldnt noticed there is a great website there to help the nub questions
And thanks for answering so quick and detailed :)
Torque Owner Andrew Edmonds
EiKON Games
Off the top of my head I can answer a few, so here goes:
-- Sets the level of logging sent to the console.log file (see tdn.garagegames.com/wiki/TorqueScript_Console_Functions_2#setLogMode.28_mode_.29)
-- processes the arguments passed if the .exe is executed from the command line (eg torqueDemo.exe -dedicated [where dedicated would be an argument]
-- @ just concatonates two strings so:
echo('Hello ' @ 'world!');would return:-- Shows the windows console while the engine is being run. Handy for realtime tracking of console messages.
-- exits the engine
-- Tells the engine which folders to read your game data from (see tdn.garagegames.com/wiki/TorqueScript_Console_Functions_13#setModPaths.28_path_....)
That's all I have for you for now! Hope it helps...
Andy