Dynamic Action Names (CMS)
Name | Type | By |
---|---|---|
Dynamic Action Names | Definition | AFRLme |
This script allows you to create dynamic action names that are set on mouse over; this script is especially useful for developers using the broken sword style command interface or a coin based command interface with limited commands.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. Create language tables inside of the t table; language names should reflect languages names assigned to your project.
-- * tables * --
local t = {}
t["English"]
t["German"]
-- etc...
3. Add action names to each language table; !important - they must all be written in the same order.
t["English"] = {"Use", "Pick Up", "Push", "Pull"}
t["German"] = {"Benutzen", "Nehmen", "Drucken", "Ziehen"}
-- etc...
4. On mouse enter for each object, character, or item; create an execute a script action containing...
renameBtn(integer value)
example
renameBtn(1) -- returns "Use", "Benutzen" etc...
renameBtn(2) -- returns "Pick Up", "Nehmen" etc...
-- it will return a single name from the tables based on integer value of '''val''' & the current game language.
5. On mouse out for each object, character or item; create an execute a script action containing...
resetBtn()
Main Script
--[[
Dynamic action names [v3] (14/03/2014)
Written by AFRLme [Lee Clarke]
-- + --
email: afrlme@outlook.com
paypal: afrlme@zoho.com
patreon: https://www.patreon.com/AFRLme
portfolio: https://afrl.me
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]
-- * local variables * --
local texts, lang, btn, val -- empty variables
-- * tables * --
local t = {}
t["English"] = {"Use", "Pick up", "Push", "Pull"}
t["French"] = {"Usage", "Prendre", "Appuyer", "Arracher"}
t["German"] = {"Benutzen", "Nehmen", "Drucken", "Ziehen"}
t["Spanish"] = {"Usar", "Cojer", "Empujar", "Tirar"}
-- * set new action name * --
function renameBtn(val)
btn = game.ActiveCommand:getLink(VButtonName) -- store current command
texts = btn:getLinks(VTextAll) -- get all texts related to the button
lang = game:getLink(VGameStandardLanguage):getName() -- get current game language
-- * --
for i = 1, table.maxn(texts) do
if texts[i]:getLink(VTextLanguageLanguage):getName() == lang then texts[i]:setValue(VTextLanguageText, t[lang][val]) end
end
end
-- * reset action names back to default * --
function resetBtn()
for i = 1, table.maxn(texts) do texts[i]:setValue(VTextLanguageText, "") end
end