ESCGrammarStmts.Event

Extends: ESCGrammarStmt

Description

Represents an Escoria event, e.g. :look. An event can also be given a “target” to act on, e.g. :use "wrench".

Constants

FLAG_TK

const FLAG_TK = 1 # enum

FLAG_NO_TT

const FLAG_NO_TT = 2 # enum

FLAG_NO_UI

const FLAG_NO_UI = 4 # enum

FLAG_NO_SAVE

const FLAG_NO_SAVE = 8 # enum

Members

source

var source: String

Signals

finished

signal finished()

Signal fired when the event has finished.

Parameters

None.

interrupted

signal interrupted()

Signal fired if the event has been interrupted.

Parameters

None.

Methods


init

func init(name: ESCToken, target: ESCGrammarExprs.Literal, flags: Dictionary, body: ESCGrammarStmts.Block, object_global_id: String) -> void

Initialization method. Must be called after instantiation.

Parameters

Name

Type

Description

Required?

name

ESCToken

Token representing the event name.

yes

target

ESCGrammarExprs.Literal

a literal representing the global ID of an object the event is meant to act on; can be null.

yes

flags

Dictionary

an array containing event flags to be applied; can be null/empty.

yes

body

ESCGrammarStmts.Block

the body of the event; this is the script block that will be executed when the event is run.

yes

object_global_id

String

the object/room the event is attached to, if any (may be empty)

yes

Returns

Returns nothing.


get_name

func get_name() -> ESCToken

The event’s name (as an ESCToken).

Parameters

None.

Returns

Returns the event’s name (as an ESCToken). (ESCToken)


get_target

func get_target() -> ESCGrammarExprs.Literal

The target as a literal.

Parameters

None.

Returns

Returns the target as a literal. (ESCGrammarExprs.Literal)


get_target_name

func get_target_name() -> String

A string containing the name of the target, if it exists.

Parameters

None.

Returns

Returns a string containing the name of the target, if it exists. (String)


get_event_name

func get_event_name() -> String

The name of the event as a string.

Parameters

None.

Returns

Returns the name of the event as a string. (String)


get_flags

func get_flags() -> int

The flags set for this event. Note that this is an integer that serves as a collection of mutually exclusive bits.

Parameters

None.

Returns

Returns the flags set for this event. Note that this is an integer that serves as a collection of mutually exclusive bits. (int)


get_flags_with_conditions

func get_flags_with_conditions() -> Dictionary

add_flag

func add_flag(flag: int) -> void

get_body

func get_body() -> ESCGrammarStmts.Block

The body of the event. This is the script block that will be executed when the event is run.

Parameters

None.

Returns

Returns the body of the event. This is the script block that will be executed when the event is run. (ESCGrammarStmts.Block)


get_object_global_id

func get_object_global_id() -> String

get_num_statements_in_block

func get_num_statements_in_block() -> int

The number of top-level statements in the body. Generally only useful for internal purposes.

Parameters

None.

Returns

Returns the number of top-level statements in the body. Generally only useful for internal purposes. (int)


get_running_command

func get_running_command() -> Variant

The command currently being executed in this event.

Parameters

None.

Returns

Returns the command currently being executed in this event. (Variant)


set_running_command

func set_running_command(cmd: Variant) -> void

Sets the command that is currently being executed in this event.

Parameters

Name

Type

Description

Required?

cmd

Variant

Command currently being executed for this event.

yes

Returns

Returns nothing.


clear_running_command

func clear_running_command() -> void

Clears the currently-running command.

Parameters

None.

Returns

Returns nothing.


interrupt

func interrupt() -> void

Forces the event to be interrupted.

Parameters

None.

Returns

Returns nothing.


is_interrupted

func is_interrupted() -> bool

True iff the event has been interrupted.

Parameters

None.

Returns

Returns true iff the event has been interrupted. (bool)


reset_interrupt

func reset_interrupt() -> void

Resets the “is interrupted” flag.

Parameters

None.

Returns

Returns nothing.


emit_finished

func emit_finished(rc: int) -> void

Emits the finished signal along with the indicated return code (rc).

Parameters

Name

Type

Description

Required?

rc

int

Return code emitted when the statement signals completion.

yes

Returns

Returns nothing.


accept

func accept(visitor: Variant) -> Variant

Method to invoke visitor-specific code.

Parameters

Name

Type

Description

Required?

visitor

Variant

Visitor instance invoked to process this statement.

yes

Returns

Returns nothing.