Author Topic: Cancelling schedules  (Read 1598 times)

Is there a function to cancel a schedule? I tried running cancel("function"); and cancel($Package::Schedule); but neither do the trick. I have 10 schedules on a loop and I have no idea how to cancel one before starting another.
« Last Edit: June 29, 2015, 07:47:21 PM by TristanLuigi »

H3

In the guns shapeBaseImageData(block), configure the guns image states to how you desire. If you get stuck, look at the image states of another automatic weapon for an example.

Ah, thanks. Looks like the key part is skipping the Reload state.

You cant actually get the node that the projectile hit, as it hits the collision box, not the model. The paint can projectiles just estimate based on z offset, eg if its less than 0.15, then change the feet colors, etc. You'll have to find these values yourself, or you may be able to call the paint projectiles function which handles this (which is probably the better option).

Run a trace, spray someone, and see what function handles it.

You cant actually get the node that the projectile hit, as it hits the collision box, not the model. The paint can projectiles just estimate based on z offset, eg if its less than 0.15, then change the feet colors, etc. You'll have to find these values yourself, or you may be able to call the paint projectiles function which handles this (which is probably the better option).

Run a trace, spray someone, and see what function handles it.
That's a good idea, I'll do it tomorrow; it's rather late and I'm going to bed. For those wondering, this is the add-on I'm creating.

Please stop changing the main OP, I'm actually getting confused when I read all the posts and their topic reply name.

H3

Is there a function to cancel a schedule? I tried running cancel("function"); and cancel($Package::Schedule); but neither do the trick. I have 10 schedules on a loop and I have no idea how to cancel one before starting another.
cancel($Package::Schedule); is correct syntax. You must be wrongly defining the variable as the schedule.

Do so like such:
$MySchedule = schedule(10000, 0, doThisFunction);
cancel($MySchedule);

Best method of managing a loop that schedules itself is such as this:
Code: [Select]
function doLoop()
{
cancel($MySchedule);

// DO STUFF

$MySchedule = schedule(1000, 0, doLoop);
}
« Last Edit: June 29, 2015, 08:54:11 PM by H3 »

cancel already checks to see if the specified event exists (and doesn't have any side effects otherwise), so the isEventPending check is redundant.

H3

cancel already checks to see if the specified event exists (and doesn't have any side effects otherwise), so the isEventPending check is redundant.
Ahh thanks, I'll edit my code above.

so the isEventPending check is redundant.
There are still some uses for it though.


Please stop changing the main OP, I'm actually getting confused when I read all the posts and their topic reply name.

Look I just didn't want to spam the board because I thought it would annoy you guys and I've seen people be criticized for that... guess you can't win :/

Thanks for the help, guys