Game Development Community

Can I attach a schedule to GuiProgressCtrl?

by Steve Howson · in Torque Game Engine · 09/08/2005 (10:25 pm) · 2 replies

Hi all.
I've gotten scheduling to work and have noticed that there is a GUI control 'GuiProgressCtrl'.

Is that only for loading levels, or can I attach a schedule to it to use it for a certain amount of time?

For instance if I want to show the progress for 10 seconds, can I use it?

If so, could someone explain how?
I've searched for info on it and there is very little.
I found it in the scripts, but I can't figure out how to attach stuff to it.

Any help would be appreciated.

Steve

#1
09/09/2005 (9:28 am)
Lets say you have a GuiProgressCtrl called MyProgress somewhere.
You could do this:
MyProgress.updateThread = MyProgress.schedule(1000, "update");

function MyProgress::update(%this)
{
   // progress bar is a value between 0 and 1,
   // so increment by 1 and divide by 10 to
   // to coincide with a 10 seconds progress bar
   %this.current++;
   %newValue = %this.current / 10;

   // change the progress bar
   %this.setValue(%newValue);

   // call ourself 1 second later to update again
   %this.updateThread = %this.schedule(1000, "update");
}

// if you need to cancel
if(isEventPending(MyProgress.updateThread))
   cancel(MyProgress.updateThread);
#2
09/09/2005 (11:41 am)
Beautiful!
That was exactly what I was looking for.

Thanks a lot!
Steve