I have two buttons, a plane that displays a circle of 10 numerals, and a plane that displays an icon-picture.
The first button, when clicked, rotates a circle of numerals 36 degrees. This button also keeps track, in a variable, of which number is at the top of the circle. Let’s call it topnumber.
The second button, when clicked, will change the icon-picture texture, dependent on which numeral is at the top of circle.
What I want to do is …
When the second button is clicked, it grabs the value of topnumber (from the first button’s script), and then changes the texture of the plane that displays the symbol.
**So a question I have is …
How would I refer to a variable, in the second button’s scripting, that exists in the first button’s scripting?
**And another question I have is …
How would change the texture of an object from within the scripting of a different object? I was able to change the rotation of an object within the scripting of a different objects by using this:
…but I’m not sure how to do this same thing, that will change the texture …
Thanks to Stevesanerd and George, I found the answers:
how to grab a variable into a script that exists in a different script
When you identify the variable in a script, you must write:
export let topnumber = 0
And then when you grab that variable from within a different script:
-you must first add the script-with-the-variable is, as a constant at the top of the script-you-want-to-grab-the-variable.
-then you refer to that script like this: symbol.nodes.scriptwithvariablename.variablename
"how to change a plane’s material property:
I found reference to this here:
[How to change plane 'materials' property (texture) from my script]