Difference between revisions of "UpdateName (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m |
|||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ||
|- | |- | ||
− | | updateName(tbl) || Definition || AFRLme | + | | updateName(tbl) || Definition || [https://www.patreon.com/AFRLme AFRLme] |
|} | |} | ||
Line 28: | Line 28: | ||
{| class="ts" | {| class="ts" | ||
|- | |- | ||
− | | ''Quick note: don't forget that you need to type out the name for each character, object, button, item, etc. via the text input box belonging to their properties section for each language you created, otherwise | + | | ''Quick note: don't forget that you need to type out the name for each character, object, button, item, etc. via the text input box belonging to their properties section for each language you created, otherwise it won't draw the text for any of the names linked to x language that have been left empty.'' |
|} | |} | ||
Latest revision as of 16:07, 15 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 type out the name for each character, object, button, item, etc. via the text input box belonging to their properties section for each language you created, otherwise it won't draw the text for any of the names linked to x language that have been left empty. |
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. |