Lua API Reference: Difference between revisions

From Bonfire by Hogswild Prasetto
bonfire-wiki>Sonic260
bonfire-wiki>Sonic260
Line 5: Line 5:
{| class="article-table"
{| class="article-table"
!
!
Command
!
!
!
Usage
!Effect
|-
|oluainj
|oluainj ''luaScriptName''
|Injects a Lua script within the console target's inventory.
Lua Scripts must be stored within the Lua directory, located at
 
''%appdata%/Prasetto/Bonfire/Mods/lua''
|-
|oluacf
|oluacf ''luaScriptName,functionName''
|Executes a single function within an injected Lua script once
|-
|-
|
|oluaiifr
|
|oluaiifr ''luaScriptName,functionName,duration''
|
|Causes a single Lua function to iterate, and execute repeatedly for a set ''duration''. When the duration, the iteration will stop.
'''Tip''': Set ''duration ''to "Infinity" will make the script run forever.
|-
|-
|
|oluaria
|
|oluaria ''luaScriptName,functionName''
|
 
oluaria
|Stops an iterating function within a Lua script. Using '''oluaria''' with no parameters will stop ''all ''iterating scripts within the console target.
|-
|-
|
|oluarem
|
|oluarem ''luaScriptName''
|
|Removes the Lua script from the target's inventory. This will also stop any related iterators.
|}
|}
== Automatic Functions / Code ==
== Automatic Functions / Code ==
Line 25: Line 41:
   
   
   !
   !
<nowiki>  </nowiki>Function Name
<nowiki>  </nowiki>'''Function Name'''
    
    
   !
   !
<nowiki>  </nowiki>Return Type
<nowiki>  </nowiki>'''Return Type'''
    
    
   !
   !
<nowiki>  </nowiki>Description /Usage   
<nowiki>  </nowiki>'''Description /Usage'''  
   
   
  |-
  |-
Line 51: Line 67:
    
    
   |
   |
<nowiki>  </nowiki>The update() function will start an iterator that runs for ''Infinity'' seconds upon injection.   
<nowiki>  </nowiki>The update() function will start an iterator that runs for ''Infinity''
<nowiki>  </nowiki>seconds upon injection.   
   
   
  |-
  |-
Line 61: Line 78:
    
    
   |
   |
<nowiki>  </nowiki>“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.  
<nowiki>  </nowiki>“Chunk Space” refers to any code lying outside of a function within a
<nowiki> </nowiki> Lua file. This code will execute once upon injection AND whenever the holder
<nowiki> </nowiki> enters a new scene.  


<nowiki>  </nowiki>This is typically used for setting variables and preemptively granting data flags.   
<nowiki>  </nowiki>This is typically used for setting variables and preemptively
<nowiki> </nowiki> granting data flags.   
   
   
|}
|}
== Orc Properties ==
== Orc Properties ==



Revision as of 23:24, 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.

Command

Usage

Effect
oluainj oluainj luaScriptName Injects a Lua script within the console target's inventory.

Lua Scripts must be stored within the Lua directory, located at

%appdata%/Prasetto/Bonfire/Mods/lua

oluacf oluacf luaScriptName,functionName Executes a single function within an injected Lua script once
oluaiifr oluaiifr luaScriptName,functionName,duration Causes a single Lua function to iterate, and execute repeatedly for a set duration. When the duration, the iteration will stop.

Tip: Set duration to "Infinity" will make the script run forever.

oluaria oluaria luaScriptName,functionName

oluaria

Stops an iterating function within a Lua script. Using oluaria with no parameters will stop all iterating scripts within the console target.
oluarem oluarem luaScriptName Removes the Lua script from the target's inventory. This will also stop any related iterators.

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