sending messages or info to a suspended scene

Hi i have a quick question

In my project I have a main scene for my character and stuff and I also have an overlay scene for inventory. I pretty much have things working as to the way I would expect the inventory the inventory to work. Also I can press I to make the inventory appear, dissapear. And this works correctly also :smiley:

When I press I to hide the inventory it hides the objects and suspends the scene.
When I is press again it reappears and the scene is resumed. All of this works great up until this point.

I can add an object from the inventory side no problem. It finds the next empty slot and assigns itself to it.

When I try to add an item that say is dropped from the character scene I send the message and set up the pythin/sensors on both sides, but its not working. I can debug and tell that its sending the message. Im guessing that my inventory is not receiving the message because the scene is suspended while im using the character scene. SO im wondering, how do i get the message to the suspended scene.

The message is something like this:

 
owner.sendMessage("additem",str(owner["item"])) 
*first item is subject, second is the name of the object that will be added, pulls from a property, and the message is  not to any particualr object

So is there a way to get the messages to the suspended scene :smiley:

any help appreciated

I’m just guessing from the description of your problem, but it seems like messages don’t work in suspended scenes, huh? It would seem like a more reliable method would be to directly get the inventory object and set the variable yourself. Example:



from bge import logic

sce = logic.getCurrentScene()

inventorysce = [s for s in logic.getSceneList() if 'Inventory' in s.name][0] # Get the scene whose name has the word "Inventory" in it

inventoryobj = inventorysce.objects['Inventory'] # Get the Inventory object in that scene

inventoryobj['variable'] = 1 # Set the variable, or whatever


I haven’t tested this, but it should allow you to set the variable even though the scene is suspended.

ill try changing a property on the suspended scene and see what happens :smiley: