ScriptedBehaviour¶
All Ravenscript’s are executed and managed by a ScriptedBehaviour component. This component is accessable in Ravenscript through self.script
.
Members¶
Member |
Description |
---|---|
The mod save data associated with this Scriptedbehaviour. |
|
The mutator associated with this ScriptedBehaviour. |
|
Gets the script’s Lua table aka. |
|
Methods¶
Method |
Description |
---|---|
Create a value monitor that prints the current value to the screen. |
|
Create a value monitor that prints the current value to the screen. |
|
|
Create a value monitor that prints the current value to the screen, with a data argument. |
Create a value monitor that notifies the script when a value changes. |
|
|
Create a value monitor that notifies the script when a value changes, with a data argument. |
Removes all value monitors using the specified |
|
Starts a coroutine that is executed once every frame until done. |
|
Static methods¶
Method |
Description |
---|---|
Finds and returns the first ScriptedBehaviour on the GameObject. |
Details¶
-
class
ScriptedBehaviour
¶ -
const GameObject
gameObject
¶
-
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
.
-
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, theonChangeMethod
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.
-
const GameObject