Game Development Community

The first main.cs

by Thomas Bang · in Torque Game Engine · 08/27/2008 (4:06 am) · 3 replies

Hi

I try to understand the first main.cs (where the executable is).
There is a function called "loadMods".

$userMods = "creator;" @ "prototype";

function loadMods(%modPath)
{
   %modPath = nextToken(%modPath, token, ";");
   if (%modPath !$= "")
      loadMods(%modPath);

   if(exec(%token @ "/main.cs") != true){
      error("Error: Unable to find specified mod: " @ %token );
      $modcount--;
   }
}

loadMods($userMods);

If i use this function everything works fine. But if i dont use "loadMods($userMods);" and write instead

exec("creator/main.cs");
exec("prototype/main.cs");

... i get a crash.


Greetings
Thomas

#1
08/27/2008 (1:33 pm)
You shouldn't need to change anything in there, what are you trying to accomplish?
#2
08/27/2008 (2:14 pm)
The reason is simple: I want to know WHY i have to use this and this and this function. This way i get a deeper knowledge about how Torque works.
I read also through the scripts of the "common"-folder. It is very interesting.

By the way. I found the solution for the crash. Switch the exec commands.
Change from...

exec("creator/main.cs");
exec("prototype/main.cs");

to...

exec("prototype/main.cs");
exec("creator/main.cs");

I dont know why... but it works.
#3
08/28/2008 (11:25 pm)
The reason it crashed is probaly because it needs to load the /prototype/main.cs before the creator/main.cs