Possible DeactivatePackage bug (1.1b1.1)
by Scott Lahteine · in Torque Game Builder · 03/06/2006 (6:11 pm) · 3 replies
I'm trying to make a game that has a few different modes of play. I'm encapsulating each game type in its own package block, with generic functions like CreateControls() and InsertGameObjects(). I've just finished making a simple set of GUIs for exiting the game and starting a new one, but I'm having a problem!
When the user selects a game type I call a function that deactivates all the game-type packages and then activates just the selected game-type package.
However, when I then call the CreateControls() function it doesn't call the one from the newly activated package. It calls the one from the package that was first activated.
Is this a bug in package handling, or a feature of package handling, or is there something I'm not doing to make sure the right package is being activated?
Here's what my code looks like:
When the user selects a game type I call a function that deactivates all the game-type packages and then activates just the selected game-type package.
However, when I then call the CreateControls() function it doesn't call the one from the newly activated package. It calls the one from the package that was first activated.
Is this a bug in package handling, or a feature of package handling, or is there something I'm not doing to make sure the right package is being activated?
Here's what my code looks like:
function StartGame(%game)
{
ClearGameMenu();
DeactivatePackage(Blobs);
DeactivatePackage(Stacks);
DeactivatePackage(Trumps);
switch$ (%game)
{
case "blobs":
ActivatePackage(Blobs);
case "stacks":
ActivatePackage(Stacks);
case "trumps":
ActivatePackage(Trumps);
default:
ActivatePackage(Blobs);
}
InitAndStartGame();
}About the author
#2
i had the exact same problem...instead of activating the package right after deactivating all packages, i scheduled it to get activated after some time and it works fine now
01/18/2010 (3:52 am)
hmmm....old posti had the exact same problem...instead of activating the package right after deactivating all packages, i scheduled it to get activated after some time and it works fine now
#3
the previous package is still active...does anyone know a solution to this?
01/18/2010 (4:11 am)
i take my words back!the previous package is still active...does anyone know a solution to this?
Torque Owner Scott Lahteine
Well, although this made my code look a little more interesting, it didn't solve the problem. This bug still plagues me. Does anyone have any suggestions for what I can do to fix this in the T2D engine? I'd like to get this bit working before GDC next week, as we're going to be bringing our demo to show off.
Has anyone else used packages in this manner with any success? Would anyone suggest an entirely different - or more appropriate - approach?