Author Topic: How to find time left before schedule and if something is currently scheduled?  (Read 2737 times)

I need a way to find the time left before a schedule event will occur and a way to find out if something is currently scheduled; I tried isEventPending(); and getEventTimeLeft(); that I saw in the guide at http://forum.blockland.us/index.php?topic=20754.0 (pages 244-245) but neither seem to work for me. Is there another way to do this?
« Last Edit: March 23, 2013, 12:17:50 AM by Tojehusiza »

try in console
%sch=schedule(5000,0,"echo","hello"); schedule(2000,0,"echo",getEventTimeLeft(%sch));

try in console
%sch=schedule(5000,0,"echo","hello"); schedule(2000,0,"echo",getEventTimeLeft(%sch));
Brian, your example won't work. It will always say 5000ms left.

i saw something once that looked like %sched.timeRemaining, not sure if i did or not

schedule or gameBase::schedule returns a "schedule index". Pass it to getTimeRemaining to get the amount of time remaining.
« Last Edit: March 24, 2013, 03:09:13 AM by Port »

schedule or gameBase::schedule returns a "schedule index". Pass it to getEventTimeLeft to get the amount of time remaining.
Do you mean like getEventTimeLeft(%sch); ? I tried that already.

No such function as getEventTimeLeft apparently

Code: [Select]
$schedule = schedule(time,0,function,parameters);
getTimeRemaining($schedule);
Don't get getTimeRemaining() and getRemainingTime() mixed up as the latter is not a function.

getTimeRemaining()

Oh, right, that's what it's called. I didn't have time to check it in Blockland and I couldn't quite remember the name.

schedule or gameBase::schedule returns a "schedule index". Pass it to getTimeRemaining to get the amount of time remaining.

Now, is there something such as isEventPending()?

Now, is there something such as isEventPending()?

Yes, that's the exact name of the function.

Yes, that's the exact name of the function.
You should try it before asking questions about everything, Tojehusiza.

You should try it before asking questions about everything, Tojehusiza.
I did, it didn't seem to work for me either.

I did, it didn't seem to work for me either.

Then you are doing something wrong. Show us how you used it.

Then you are doing something wrong. Show us how you used it.

In an earlier function I had:
Code: [Select]
$Calendar = schedule($Cal::loop, 0, calendarLoop);
I am using it down here:
Code: [Select]
function serverCmdDate()
{
if(isEventPending($Calendar))
{
%suffix = getSuffix($Cal::curD);
%timeLeft = getTimeRemaining(%Calendar);

messageClient(%client, '', "It is\c3" SPC $Cal::curM SPC $Cal::curD @ %suffix @ "," SPC $Cal::curY @ "\c6. There are about\c3" SPC mFloor(%timeLeft) SPC "\c6seconds left before the next day.");
} //end if
else
messageClient(%client, '', "\c6The calendar is not currently running!");
} //end func