Hello.
I am very new to scripting and coding.
I am trying to send variables values using parent.postMessage:
parent.postMessage({
tipo: "jogo-completo",
pontuacao: [runtime.globalVars.Pontuacao],
tempo: ${runtime.globalVars.TempoTotal},
nivel: 3
}, "*");
window.addEventListener("message", function(event) {
console.log("Mensagem recebida:", event.data);
});
alert("Você completou o jogo!");
console.log("✅ Enviando dados:", {
pontuacao: runtime.globalVars.Pontuacao,
tempo: runtime.globalVars.TempoTotal,
nivel: runtime.globalVars.NivelAtual
});
I want to send 'pontuacao' (points) and 'tempo' (time)
The global variables for both are created.
I have tried, for example:
[runtime.globalVars.Pontuacao] and ${runtime.globalVars.TempoTotal} but they don't work.
Anyone can kindly guide me what I am getting wrong and how to send this variable values?
Thank you.