how to send a message between diferent scenes?

Im working on a game, and I was wondering how to send a message between scenes that are unrelated, for example I have a tutorial scene 1 and I have the exercice scene, those are independent between them, but I want to know how can I send a message from tutorial scene 1 to exercise scene?

Just call sendMessage() from the logic module. The receiver scene has to be active (overlay, background) while you send the message.


I want to make this without make it overlay or bg the other scene, I would probably should store the the values on a general script that runs on each scene. Never mind mordin i tought that this would be easier, thanks!

Just access the scene or object and set the variables you need to set:

gamesce = logic.getSceneList()
gamesce.variable = 1
gamesce.objects[‘Player’][‘variable’] = 1

For example.

thanks solar lune, I took some time to look back on the forum since I became aware that the mouseover sensor isnt work properly on blender, allways when I try to make something cool and well done on blender, some internal bug from the blender itself ruin my work.

The Mouse over sensor should work fine in Blender. What OS are you using? Also, I believe that only one object can be moused over at a time. For example, if you are testing for mousing over an object with a ‘grid’ property and there’s something else above it, that other object won’t trigger the sensor, but may also not allow the grid to set the sensor to positive.

import GameLogic as G
if not hasattr(G, "x"):
             G.x = 0

then you can use G.x
ps: you can ignore the hasattr thing too, seen people saying that this is global for all scenes [correct me please if I’m wrong]

You’re right, Ziauddin MK. All scenes can access variables set in the bge.logic or GameLogic module.

thanks guys, the biggest problem is that the mouse over calculates the logic from objects behind it, so I have for example 20 cubes behind it with a mouse over sensor, then blender calculates all the 20 cubes mouse over logic and that slows down the game, and I cant use like that, I made a scne and when I moved the mouseover the cubes the logic hit 80%, thats is unplayable.
I m sorry to take so long to answear.

No problem. It sounds like your logic on the cubes is far too heavy. A large part of coding is optimizing - the BGE most likely is powerful enough to handle your project. You just have to optimize the code.

HEHE, that s the problem, there are only logick bricks almost, but aniway, Now a friend helped me with a script for the scene, and its working, now the logic is hitting about 3.6 ms but its way way way better than the 80% that I got with my previrous setup. and the game is starting to look very cool. Thanks a lot for your help guys without you all i would not gone so far with this project.