ObjName (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 13:26, 22 October 2017 by AFRLme (talk) (Created page with "{| class="ts" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | objName(obj) || Definition || Sebas...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Name Type By
objName(obj) Definition Sebastian

This small function allows you to return the action text name of the specified object; returns name based on current active language.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. To use this function you should create an execute a script action containing...

objName(game.CurrentScene.SceneObjects["example"]) -- return name of a specified object

or...

objName(game.CurrentObject) -- return name of object currently underneath the cursor

Main Script

-- * returns the objects, buttons or characters name * --
function objName(obj)
  local table = obj:getId().tableId
  if table == eObjects then
    return obj:getTextStr(VObjectName)
  elseif table == eCharacters then
    return obj:getTextStr(VCharacterName)
  elseif table == eButtons then
    return obj:getTextStr(VButtonName)
  end
end

Syntax Breakdown

Name Type Description
obj "string" or link This should be a "string" or link value containing the object you want to return the name for. The object can be a scene object, a character, an item, an interface button, etc.