ObjName (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 17:32, 23 August 2022 by AFRLme (talk | contribs)
Name Type By
objName(obj) Definition Sebastian

This small function allows you to return the action text name of the specified Visionaire Studio Object (visOBJ).


Quick note: returns name associated with current active language.


Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. Usage Example #1: return name belonging to a scene object belonging to the current scene.

objName(game.CurrentScene.SceneObjects["object_name"])

2b. Usage Example #2: return name belonging to the visObj currently below the mouse cursor.

objName(game.CurrentObject)

2c. Usage Example #3: return name belonging to a character.

objName(Characters["character_name"])

2d. Usage Example #4: return name belonging to an interface button.

objName(Interfaces["interface_name"].Buttons["button_name"])


Main Script

function objName(obj)
  local t = obj:getId().tableId -- store table ID belonging to the linked visOBJ
  if table == eObjects then -- check if scene object or item
    return obj:getTextStr(VObjectName) -- return object/item name
  elseif table == eCharacters then  -- check if character
    return obj:getTextStr(VCharacterName) -- return character name
  elseif table == eButtons then -- check if interface button
    return obj:getTextStr(VButtonName) -- return interface button name
  end
end


Syntax Breakdown

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