View Full Version : Progressbar update in function
Rorschach 04-16-2007, 11:32 AM I seem to have a recurring problem where if I have a progressbar update in a function then this will fail the first time I run the script (undefined) but will work on subsequent attempts.
I assume this is because when the the script is run for the first time the function is declared when the progress bar has not yet been intialised?
Whats the solution?
Thanks
|
|
ypuech
04-16-2007, 12:03 PM
Hi,
Please, can you show us your code ?
dutch_delight
04-16-2007, 01:59 PM
have you declared it as a global variable/function? can you do a check like:
if progressbar != undefined then ....yadeyadeyade
handiklap
04-17-2007, 01:19 PM
I had this same problem a while back, and one solution was to predeclare your rollout variable as global, like such:
global myRollout
include "someFunction.ms"
include "someOtherFunction.ms"
rollout myRollout "My Rollout"
(
etc.
)
MoonDoggie
04-20-2007, 05:57 PM
You probably have something like
rollout rlt_Progress "Progress"
(
rlt_main.pbar.value = 100/i --foo
)
rollout rlt_main "Test Rollout"
(
progressbar pbar "till completion"
)
And your code is getting to the rollout rlt_Progress and since it hasn't seen rlt_main yet it is undefined.
But the code will execute through that and rlt_main will be declared as a global variable after that, meaning upon next execution the global variable rlt_main will exist and will execute properly. (Variables in Maxscript are global unless declared otherwise and will persist through resets/file-opens etc till max is exited.)
To fix these problems explicitly declare your rollouts and functions at the top of the file
global rlt_main
global rlt_Progress
global fn_function
etc.
Just as the above poster said
CGTalk Moderation
04-20-2007, 05:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.