[Closed] updating a value stored in a script controller..?
Hey guys,
I hope someone could help me out with a doubt I have and I don’t know how to solve…
I have a scripted controller assigned to an object, it just calculates some distance value, like this:
finalDist - ( distance pointA pointB )
now, “finalDist” is assigned as a constant right now, with a value of 100.
What i want to do is keep “finalDist” with that value and whenever I press a button on a custom attribute on an object I want that finalDist to refresh and change to another Value…is that possible? any ideas?
thanks a lot!
Search in the next link for ‘addConstant’ to a script controller:
http://help.autodesk.com/view/3DSMAX/2016/ENU/?guid=__files_GUID_569BE1BC_216E_496F_9EDE_1E8D2DB42194_htm
hey Thanks for that. I will try to be more specific on my question tho. Let’s say I add a constant X to finalDist. now, I want X to change to another value whenever I press a button on the interface, I know I could assign a variable instead of a constant, but I want it to be a constant value and only update whenever I press a button. any ideas how to approach that?
thanks!
If I am understanding it correctly, perhaps you could add a “flag” variable to be triggered only when you click the button.
For example, you create a variable ‘flagValue’ with a value of undefined. When you click on the button you assign a value to ‘flagValue’, set ‘finalDist’ to this value and immediately set ‘flagValue’ back to undefined.
(
flagValue = undefined
if flagValue != undefined do
(
finalDist = flagValue
flagValue = undefined
)
)
add the CA you use as an object to your scripted controller. store any values you want to use in a parameter block(s) of this CA and read them from the controller’s script.
hey thanks for the info guys, really appreciated! I’ll try that later on tonight and see if i have any luck!