Skip to content

schedule

The calendar of data/schedule.toml: whether a seasonal event is on, the list of events, switching one on or off like the .event command, and when a timed task runs next. A script cannot add entries to the calendar: a custom action is a task with action = "lua".

Source: src/Moongate.Server.Ultima/Modules/ScheduleModule.cs

schedule.active() -> table

The seasonal events that are on now, as an array of { id, name, mode }, mode being auto, on or off. An empty array when none is.

Returns table.

schedule.events() -> table

Every seasonal event of data/schedule.toml in file order, as an array of { id, name, from, to, mode, active }: from and to are the first and last day of the window as month-day, mode is auto, on or off, active is whether it is on now.

Returns table.

schedule.is_active(id) -> boolean

True when the seasonal event is on now, by its dates or because the staff forced it on; false when it is off and for an id that is not in data/schedule.toml.

ParameterTypeDefault
idstring

Returns boolean.

schedule.next(id) -> integer?

The Unix time in seconds of the next run of the timed task, the stop for a shutdown task; nil for an id that is not a task of data/schedule.toml, an event's included.

ParameterTypeDefault
idstring

Returns integer?.

schedule.set_event(id, mode) -> boolean

Sets the mode of the event to auto (follow the dates), on or off, as the .event command does, and runs its on_start or on_end hook if its state changes. True when done; false for an unknown id or mode. The module does not check who calls it: a script that is for the staff checks world.is_staff first. The mode is kept across restarts.

ParameterTypeDefault
idstring
modestring

Returns boolean.

Made with ❤️ by Tom

Buy me a coffee