Difference between revisions of "UpdateName (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "{| class="ts" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | updateName(tbl) || Definition || AF...") |
(No difference)
|
Revision as of 15:29, 14 September 2022
Name | Type | By |
---|---|---|
updateName(tbl) | Definition | AFRLme |
This small function allows you to dynamically update the name of any type of object below the mouse cursor, for example: ??? to Rusty Old Tin Can.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. Create a condition in the conditions tab of the object that you want to dynamically update & call it "name_discovered" & set the default value as false. This condition will be used to tell the engine when to use the new name.
3. Create a mouse enters action for the object you want to dynamically change the name of & insert these action parts into it.
if condition "name_discovered" is true execute a script >
local t = {
"Sun",
"Sonne"
}
updateName(t)
end if
Quick note: don't forget that you need to insert the default name of the character into the name input box for each language inside of the properties section of the character, otherwise the it won't display anything as the name table for that language will return nil because it doesn't exist. |
Main Script
function updateName(tbl)
local n = game.CurrentObject.Name.TextLanguages
for i = 1, #n do
n[i].text = tbl[i]
end
game.CurrentObject.Name.TextLanguages = n
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
tbl | table | This should be a table or linked table containing the string texts that you want to update the names with. |