GameMaker Studio 2 (2.3)
Icon

xScheduler

xDGameStudios

You must be logged in to obtain assets

Description

[INFORMATION]

This is yet another task scheduler (advanced timers) implementation asset for GMS2.3+

[QUICK GUIDE]

1) You need to instantiate a Scheduler, using the following code:

scheduler = new Scheduler();

2) Schedule a event to be executed after an amount of time, X seconds...

myEvent = scheduler.scheduleOnce(function() { show_debug_message("Done"); }, 3.5);

3) Finally during step event we need to call the scheduler update method on the scheduler.

scheduler.update(delta_time);

4) Run the game and after 3.5 seconds you should see the message "Done" printed to the terminal.

[USAGE]

This library provides a set of useful function that you can use to create time based (fps independent) events.

scheduler = new Scheduler();

scheduler.resume() // Will resume the scheduler if it was paused
scheduler.pause() // Will pause the scheduler if it is running
scheduler.update(delta_time) // Updates the scheduler
event = scheduler.scheduleOnce(callback, timeout) // Schedules an event with a callback function with a given delay.
event = scheduler.scheduleInterval(callback, interval) // Schedules a looping event with a callback function with a given delay.
trigger = scheduler.createTrigger(callback, timeout, loop, releaseRef) // Creates a trigger for scheduling events (*)
event = scheduler.unschedule(event/method, all?) // Unschedule a given event or a given method (optional all flag) 

The createTrigger method should be highlighted since it provides a powerful way of of dispatching events. This method returns a trigger and this trigger can be called as a method returning an event:

event = trigger(); // Triggers the schedule of an event. Trigger is duplicate safe, meaning that consecutive calls will NOT schedule multiple events.

The event instance itself provides a set of utility functions that can be used to manipulate the event after it was scheduled:

event.cancel() // Cancels the current scheduled event
event.isScheduled() // Returns true if the event as been scheduled (after the event executes its callback returns false)
event.getCallback() // Returns the callback method associated with the event

[NOTES]

The demo project serves as an example for the Scheduler system and all its code is inside the Demo folder of the asset pack. You don't need to include it to use the asset.

[COMPATIBILITY]

The asset is fully compatible with 2.3+ and is purely written in GML making it compatible with all exports available.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.0.0. Published May 14, 2021

Initial release

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait