How to force a modification to load from another modification
by Dave Bacher · 08/20/2002 (4:26 pm) · 3 comments
The script-based portions of the enhancements I'm writing to the torque engine all live in a separate modification (similar to the admin system).
Because I intend to reuse this code, I am placing it in its own module. Rather than modify main.cs to load this other modification when my root modification is loaded, it loads the modification that it is dependent on.
Why would you want to do this?
Lets say that you aren't using the admin modification in your game. Further, lets say that you support only free for all game play.
I introduce a modification named "CTF" to the game, to add capture the flag rules to your game. I want to use the admin mod.
In this case, modifying the main game's main.cs file isn't a very good idea. Making the user specify both CTF and admin is also bad, because if they forget some functionality might not work.
What really should happen (in this sort of a case) is that the modification should know what other modifications it depends on, and load them on start up, so that you don't have to modify any game-provided base files to install your new modification.
Because I intend to reuse this code, I am placing it in its own module. Rather than modify main.cs to load this other modification when my root modification is loaded, it loads the modification that it is dependent on.
// Load the BatBaz Modification Kit
// (doesn't accomplish much if it is already loaded)
$userMods = strreplace($userMods, "BatBaz", "");
$userMods = pushFront($userMods, "BatBaz", ";");
$modPath = pushback($userMods, $baseMods, ";");
setModPaths($modPath);
loadMods("BatBaz");Why would you want to do this?
Lets say that you aren't using the admin modification in your game. Further, lets say that you support only free for all game play.
I introduce a modification named "CTF" to the game, to add capture the flag rules to your game. I want to use the admin mod.
In this case, modifying the main game's main.cs file isn't a very good idea. Making the user specify both CTF and admin is also bad, because if they forget some functionality might not work.
What really should happen (in this sort of a case) is that the modification should know what other modifications it depends on, and load them on start up, so that you don't have to modify any game-provided base files to install your new modification.
About the author
Recent Blogs
• Plan for Dave Bacher• HTTP Enhancement For Torque
• MD5 Hash for Torque
• Plan for Dave Bacher
• Plan for Dave Bacher
#2
I'd be interested to see if it works or not. I'd try it myself, but I'm at work :(
I know that Tricon2 has a mod switching utility, but sometimes (eh, frequently)) it makes things glitchy and causes more UE's than a mod running under T2 alone.
Sorry to bring up T2 again, please don't lay down the hand of smack on me, oh great Garage Gamers.
~ Jeff
(Still waiting on my copy of torque fellows... what gives?)
08/29/2002 (7:15 am)
Just curious, has anyone tried using this for T2?I'd be interested to see if it works or not. I'd try it myself, but I'm at work :(
I know that Tricon2 has a mod switching utility, but sometimes (eh, frequently)) it makes things glitchy and causes more UE's than a mod running under T2 alone.
Sorry to bring up T2 again, please don't lay down the hand of smack on me, oh great Garage Gamers.
~ Jeff
(Still waiting on my copy of torque fellows... what gives?)
#3
If the mod is not specified in main.cs, and is not specified on the command line, you can't reference it. That is I can't do:
exec("BatBaz/main.cs");
Until setModPath has been called, Resource Manager doesn't know about the mod. My intent is to make stdlib-like mods, similar to how C++, C# or VB operate.
Jeff:
Does T2 support mods in this same way, where you can say "-mod (name of mod)"? I've not seen any mod that didn't write itself to GameData in T2, which is why I did this tutorial.
If three different mods use Shifter, I shouldn't have three copies of Shifter. I should have one copy of Shifter, and three mods that reference it.
09/16/2002 (9:40 am)
Trevor:If the mod is not specified in main.cs, and is not specified on the command line, you can't reference it. That is I can't do:
exec("BatBaz/main.cs");
Until setModPath has been called, Resource Manager doesn't know about the mod. My intent is to make stdlib-like mods, similar to how C++, C# or VB operate.
Jeff:
Does T2 support mods in this same way, where you can say "-mod (name of mod)"? I've not seen any mod that didn't write itself to GameData in T2, which is why I did this tutorial.
If three different mods use Shifter, I shouldn't have three copies of Shifter. I should have one copy of Shifter, and three mods that reference it.
Trevor "PointDestruction"