Game Development Community

Delay in package activation

by Bruno Grieco · in Torque Game Builder · 05/21/2006 (5:37 pm) · 2 replies

Now this is a strange bug.

My game has two versions : version 1 the player must get all items in a shopping list AND version 2, the player must get all items in the shopping list IN ORDER.

So I have two packages :

package Version1
{
     function CreateShoppingList()
     {
     } 

     function currentVersion()
     {
          return 1;
      } 
};

package Version2
{
     function CreateShoppingList()
     {
     } 

     function currentVersion()
     {
          return 2;
      } 
};

function StartV1
{
     ActivatePackage(Version1);
     startGame();
}

function StartV2
{
     ActivatePackage(Version2);
     startGame();
}

Both functions StartV1 and StartV2 are linked to the gui and CreateShoppingList() is called from StartGame().

The problem is :

When I start a game in version1, finish the game and start a game in version2 ( or vice-versa). The CreateShoppingList() called is always the last version's. Not the current one.

There is no logical error in the script, cause if I load the game and start either versions, they get the correct shopping list function.

If I use :
schedule(100,0,"CreateShoppingList()");

instead of
CreateShoppingList();

It WORKS ?!?!?

So I created the currentVersion() function and changed :

function StartV2
{
     ActivatePackage(Version2);
     %x = 0;
     while(currentVersion()!=2)
        %x ++;

     echo(" X = " @ %x);

     startGame();
}

And %x always exits with 0 !!!

So all functions on the package are being activated imeadiately but CreateShoppingList() isn't ?!?!

VERY STRANGE !?!

#1
05/22/2006 (12:04 am)
When you finish the game, are you deactivating the current package?
#2
05/22/2006 (7:00 am)
This was the 1st thing I checked. Yes, it's deActivated.

But the strange thing is that the currentVersion function is activaed imediately. While only CreateShoppingList() isn't.