PDA

View Full Version : Global Variable



Apheresis
05-26-2003, 09:17 AM
What is the difference between using a global variable in Motion Scripts and the "store" and "recall" functions? I have a made a script that works perfectly in the Lightwave Preview, but does not work when rendered. The script stores the current rotation of an object (using a global variable), and if the object is under a certain circumstance, sets the current rotation to the value of this stored global varaible.

Any ideas where my problems may be coming?

faulknermano
05-28-2003, 02:06 AM
the main diff between recall()/store() and global variables is that global variables exist as long as the script is active. recall() and store() reads and writes, respectively, to the registry so that values are stored across multiple invocations of the script.

as for your script, i havent time to dissect it. it may be possible that usage of recall() / store() is part of the problem.

Apheresis
05-28-2003, 06:36 AM
So, it makes perfect sense that if I'm rendering a scene on multiple computers, there is no way that these variables can be passed from frame to frame. How are scripts like this typically executed in a "Render Farm" environment?

faulknermano
05-29-2003, 09:12 AM
So, it makes perfect sense that if I'm rendering a scene on multiple computers, there is no way that these variables can be passed from frame to frame.

well, it really depends what those variables are, and what they are used for.

variables can always been passed from frame to frame.. it's is where those variables get their data from that's important.



How are scripts like this typically executed in a "Render Farm" environment?

scripts operate in a 'render frame' environment in the same way it operates in a single computer. scripts are always instanced, so their variables, while named the same, are unique in themselves.

in your original case, i think all you have to do is simply get the position / rotation of your target obejct and apply it to the obejct that the script is attached to, using global variables. since the data in the variable is dependent upon a parameter that is WITHIN the scene itself, there's really no need to 'reach for the outside' in order to properly assign the value to the variable.