Lua API Reference: Difference between revisions

From Bonfire by Hogswild Prasetto
bonfire-wiki>Sonic260
Created the Lua API Page. This is still a work in progress.
 
bonfire-wiki>Sonic260
Line 3: Line 3:
== Lua Console Commands ==
== Lua Console Commands ==
This table comprises the list of Lua-related console commands to actually inject, run, or even delete scripts from the console target's inventory. These can be placed into a scroll, macro, or NPC's CustomCall action during dialogue.
This table comprises the list of Lua-related console commands to actually inject, run, or even delete scripts from the console target's inventory. These can be placed into a scroll, macro, or NPC's CustomCall action during dialogue.
{| class="MsoTableGrid"
{| class="article-table"
!
  !
!
<nowiki>  </nowiki>Command
!
 
|-
  !
|
<nowiki>  </nowiki>Usage
|
 
|
  !
|-
<nowiki>  </nowiki>Effect 
|
|
|-
|
  |
|-
<nowiki>  </nowiki>oluainj
|
 
|
  |
|
<nowiki>  </nowiki>oluainj ''luaScriptName''
 
  |
<nowiki>  </nowiki>Injects a Lua script into the target's inventory.
 
<nowiki>  </nowiki>Scripts must be saved in the below directory first:
''%appdata%/Prasetto/Bonfire/Mods/lua''   
|-
  |
<nowiki>  </nowiki>oluacf
 
  |
<nowiki>  </nowiki>oluacf ''luaScriptName,functionName''
 
  |
<nowiki>  </nowiki>Executes a single Lua function ''functionName'' within the injected script once. 
|-
  |
<nowiki>  </nowiki>oluaiifr
 
  |
<nowiki>  </nowiki>oluaiifr
 
''luaScriptName,functionName,duration''
 
  |
<nowiki>  </nowiki>Causes a single Lua function to iterate, and execute repeatedly for a set ''duration''. When the iteration will stop when the duration is exceeded.
 
<nowiki>  </nowiki>'''Tip: '''Set ''duration ''to "''Infinity''" to make the script run forever. 
|-
  |
<nowiki>  </nowiki>oluaria
 
  |
<nowiki>  </nowiki>oluaria ''luaScriptName,functionName''
 
<nowiki>  </nowiki>oluaria
 
  |
<nowiki>  </nowiki>Stops a function within a Lua script from iterating. Using '''oluaria''' with no parameters stop all iterating scripts. 
|-
  |
<nowiki>  </nowiki>oluarem
 
  |
<nowiki>  </nowiki>oluarem ''luaScriptName''
 
  |
<nowiki>  </nowiki>Removes the Lua script from your inventory. This will also stop any  related iterators. 
|}
|}
== Automatic Functions / Code ==
== Automatic Functions / Code ==
This code will execute automatically when injected into the target's inventory using the '''oluainj''' command. This removes the need to run functions manually with '''oluacf''' or '''oluaiifr'''. ''Note: ''The '''start()''' and '''update()''' functions will not run automatically if injected as an OrcLuaScript action with macros.
This code will execute automatically when injected into the target's inventory using the '''oluainj''' command. This removes the need to run functions manually with '''oluacf''' or '''oluaiifr'''. ''Note: ''The '''start()''' and '''update()''' functions will not run automatically if injected as an OrcLuaScript action with macros.

Revision as of 23:12, 11 April 2020

This page contains documentation for all the known functions within the Lua Bonfire API. For more information for running Lua code in Bonfire, please see the Lua scripting page.

Lua Console Commands

This table comprises the list of Lua-related console commands to actually inject, run, or even delete scripts from the console target's inventory. These can be placed into a scroll, macro, or NPC's CustomCall action during dialogue.

Automatic Functions / Code

This code will execute automatically when injected into the target's inventory using the oluainj command. This removes the need to run functions manually with oluacf or oluaiifr. Note: The start() and update() functions will not run automatically if injected as an OrcLuaScript action with macros.

Function Name

Return Type

Description /Usage

start

void

The start() function will execute once upon injection.

update

void

The update() function will start an iterator that runs for Infinity seconds upon injection.

[chunk space]

N/A

“Chunk Space” refers to any code lying outside of a function within a Lua file. This code will execute once upon injection AND whenever the holder enters a new scene.

This is typically used for setting variables and preemptively granting data flags.

Orc Properties

Targeting

Positioning

Physical Attributes

Flags / Booleans

Misc Properties

Orc Functions

Targeting

Sex

Data Flags

Sounds

Misc Functions

Orc.Game Properties

Orc.Game Functions

Asset Properties

Asset Functions