ScriptedBehaviour

All Ravenscript’s are executed and managed by a ScriptedBehaviour component. This component is accessable in Ravenscript through self.script.

Members

Member

Description

gameObject

modSaveData

The mod save data associated with this Scriptedbehaviour.

mutator

The mutator associated with this ScriptedBehaviour.

self

Gets the script’s Lua table aka. self.

transform

Methods

Method

Description

AddDebugValueMonitor(monitorMethodName, valueLabel)

Create a value monitor that prints the current value to the screen.

AddDebugValueMonitor(monitorMethodName, valueLabel, color)

Create a value monitor that prints the current value to the screen.

AddDebugValueMonitor(monitorMethodName, valueLabel, color, monitorData)

Create a value monitor that prints the current value to the screen, with a data argument.

AddValueMonitor(monitorMethodName, onChangeMethodName)

Create a value monitor that notifies the script when a value changes.

AddValueMonitor(monitorMethodName, onChangeMethodName, monitorData)

Create a value monitor that notifies the script when a value changes, with a data argument.

RemoveValueMonitor(monitorMethodName)

Removes all value monitors using the specified monitorMethod.

StartCoroutine(coroutine)

Starts a coroutine that is executed once every frame until done.

ToString()

Static methods

Method

Description

GetScript(go)

Finds and returns the first ScriptedBehaviour on the GameObject.

Details

class ScriptedBehaviour
const GameObject gameObject
const SaveData modSaveData

The mod save data associated with this Scriptedbehaviour.

const Mutator mutator

The mutator associated with this ScriptedBehaviour. Returns nil if no mutator is associated with this script.

const DynValue self

Gets the script’s Lua table aka. self.

const Transform transform
void AddDebugValueMonitor(string monitorMethodName, string valueLabel)

Create a value monitor that prints the current value to the screen. The value is only printed to screen when the mod is run in test content mod mode.

void AddDebugValueMonitor(string monitorMethodName, string valueLabel, Color color)

Create a value monitor that prints the current value to the screen. The value is only printed to screen when the mod is run in test content mod mode.

void AddDebugValueMonitor(string monitorMethodName, string valueLabel, Color color, DynValue monitorData)

Create a value monitor that prints the current value to the screen, with a data argument. In the monitor/callback functions you can access the data value with CurrentEvent.listenerData.

void AddValueMonitor(string monitorMethodName, string onChangeMethodName)

Create a value monitor that notifies the script when a value changes. Each frame before Update() the return value of monitorMethod is evaluated and compared to the previous value. If the value has changed, the onChangeMethod is invoked with the new value as the argument.

void AddValueMonitor(string monitorMethodName, string onChangeMethodName, DynValue monitorData)

Create a value monitor that notifies the script when a value changes, with a data argument. In the monitor/callback functions you can access the data value with CurrentEvent.listenerData.

void RemoveValueMonitor(string monitorMethodName)

Removes all value monitors using the specified monitorMethod.

void StartCoroutine(DynValue coroutine)

Starts a coroutine that is executed once every frame until done. Use coroutine.yield() to pause the coroutine. See the Unity manual for details about Coroutines and their use.

Parameters:

coroutine – A closure; or the name of a member function as a string. A closure is executed without arguments while self is automatically passed to member functions.

string ToString()
static DynValue GetScript(GameObject go)

Finds and returns the first ScriptedBehaviour on the GameObject. Equivalent to GameObject.GetComponent(ScriptedBehaviour).script. Nil is return if non is found.