Skip to reading
Lua Scripting

Helper functions and proxy methods

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

REFERENCE B

Signatures below show Lua argument order. Optional defaults use Lua spelling. Pass ordinary values to synchronous helpers. Wrap asynchronous global calls in await(...). Object methods take the receiver shown before the colon.

await(EndGame(message = "", ask_first = false))

await(QuitToMenu(message = "", ask_first = false))

await(CallScript(script_id, function_name = "run", arguments = Array{}, execution_context = {}))

IncludeScript(script_id)

GetIncludedVariable(script_id, variable_name, fallback = nil)

SetIncludedVariable(script_id, variable_name, value)

await(Action(action_type, properties = {}))

await(RunVisualGraph(graph, execution_context = {}))

await(EmitEvent(event_name, event_context = {}))

GetProjectProperty(property_path, default_value = nil)

SetProjectProperty(property_path, value)

GetSetting(setting_path, default_value = nil)

SetSetting(setting_path, value)

Log(message)

Warn(message)

ScriptError(message)

PCAAssert(condition, message = "PCA3D script assertion failed.")

Breakpoint()

TryCall(callable, arguments = Array{}, fallback = nil)

DoWhile(body, condition, safety_limit = 100000)

ForEach(collection_value, callback)

WhileLoop(condition, body, safety_limit = 100000)

ForLoop(count, body)

HasInventory(item_id, character_id = "player", amount = 1)

InventoryCount(item_id, character_id = "player")

CurrentScene()

ActivePlayer()

QuestState(quest_id)

ObjectiveState(quest_id, objective_id)

Page 42 of 133Permalink
Go to page