Page 3 of 3

Re: Sending Player info to a window

Posted: Mon Aug 28, 2023 4:24 am
by marceros
Hi,

I'm sorry. I think I missed your answer from about a year ago.

I'd like to rephrase my question. I think I understand better what I'm missing.

I'm using the mainWindow._window to set variables from one secondary window that will be used in another secondary window. This works.

The problem is that I set several variables with initial values in the init.js but I've just realized that I don't know how to get their values.

What would be the way to do that?

Marcelo

Re: Sending Player info to a window

Posted: Mon Aug 28, 2023 4:05 pm
by drakinite
I believe that init.js runs within the main window scope but inside of a code block. So the following code inside init.js:

Code: Select all

var xVar = 1;
window.xWindow = 2;
const xConst = 3;
let xLet = 4;
results in xVar and xWindow being accessible from the window scope, but not xConst and xLet, because const and let are scoped differently from var.

The screenshot shows devtools open on the main window on the left, and on a dialog window on the right.
Image

Re: Sending Player info to a window

Posted: Tue Aug 29, 2023 10:22 am
by marceros
Thank you very much!

My problem was that I declared the variables with let or const instead of using var.

Your explanation solved my issue.