Difference between revisions of "ObjName (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
m
Line 39: Line 39:
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
|-
 
|-
| obj || link || This should be a link to the object you want to return the name for. The object can be a scene object, a character, an item or an interface button, etc.  
+
| obj || link || This should be a link to the object you want to return the name for. The object can be a scene object, a character, an item or an interface button.
 
|}{{toc}}
 
|}{{toc}}

Revision as of 13:30, 22 October 2017

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 link This should be a link to the object you want to return the name for. The object can be a scene object, a character, an item or an interface button.