Lua API Reference: Difference between revisions

From Bonfire by Hogswild Prasetto
bonfire-wiki>Sonic260
bonfire-wiki>Sonic260
Adds all Orc Properties
Line 39: Line 39:
== 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.
{| class="MsoTableGrid"
{| class="wikitable"
! Function Name
  !
! Return Type
<nowiki>  </nowiki>'''Function Name'''
! Description /Usage
 
|-
  !
| start
<nowiki>  </nowiki>'''Return Type'''
| void
 
| The start() function will execute once upon injection.
  !
|-
<nowiki>  </nowiki>'''Description /Usage''' 
| update
| void
|-
| The update() function will start an iterator that runs for Infinity seconds upon injection.
  |
|-
<nowiki>  </nowiki>start
| [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.
<nowiki>  </nowiki>void
This is typically used for setting variables and preemptively granting data flags.
 
|}
  |
<nowiki>  </nowiki>The start() function will execute once upon injection.
|-
  |
<nowiki>  </nowiki>update
 
  |
<nowiki>  </nowiki>void
 
  |
<nowiki>  </nowiki>The update() function will start an iterator that runs for ''Infinity''
<nowiki>  </nowiki>seconds upon injection.
|-
  |
<nowiki>  </nowiki>[chunk space]
 
  |
<nowiki>  </nowiki>N/A
 
  |
<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
<nowiki> </nowiki> granting data flags. 
|}
== Orc Properties ==
== Orc Properties ==
 
These are properties--or variables--belonging to an Orc instance, and are accessible by writing '''orc.*''' before every call. In all cases "'''orc'''" will always refer to the instance who is running the script from within their inventory. For example: "'''orc'''.istheplayer" returns "true" if this orc is the player, and "'''orc'''.height = 1.5" sets this orc's height to 1.5.<nowiki/>
===<nowiki/>===


=== Targeting ===
=== Targeting ===
{| class="wikitable"
! Property Name
! Type
! Description / Usage
|-
| orcobjective
| Orc
|Returns this instance’s current “target” as another Orc instance. Functions and properties can be manipulated on the other instance by calling '''orc.orcobjective.'''* before every command:
* orc.'''orcobjective'''.istheplayer – Returns true if this objective is the player
* orc.'''orcobjective'''.height = 1.5 – sets the objective’s height to 1.5
It is also possible to store the objective in a separate variable for use later:
* local target = orc.'''orcobjective'''
* target.istheplayer
* target.height = 1.5
'''Warning: '''An instance’s objective changes frequently, so it is recommended that you store the objective in a separate variable as soon as possible for reference. The objective can also return ‘'''nil'''’, so it is recommended that you first perform a nil check before attempting to call a function or property on them..
|-
| canseeorcobjective
| bool
| Returns true if the objective (this instance’s current “target”) is with line of sight
|-
| canseeinterest
| bool
|An “interest” is like a lighter version of “objective." It refers to the orc our instance is looking at, but not necessarily targeting.
|-
| istheplayer
| bool
| Returns true if instance is the player.
|-
| distancetoobjective
| float
| Returns the distance to the objective.
|}


=== Positioning ===
=== Positioning ===
{| class="wikitable"
! Property Name
! Type
! Description / Usage
|-
| positionx
positiony
positionz
| float
| The instance’s current x, y, or z position in the world.
|}


=== Physical Attributes ===
=== Physical Attributes ===
{| class="wikitable"
! Property Name
! Type
! Description / Usage
|-
| ballsize
| float
| Max is 2.0
|-
| beardlength
| float
|
|-
| beardstubble
| float
|
|-
| bodyfat
| float
|
|-
| bodyhair
| float
|
|-
| coatdensity
| float
|
|-
| earshape
| float
|
|-
| earsize
| float
|
|-
| extrabutt
| float
|
|-
| footsize
| float
|
|-
| haircolor1_[r,g,b]
| float
| Hair Color A in the character editor
|-
| haircolor2_[r,g,b]
| float
| Hair Color B in the character editor
|-
| hairlength
| float
|
|-
| handgirth
| float
|
|-
| headcrown
| float
|
|-
| height
| float
| Max is 1.5, but clamps to 1.0 during stage 1 of corruption.
|-
| jawsize
| float
|
|-
| lipgirth
| float
|
|-
| muscle
| float
|
|-
| penisextra
| float
|
|-
| penisgirth
| float
| Max is 4.0, but clamps to 2.0 during corruption
|-
| penisshower
| float
|
|-
| penissize
| float
|
|-
| skincolormid_[r,g,b,m]
| float
| Skin Color – Upper Layer
|-
| skincolortop_[r,g,b,m]
| float
| Skin Color – Sun Bleach
|-
| skincolorund_[r,g,b,m]
| float
| Skin Color – Lower Layer
|-
| tusksize
| float
|
|}


=== Flags / Booleans ===
=== Flags / Booleans ===
{| class="wikitable"
! Property Name
! Type
! Description / Usage
|-
| afterglowing
| bool
| Returns true if the instance is afterglowing right after orgasming during a sex scene
|-
| busywalking
| bool
| Returns true if the instance is currently walking to a destination
|-
| cumming
| bool
| Returns true if, during a sex scene, the instance is orgasming
|-
| immutable
| bool
| Returns true if this instance is either a ghost or special character that cannot be altered by transformation spells nor corruption
|-
| isairborne
| bool
| Returns true if the instance is floating in mid air
|-
| isbusy
| bool
| Returns true if the instance is doing literally anything else besides standing
|-
| isfapping
| bool
| Returns true if the instance is doing a standing fap. (Does not apply to Self-Action, or solo fapping on the Inn or Island Beds)
|-
| isgeniefragment
| bool
| Returns true if this instance is an NPC genie fragment (ie: Eves, Levi; not a geniefied orc)
|-
| isghost
| bool
| Returns true if the instance is a ghost
|-
| issexing
| bool
| Returns true if the instance is in a sex animation (This includes Self-Action, and Handjobs in the Bath House)
|-
| istalking
| bool
| Returns true if the instance is in a dialogue
|-
| onatask
| bool
| Returns true if the instance is busy doing some task like casting a spell or sexing
|-
| perfectglowing
| bool
| Returns true if the instance has achieved a perfect synchronized orgasm during a sex scene
|}


=== Misc Properties ===
=== Misc Properties ===
{| class="wikitable"
! Property Name
! Type
! Description / Usage
|-
| arousal
| float
| Returns the instance’s current arousal level.
The value range is 0.0 – 1.0
|-
| corruption
| float
| Returns the instances level of corruption.
The value range is 0.0 – 3.0, where 1.0 is the cap before becoming a genie
|-
| infinity
| float
| Returns a floating number representing infinity.
|-
| orcname
| string
| The instance’s name
|-
| mana
| float
| Returns the instance’s current mana amount
|-
| maxmana
| float
| Returns the instance’s total mana pool.
'''Note: '''this is a read-only property.
|-
| manareg
| float
| Returns the instance’s current mana regeneration rate
'''Note:''' this is a read-only property.
|}


== Orc Functions ==
== Orc Functions ==

Revision as of 01:39, 12 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

These are properties--or variables--belonging to an Orc instance, and are accessible by writing orc.* before every call. In all cases "orc" will always refer to the instance who is running the script from within their inventory. For example: "orc.istheplayer" returns "true" if this orc is the player, and "orc.height = 1.5" sets this orc's height to 1.5.

Targeting

Property Name Type Description / Usage
orcobjective Orc Returns this instance’s current “target” as another Orc instance. Functions and properties can be manipulated on the other instance by calling orc.orcobjective.* before every command:
  • orc.orcobjective.istheplayer – Returns true if this objective is the player
  • orc.orcobjective.height = 1.5 – sets the objective’s height to 1.5

It is also possible to store the objective in a separate variable for use later:

  • local target = orc.orcobjective
  • target.istheplayer
  • target.height = 1.5

Warning: An instance’s objective changes frequently, so it is recommended that you store the objective in a separate variable as soon as possible for reference. The objective can also return ‘nil’, so it is recommended that you first perform a nil check before attempting to call a function or property on them..

canseeorcobjective bool Returns true if the objective (this instance’s current “target”) is with line of sight
canseeinterest bool An “interest” is like a lighter version of “objective." It refers to the orc our instance is looking at, but not necessarily targeting.
istheplayer bool Returns true if instance is the player.
distancetoobjective float Returns the distance to the objective.

Positioning

Property Name Type Description / Usage
positionx

positiony

positionz

float The instance’s current x, y, or z position in the world.

Physical Attributes

Property Name Type Description / Usage
ballsize float Max is 2.0
beardlength float
beardstubble float
bodyfat float
bodyhair float
coatdensity float
earshape float
earsize float
extrabutt float
footsize float
haircolor1_[r,g,b] float Hair Color A in the character editor
haircolor2_[r,g,b] float Hair Color B in the character editor
hairlength float
handgirth float
headcrown float
height float Max is 1.5, but clamps to 1.0 during stage 1 of corruption.
jawsize float
lipgirth float
muscle float
penisextra float
penisgirth float Max is 4.0, but clamps to 2.0 during corruption
penisshower float
penissize float
skincolormid_[r,g,b,m] float Skin Color – Upper Layer
skincolortop_[r,g,b,m] float Skin Color – Sun Bleach
skincolorund_[r,g,b,m] float Skin Color – Lower Layer
tusksize float

Flags / Booleans

Property Name Type Description / Usage
afterglowing bool Returns true if the instance is afterglowing right after orgasming during a sex scene
busywalking bool Returns true if the instance is currently walking to a destination
cumming bool Returns true if, during a sex scene, the instance is orgasming
immutable bool Returns true if this instance is either a ghost or special character that cannot be altered by transformation spells nor corruption
isairborne bool Returns true if the instance is floating in mid air
isbusy bool Returns true if the instance is doing literally anything else besides standing
isfapping bool Returns true if the instance is doing a standing fap. (Does not apply to Self-Action, or solo fapping on the Inn or Island Beds)
isgeniefragment bool Returns true if this instance is an NPC genie fragment (ie: Eves, Levi; not a geniefied orc)
isghost bool Returns true if the instance is a ghost
issexing bool Returns true if the instance is in a sex animation (This includes Self-Action, and Handjobs in the Bath House)
istalking bool Returns true if the instance is in a dialogue
onatask bool Returns true if the instance is busy doing some task like casting a spell or sexing
perfectglowing bool Returns true if the instance has achieved a perfect synchronized orgasm during a sex scene

Misc Properties

Property Name Type Description / Usage
arousal float Returns the instance’s current arousal level.

The value range is 0.0 – 1.0

corruption float Returns the instances level of corruption.

The value range is 0.0 – 3.0, where 1.0 is the cap before becoming a genie

infinity float Returns a floating number representing infinity.
orcname string The instance’s name
mana float Returns the instance’s current mana amount
maxmana float Returns the instance’s total mana pool.

Note: this is a read-only property.

manareg float Returns the instance’s current mana regeneration rate

Note: this is a read-only property.

Orc Functions

Targeting

Sex

Data Flags

Sounds

Misc Functions

Orc.Game Properties

Orc.Game Functions

Asset Properties

Asset Functions