TVisObj

Methods

isEmpty()
isAnyObject()
getId()
getParent()
getObject(path, logWarning)
getName()
setName(name)
setValue(field, value)
clearLink(field)
setTextStr(field)
getInt(field)
getFloat(field)
getBool(field)
getStr(field)
getPath(field)
getSprite(field)
getRect(field)
getPoint(field)
getLink(field)
getLinks(field)
debug()
getPoints(field)
getRects(field)
getSprites(field)
getPaths(field)
getInts(field)
getFloats(field)
getTexts(field)
getTextStr(field, language)
to(time, values, easing, repeat, reverse)
duplicate(name)
create(field, name)
remove()
info()
__eq()
__tostring()

Fields

id readonly int
tableId readonly int
name readonly string
parent readonly TVisObj

isEmpty()

Return Type Description
bool

isAnyObject()

Return Type Description
bool

getId()

Return Type Description
table {id = id, tableId = tableId}

Details and examples

Returns a table containing the internal id of the VisionaireObject and the id of the table it belongs to.

Parameters

none

Return values
Type/Structure Description
table id (int) Internal id of the VisionaireObject
tableId (int) Id of the table the VisionaireObject belongs to
Examples

Example 1: Check if an animation belongs to a character or not.

function checkAnimOwner(anim)
  anim = getObject("Animations[" .. anim .. "]")

  if anim:getParent():getId().tableId == eOutfits then
    print("The animation with id=" .. anim:getId().id .. " is a character animation.")
  else
    print("The animation with id=" .. anim:getId().id .. " is not a character animation.")
  end
end

checkAnimOwner("welding_anim")

-- The shorthand notation offers a more convenient way to achieve the same
function checkAnimOwner(anim)
  anim = Animations[anim]

  if anim.parent.tableId == eOutfits then
    print("The animation with id=" .. anim.id .. " is a character animation")
  else
    print("The animation with id=" .. anim.id .. " is not a character animation")
  end
end

checkAnimOwner("welding_anim")

getParent()

Return Type Description
TVisObj

Details and examples

Returns the parent object of the VisionaireObject.

Parameters

none

Return values
Type Description
TVisObj The parent object of the VisionaireObject.
Examples

Example 1: Check if an animation belongs to a character or not.

function checkAnimOwner(anim)
  anim = getObject("Animations[" .. anim .. "]")

  if anim:getParent():getId().tableId == eOutfits then
    print("The animation with id=" .. anim:getId().id .. " is a character animation.")
  else
    print("The animation with id=" .. anim:getId().id .. " is not a character animation.")
  end
end

checkAnimOwner("welding_anim")

-- The shorthand notation offers a more convenient way to achieve the same
function checkAnimOwner(anim)
  anim = Animations[anim]

  if anim.parent.tableId == eOutfits then
    print("The animation with id=" .. anim.id .. " is a character animation")
  else
    print("The animation with id=" .. anim.id .. " is not a character animation")
  end
end

checkAnimOwner("welding_anim")

getObject(path, logWarning)

Parameter Type Description
path string
logWarning bool
Return Type Description
TVisObj

getName()

Return Type Description
string

Details and examples

Returns the internal name of the VisionaireObject.

Not to be confused with the "Name" property which is available for some objects and contains the multi-language object name used in the game.

Related functions setName
Parameters

none

Return values
Type Description
string The internal name of the VisionaireObject
Examples

Example 1: Get the internal name of the current scene.

local cur_scene_name = game:getLink(VGameCurrentScene):getName()

-- The shorthand notation offers a more convenient way to achieve the same
local cur_scene_name = game.CurrentScene.name

setName(name)

Parameter Type Description
name string

Details and examples

Sets the internal name of the VisionaireObject.

Related functions getName
Parameters
Parameter Type Description
name string The new internal name of the VisionaireObject
Return values

none

Examples

Example 1: Set the internal name of the current scene.

game:getLink(VGameCurrentScene):setName()

-- There is no shorthand method for setting the name
game.CurrentScene:setName()

setValue(field, value)

Parameter Type Description
field int
value variant
Parameter Type Description
field int

Removes a link from the VisionaireObject.

Parameter Type Description
field integer The object field to be cleared; has to be of "t_link" type.

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

none

Example 1: Clear the link to the currently used item (will remove a dragged item from the cursor).

-- Specify the field constant name or the field id
game:clearLink(VGameUsedItem)
game:clearLink(686)

-- Setting an empty object leads to the same result
game:setValue(VGameUsedItem, emptyObject)

-- The shorthand notation offers a more convenient way to achieve the same
game.UsedItem = emptyObject

setTextStr(field)

Parameter Type Description
field int
Return Type Description
string

getInt(field)

Parameter Type Description
field int
Return Type Description
int

Details and examples

Returns the integer value of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies an integer value. The field type must be "t_int".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type Description
integer The integer value of the field.
Examples

Example 1: Get the value of a value object.

-- Specify the field constant name or the field id
local num_coins = getObject("Values[coins]"):getInt(VValueInt)
local num_coins = getObject("Values[coins]"):getInt(328)

-- The shorthand notation offers a more convenient way to achieve the same
local num_coins = Values["coins"].Int

getFloat(field)

Parameter Type Description
field int
Return Type Description
float

Details and examples

Returns the decimal value of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a decimal value. The field type must be "t_float".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type Description
decimal The decimal value of the field.
Examples

Example 1: Get the current size of a character.

-- Specify the field constant name or the field id
local char_size = getObject("Characters[hero]"):getFloat(VCharacterSize)
local char_size = getObject("Characters[hero]"):getFloat(749)

-- The shorthand notation offers a more convenient way to achieve the same
local char_size = Characters["hero"].Size

getBool(field)

Parameter Type Description
field int
Return Type Description
bool

Details and examples

Returns the boolean value of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a boolean value. The field type must be "t_bool".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type Description
boolean The boolean value of the field.
Examples

Example 1: Get the boolean value of a condition.

-- Specify the field constant name or the field id
local door_state = getObject("Conditions[door_closed]"):getBool(VConditionValue)
local door_state = getObject("Conditions[door_closed]"):getBool(194)

-- The shorthand notation offers a more convenient way to achieve the same
local door_state = Conditions["door_closed"].Value

getStr(field)

Parameter Type Description
field int
Return Type Description
string

Details and examples

Returns the string value of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a string value. The field type must be "t_string".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type Description
string The string value of the field.
Examples

Example 1: Get the version number of the game (as defined in the game info).

-- Specify the field constant name or the field id
local ver = game:getStr(VGameVersion)
local ver = game:getStr(627)

-- The shorthand notation offers a more convenient way to achieve the same
local ver = game.Version

getPath(field)

Parameter Type Description
field int
Return Type Description
string

Details and examples

Returns the path to a media file, linked in a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a path. The field type must be "t_path".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type Description
string The file path stored in the field. The path will be returned in unix format ("/" for directories) and relative to the .ved file.
Examples

Example 1: Get the file path to a scene's background music.

-- Specify the field constant name or the field id
local bg_file = getObject("Scenes[kitchen]"):getPath(VSceneBackgroundMusic)
local bg_file = getObject("Scenes[kitchen]"):getPath(132)

-- The shorthand notation offers a more convenient way to achieve the same
local bg_file = Scenes["kitchen"].BackgroundMusic

getSprite(field)

Parameter Type Description
field int
Return Type Description
TSprite

Details and examples

Returns the sprite values of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a sprite. The field type must be "t_sprite".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type/Structure Description
table path (str) relative path to the image file stored in the field
position (t_point) sprite offset stored in the field, in case sprite is used in an animation
transparency (int)
transpcolor (int) transparent color
pause (int) pause value of the rectangle stored in the field (in milliseconds), in case the sprite is used in an animation
Examples

Example 1: Get the background sprite of an interface.

-- Specify the field constant name or the field id
local inv_bg = getObject("Interfaces[inventory]"):getSprite(VInterfaceSprite)
local inv_bg = getObject("Interfaces[inventory]"):getSprite(238)

-- The shorthand notation offers a more convenient way to achieve the same
local inv_bg = Interfaces["inventory"].Sprite

getRect(field)

Parameter Type Description
field int
Return Type Description
rect

Details and examples

Returns the rectangle values of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a rectangle. The field type must be "t_rect".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type/Structure Description
table x (int) x coordinate of the top left corner of the rectangle stored in the field
y (int) y coordinate of the top left corner of the rectangle stored in the field
width (int) width of the rectangle stored in the field
height (int) height of the rectangle stored in the field
Examples

Example 1: Get the rectangle where the action text is displayed.

-- Specify the field constant name or the field id
local actxt_rect = game:getRect(VGameActionTextRect)
local actxt_rect = game:getRect(590)

-- The shorthand notation offers a more convenient way to achieve the same
local actxt_rect = game.ActionTextRect

getPoint(field)

Parameter Type Description
field int
Return Type Description
point

Details and examples

Returns the point values of a VisionaireObject field.

Parameters
Parameter Type Description
field integer The field which specifies a point. The field type must be "t_point".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Return values
Type/Structure Description
table x (int) x coordinate of the point stored in the field
y (int) y coordinate of the point stored in the field
Examples

Example 1: Get the position of a currently running animation.

-- Specify the field constant name or the field id
local anim_pos = getObject("ActiveAnimations[cat]"):getPoint(VAnimationCurrentPosition)
local anim_pos = getObject("ActiveAnimations[cat]"):getPoint(496)

-- The shorthand notation offers a more convenient way to achieve the same
local anim_pos = ActiveAnimations["cat"].CurrentPosition
Parameter Type Description
field int
Return Type Description
TVisObj

Returns the VisionaireObject which is linked in a VisionaireObject field.

Parameter Type Description
field integer The field which specifies a VisionaireObject link. The field type must be "t_link".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Type Description
TVisObj The VisionaireObject linked in the field or an empty object if no object is linked

Example 1: Get the currently playable character.

-- Specify the field constant name or the field id
local curr_char = game:getLink(VGameCurrentCharacter)
local curr_char = game:getLink(468)

-- The shorthand notation offers a more convenient way to achieve the same
local curr_char = game.CurrentCharacter
Parameter Type Description
field int
Return Type Description
table TVisObjs

Returns a table containing multiple VisionaireObjects.

Parameter Type Description
field integer The field which specifies a list of VisionaireObject links. The field type must be "t_links".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.

Type Description
table The table of VisionaireObjects (t_link values) linked in the field

Example 1: Print the names of all game languages to the log.

-- Specify the field constant name or the field id
local lang = game:getLinks(VGameLanguages)
local lang = game:getLinks(259)

-- Iterate the table and print the language ids and names
for i = 1, #lang do
  print(lang[i]:getId().id .. ": " .. lang[i]:getName())
end

-- The shorthand notation offers a more convenient way to achieve the same
local lang = game.Languages

for i = 1, #lang do
  print(lang[i].id .. ": " .. lang[i].name)
end

debug()

getPoints(field)

Parameter Type Description
field int
Return Type Description
table points

Details and examples

Returns a table containing multiple point values (tables containing the elements x and y).

Parameters
Parameter Type Description
field integer The field which specifies a list of point values. The field type must be "t_vpoint".

Specify the field constant name (V + object table name in singular + field name) or the field id.

Return values
Type Description
table The table of t_point values linked in the field
Examples

Example 1: Get the points of a scene object area polygon.

-- Specify the field constant name or the field id
local poly_pnts = getObject("Scene[kitchen].SceneObjects[door]"):getPoints(VObjectPolygon)
local poly_pnts = getObject("Scene[kitchen].SceneObjects[door]"):getPoints(341)

-- The shorthand notation offers a more convenient way to achieve the same
local poly_pnts = Scene["kitchen"].Objects["door"].Polygon

getRects(field)

Parameter Type Description
field int
Return Type Description
table rects

Details and examples

Returns a table containing multiple rectangle values (tables containing the elements x, y, width, height).

Parameters
Parameter Type Description
field integer The field which specifies a list of rectangle values. The field type must be "t_vrect".

Specify the field constant name (V + object table name in singular + field name) or the field id.

Return values
Type Description
table The table of t_rect values linked in the field
Examples

Example 1: Get the savegame areas of a menu scene.

-- Specify the field constant name or the field id
local save_rects = getObject("Scenes[savemenu]"):getRects(VSceneSavegameAreas)
local save_rects = getObject("Scenes[savemenu]"):getRects(322)

-- The shorthand notation offers a more convenient way to achieve the same
local save_rects = Scenes["savemenu"].SavegameAreas

getSprites(field)

Parameter Type Description
field int
Return Type Description
table sprites

Details and examples

Returns a table containing multiple sprite values (tables containing the elements path, position, transparency, transpcolor and pause).

Parameters
Parameter Type Description
field integer The field which specifies a list of sprite values. The field type must be "t_vsprite".

Specify the field constant name (V + object table name in singular + field name) or the field id.

Return values
Type Description
table The table of t_sprite values linked in the field
Examples

Example 1: Get all sprites of an animation.

-- Specify the field constant name or the field id
local anim_sprts = getObject("Animations[waterfall]"):getSprites(VAnimationSprites)
local anim_sprts = getObject("Animations[waterfall]"):getSprites(235)

-- The shorthand notation offers a more convenient way to achieve the same
local anim_sprts = Animations["waterfall"].Sprites

getPaths(field)

Parameter Type Description
field int
Return Type Description
table paths

Details and examples

Returns a table containing multiple paths to media files.

Parameters
Parameter Type Description
field integer The field which specifies a list of path values. The field type must be "t_vpath".

Specify the field constant name (V + object table name in singular + field name) or the field id.

Return values
Type Description
table The table of t_path values linked in the field. The paths will be returned in unix format ("/" for directories) and relative to the .ved file.
Examples

Example 1: Get the file paths of the textures of a 3D character model.

-- Specify the field constant name or the field id
local txtr_tbl = getObject("Characters[hero].CharacterOutfits[Normal]"):getPaths(VOutfitModelTextures)
local txtr_tbl = getObject("Characters[hero].CharacterOutfits[Normal]"):getPaths(728)

-- The shorthand notation offers a more convenient way to achieve the same
local txtr_tbl = Characters["hero"].Outfits["Normal"].ModelTextures

getInts(field)

Parameter Type Description
field int
Return Type Description
table ints

Details and examples

Returns a table containing multiple integer values.

Parameters
Parameter Type Description
field integer The field which specifies a list of integer values. The field type must be "t_vint".

Specify the field constant name (V + object table name in singular + field name) or the field id.

Return values
Type Description
table The table of t_int values linked in the field

getFloats(field)

Parameter Type Description
field int
Return Type Description
table floats

Details and examples

Returns a table containing multiple float (decimal) values.

Parameters
Parameter Type Description
field integer The field which specifies a list of decimal values. The field type must be "t_vfloat".

Specify the field constant name (V + object table name in singular + field name) or the field id.

Return values
Type Description
table The table of t_float values linked in the field

getTexts(field)

Parameter Type Description
field int
Return Type Description
table texts

getTextStr(field, language)

Parameter Type Description
field int
language TVisObj default GameStandardLanguage
Return Type Description
string text

to(time, values, easing, repeat, reverse)

game:to(3000, { ScrollPosition = {x = 100, y = 0} }, easeBackInOut)
game.CurrentScene:to(delay, {Brightness = 0}, easeLinearInOut)

-> Tweening

Parameter Type Description
time int
values table
easing int
repeat bool
reverse bool

duplicate(name)

local obj = game.CurrentScene.Objects.Object0:duplicate("duplObj")
obj.Offset = {x=100, y=100}
obj = game.CurrentScene.Objects.duplObj

obj = game.CurrentScene:create(VSceneObjects, "temp0")
obj:create(VObjectSprite, "obj")

obj:remove()

Parameter Type Description
name string
Return Type Description
TVisObj

create(field, name)

Parameter Type Description
field int
name string
Return Type Description
TVisObj

remove()

info()

get all values as a table

__eq()

if a == b then
else
end

compare visobjs

__tostring()

Used In:

Commands.startAction
Commands.startAction
Commands.stopAction
Commands.startAnimation
Commands.startAnimation
Commands.stopAnimation
Commands.startObjectTween
Commands.getObject
TVisObj.getParent
TVisObj.getObject
TVisObj.getLink
TVisObj.getTextStr
TVisObj.duplicate
TVisObj.create
graphics.drawAnimation
graphics.instantiateAnimation
graphics.instantiateAnimation
graphics.getCurrentSpritePath
graphics.getAnimationSize
graphics.getAnimationInnerSize
graphics.getCharacterTextPosition
graphics.getParticles
graphics.registerRenderHook
TextScrollPane.addText

TSprite

Methods

getPath()
setPath(path)
getSize()
setPosition(position)
getPosition()

getPath()

Return Type Description
string path

setPath(path)

Parameter Type Description
path string

getSize()

Return Type Description
point size

setPosition(position)

Parameter Type Description
position point

getPosition()

Return Type Description
point position

Used In:

Commands.createSprite
TVisObj.getSprite