Is there a way to transfer data through scenes?

So right now I’m working on a game where you get coins in other scenes and I was wondering if there was a way to transfer the counting data

Yes, click the right arrowhead twice in the SWITCH TO SCENE block and you get


The message ("and send") should be a text string (or the green flag in the pulldown), but the "with data" can be an arbitrarily complicated list. But you can't send procedures or sprites, because they would end up dragging in the entire environment of the old scene.

@bh does that mean you can not send a variable through scenes? I've been trying too but i can't figure out how.

I'm not sure exactly what you're asking. You can certainly include the value of a variable in the payload of the message you send (as long as that value isn't a procedure or a sprite). And, since the payload can be structured however you want, you can include an association list of variable names and values, and have your new scene react to the message by creating the variables and giving them the values. But you can't cause a variable to be created in the new scene automatically.

I made a coin as a variable and I’m asking if I can send the amount of the coins through scenes.

Yeah, sure, you can put the quantities in a list and send that in the data slot.

..really? Is this a new 8.0 thing?

Yes it is.

oh, cool

Can you please send an example. If you can't that's okay, I'll figure it out.

In the starting scene:

In the new scene:
untitled script pic (1)


If you have the different coins in different variables, you can

Is there a way to make the list automatically update?

Umm, yeah, you write code that updates it! Or, if you're using separate variables for the different kinds of coins, you generate the list at the last moment, just before switching scenes.