Error running script first time "-- Type error : Call needs function or class, got: undefined"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I run this script through the script editor - there's no problem with the script itself, but running a function through buttonpressed - there are five buttons. I run with ctrl + E, and the first time I press the button it comes up with this error:
The process in question is simple, and should work, but produces an error the first time it is run:
Rollout MeshTools "Mesh Tools"
(
button resetTheXformButton "Reset Xform" pos: [2,0] width:250 height:40
button resetRotationButton "Reset Pivot Rotation" pos: [2,40] width:250 height:40
button setPivotToZeroButton "Set Pivot To Centre/Ground 0" pos: [2,80] width:250 height:40
button removeCustomAttributesButton "Remove Custom Attributes" pos: [2,120] width:250 height:40
button reposButton "Reposition Object at z:0" pos: [2,160] width:240 height:40
on resetTheXformButton pressed do
(
ResetTheXform()
)
on resetRotationButton pressed do
(
ResetThePivotRotation()
)
on setPivotToZeroButton pressed do
(
SetPivotToZero()
)
on removeCustomAttributesButton pressed do
(
RemoveCustomAttributes()
)
on reposButton pressed do
(
ReposObject()
)
)
If I re-run it, it works fine every time afterwards. What is the problem here - is it running through the editor the problem?