@dm604
Using RPGM's variables inside script calls might become burdensome maintenance-wise.
For example, if you change the red tint color from variable 213 to 1001 then you have to change every single script where that variable is mentioned. But there is a better way.
First, you run an initialization event where you link, only once, variable 213 to a script variable. And then in all your script calls you use the script variable and not the RPGM variable. This is called separation of concepts.
Now, if you change your mind about using 213 and start using 1001 instead, all you need to do is change what that variable is linked to in the initialization event.
Oh, wow! Thank you for your detailed explanation!
I am new to MZ (only started since July) and new to JS, so I'll try my best to understand.
window.glb = {} I guess this is to use the "glb" method of the window object to create an empty object? Or is it to create a new property called .glb under the window object and give it an empty object?
window.glb.rgbg = [0, 0, 0, 0] To create an empty array?
window.glb.rgbg[0] = $gameVariables.value(213).
window.glb.rgbg[1] = $gameVariables.value(214).
window.glb.rgbg[2] = $gameVariables.value(215).
window.glb.rgbg[3] = $gameVariables.value(216).
So bascially the code will be:
window.glb.rgbg = [$gameVariables.value(213), $gameVariables.value(214), $gameVariables.value(215), $gameVariables.value(216)]
And then you store the duration value to:
window.glb.dur
This is the part I don't get:
hlp.print(window.glb.rgbg)
I googled it, and it turns out to be something related to three.js?
Thank you, I think my knowledge of Javascript just got better.
🙂