Author Topic: Delay part of a function?  (Read 536 times)

I need a way to delay these two lines.

%menu.add(%Image);
%menu.add(%Border);

I don't have the schedule knowledge I require, my best bet was..

schedule(150,0,%menu.add,%Image);
schedule(150,0,%menu.add,%Border);
« Last Edit: March 19, 2013, 09:34:10 AM by Conservative »

That is correct, but you only have a 0.15 second delay which is unnoticeable

That is correct, but you only have a 0.15 second delay which is unnoticeable
The code adds the objects, but deletes both if I just have it add it instantly.

Executing it later makes it stay.

Also, the schedule doesn't appear to work, the number of objects stays at 16, when it should go up to 18.

I also tried..

schedule(1500,%menu,add,%Image);
schedule(1500,%menu,add,%Border);

But that does not work either.
« Last Edit: March 19, 2013, 10:04:29 AM by Conservative »

Do %menu.schedule(time,"function",arguments);

Since you have two things to schedule though, it might be more prudent to put them in a separate function and schedule the function call
« Last Edit: March 19, 2013, 10:42:58 AM by Treynolds416 »

Do [/tt]%menu.schedule(time,"function",arguments);[/tt]

Since you have two things to schedule though, it might be more prudent to put them in a separate function and schedule the function call
Count still stays at 16.

   echo(%menu.getCount());
   %menu.schedule(150,add,%Image);
   %menu.schedule(150,add,%Border);
   echo(%menu.getCount());

You have to also schedule the echo.

Count still stays at 16.

   echo(%menu.getCount());
   %menu.schedule(150,add,%Image);
   %menu.schedule(150,add,%Border);
   echo(%menu.getCount());

Execution order result:

echo(%menu.getCount()); => 16
echo(%menu.getCount()); => 16

0.15 seconds later (rounded to frames):

%menu.add(%Image);
%menu.add(%Border);

Okay, I had the echo scheduled, and it turns out the newly added objects are still being deleted.

Goes from 16, to 18, and echoing the count outside of the code shows up with 16 again.

I am able to execute the code later into the game startup, and have it work properly, without the deletion.

It is a client script that executes after the GUI objects have been created and adds two new objects to the GUI.

It deletes the two objects as soon as the script is finished, but I can execute it later and have it work fine.
« Last Edit: March 19, 2013, 11:06:27 AM by Conservative »