VoidExpanse/scope-actions

From AtomicTorchWiki


Config actions

Used to work with events, such as triggers and events. More info about events in VoidExpanse/events.

Visibility: Global.

List of functions

Bind
Arguments Returns Example
  • string: event_name
  • string: function_name

bool - returns whether function was hooked to event, or not (due to some errors)

actions.Bind("OnShipDestroyed", "OnShipDestroyedHandler");
Description

Binds script's function to some in-game event. This function will be called every time event occurs, for example, if function was bound to "OnShipDestroyed" event, it'll be called every time any ship is destroyed. Note: you can bind not only to standard events, but also to events you've created. To know, how to create your own event, look into Create & Start functions of actions scope.


BindToTrigger
Arguments Returns Example
  • string: trigger_name
  • string: function_name
  • object: parameters

void

topic.Bind("onNpcDie", "OnHiveKilled",
{ 
     tags_class: "alien_hive",
     killer_ship_id: topic.GetCurrentShipId()
});
Description
{{{5}}}


Clear
Arguments Returns Example
  • string: event_name

void

actions.Clear("OnNpcDie");
Description

Removes all subscriptions to specified event. Also includes subscriptions made from another scripts.


Create
Arguments Returns Example
  • string: event_name

void

actions.Create("MyEvent");
Description

Creates custom event, to which other scripts can bind their functions. Later can be invoked using function Start (see below)


InvokeTrigger
Arguments Returns Example
  • string: trigger_name
  • object: args

void

actions.InvokeTrigger("onSystemLiberated", {system_id: sys_id});
Description

Invokes trigger with parameters. As trigger name you can use any string you like, if no one was subscribed to this trigger - it'll simply be ignored. The same goes to parameters.


Remove
Arguments Returns Example
  • string: event_name

void

actions.Remove("MyEvent");
Description

Removes custom event, that was created with actions.Create method.


Start
Arguments Returns Example
  • string: event_name
  • object: args

void

actions.Start("MyEvent", {my_name: "dlirry"})
Description

Invokes event with specified parameters, that'll force all subscribed functions to be called.


UnbindFromTrigger
Arguments Returns Example
  • string: trigger_name
  • string: function_name

void

actions.UnbindFromTrigger("myTrigger", "MyTriggerHandler")
Description

Unbinds specified function from trigger.


UnbindFromTriggers
Arguments Returns Example

void

void

actions.UnbindFromTriggers();
Description

Unbinds all script's function from triggers. Useful, when you want to destroy script or do not want to use it anymore, and you want to quickly get rid of all script's trigger dependencies and subscriptions.