ESCEventManager
Extends: Node
Description
Manager for running events.
There are different “channels” an event can run on. The usual events happen in the foreground channel _front, but additional event queues can be added as required. Additionally, events can be scheduled to be queued in the future.
Constants
EVENT_PRINT
const EVENT_PRINT = "print"
Used for local processing.
EVENT_EXIT_SCENE
const EVENT_EXIT_SCENE = "exit_scene"
Used for local processing.
EVENT_INIT
const EVENT_INIT = "init"
Used for local processing.
EVENT_LOAD
const EVENT_LOAD = "load"
Used for local processing.
EVENT_RESUME
const EVENT_RESUME = "resume"
Used for local processing.
EVENT_NEW_GAME
const EVENT_NEW_GAME = "newgame"
Used for local processing.
EVENT_READY
const EVENT_READY = "ready"
Used for local processing.
EVENT_SETUP
const EVENT_SETUP = "setup"
Used for local processing.
EVENT_TRANSITION_IN
const EVENT_TRANSITION_IN = "transition_in"
Used for local processing.
EVENT_TRANSITION_OUT
const EVENT_TRANSITION_OUT = "transition_out"
Used for local processing.
EVENT_CANT_REACH
const EVENT_CANT_REACH = "cant_reach"
Used for local processing.
REQUIRED_EVENTS
const REQUIRED_EVENTS = ["init", "newgame"]
Events that MUST exist in order for Escoria to run properly.
CHANNEL_FRONT
const CHANNEL_FRONT = "_front"
The primary channel for running events.
Members
scheduled_events
var scheduled_events: Array
A list of currently scheduled events.
events_queue
var events_queue: Dictionary
A list of constantly running events, possibly in multiple background channels.
Signals
event_started
signal event_started(event_name: Variant)
Emitted when the event has begun execution.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
event_name |
|
Name of the event whose execution has started. |
yes |
background_event_started
signal background_event_started(channel_name: Variant, event_name: Variant)
Emitted when an event is started in a channel of the background queue.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
channel_name |
|
Name of the background channel where the event runs. |
yes |
event_name |
|
Name of the event that began on the background channel. |
yes |
event_finished
signal event_finished(return_code: Variant, event_name: Variant)
Emitted when the event has finished running.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
return_code |
|
Execution result returned by the event. |
yes |
event_name |
|
Name of the event that just finished. |
yes |
background_event_finished
signal background_event_finished(return_code: Variant, event_name: Variant, channel_name: Variant)
Emitted when a background event has finished.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
return_code |
|
Execution result returned by the background event. |
yes |
event_name |
|
Name of the background event that finished. |
yes |
channel_name |
|
Background channel where the event finished. |
yes |
Methods
queue_event_from_esc
func queue_event_from_esc(script_object: ESCScript, event: String, channel: String, block: bool) -> int
Queues a new event based on input from an ASHES command, most likely queue_event.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
script_object |
|
Compiled script object, i.e. the one with the event to queue. |
yes |
event |
|
Name of the event to queue. |
yes |
channel |
|
Channel to run the event on (default: |
yes |
block |
|
Whether to wait for the queue to finish. This is only possible, if the queued event is not to be run on the same event as this command (default: |
yes |
Returns
Returns a int value. (int)
queue_event
func queue_event(event: ESCGrammarStmts.Event, force: bool, as_first: Variant) -> void
Queues a new event to run in the foreground.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
event |
|
The event to run. |
yes |
force |
|
(optional) Events won’t normally queue during scene changes. This parameter overrides that behaviour. |
no |
as_first |
|
(optional) Put the event at the head of the queue. |
no |
Returns
Returns nothing.
schedule_event
func schedule_event(event: ESCGrammarStmts.Event, timeout: float, object: String) -> void
Schedules an event to run after a timeout.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
event |
|
The event to run. |
yes |
timeout |
|
Number of seconds to wait before adding the event to the front queue. |
yes |
object |
|
The target object. |
yes |
Returns
Returns nothing.
queue_background_event
func queue_background_event(channel_name: String, event: ESCGrammarStmts.Event) -> void
Queues an event to run in a background channel.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
channel_name |
|
The name of the channel to use. |
yes |
event |
|
The event to run; must be of type |
yes |
Returns
Returns nothing.
interrupt
func interrupt(exceptions: PackedStringArray, stop_walking: Variant) -> void
Interrupts the events currently running and any that are pending.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
exceptions |
|
An optional list of events which should be left running or queued. |
no |
stop_walking |
|
boolean value (default true) determining whether the player (if any) has to be interrupted walking or not. |
no |
Returns
Returns nothing.
interrupt_channel
func interrupt_channel(channel_name: String) -> void
Interrupts any events in the specified channel.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
channel_name |
|
The name of the channel containing the events to be interrupted. |
yes |
Returns
Returns nothing.
clear_event_queue
func clear_event_queue() -> void
Clears the event queues.
Parameters
None.
Returns
Returns nothing.
is_channel_free
func is_channel_free(name: String) -> bool
Checks whether a channel is free to run more events.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
name |
|
Name of the channel to inspect. |
yes |
Returns
Returns a bool value. (bool)
get_running_event
func get_running_event(name: String) -> ESCGrammarStmts.Event
Gets the currently running event in a channel. null if there is none.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
name |
|
Name of the channel whose running event should be returned. |
yes |
Returns
Returns a ESCGrammarStmts.Event value. (ESCGrammarStmts.Event)
set_changing_scene
func set_changing_scene(p_is_changing_scene: bool) -> void
Setter for _changing_scene.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
p_is_changing_scene |
|
New value indicating whether a scene transition is currently running. |
yes |
Returns
Returns nothing.
add_running_command
func add_running_command(command: ESCCommand) -> void
Adds a currently-running command to the current channel.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
command |
|
The |
yes |
Returns
Returns nothing.
running_command_finished
func running_command_finished(command: ESCCommand) -> void
Removes the specified command from the current channel.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
command |
|
The |
yes |
Returns
Returns nothing.
save_game
func save_game(p_savegame: ESCSaveGame) -> void
Save the running event in the savegame, if any.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
p_savegame |
|
|
yes |
Returns
Returns nothing.