Global Command: getProperty: Difference between revisions
From The Official Visionaire Studio: Adventure Game Engine Wiki
Created page with "<div class="toccolours mw-collapsible mw-collapsed tbl-ds"> <span class="bold">Command History</span> <div class="mw-collapsible-content"> <div class="alt-bg">Available since ..." |
No edit summary |
||
| Line 18: | Line 18: | ||
Example 1: "platform" | Example 1: "platform" | ||
<syntaxhighlight> | <syntaxhighlight> | ||
-- if platform | -- if platform = windows then do some action else if ... | ||
if getProperty("platform") == "win" then | if getProperty("platform") == "win" then | ||
getObject("Conditions[win | getObject("Conditions[win]"):setValue(VConditionValue, true) | ||
elseif getProperty("platform") == "mac" then | elseif getProperty("platform") == "mac" then | ||
getObject("Conditions[mac | getObject("Conditions[mac]"):setValue(VConditionValue, true) | ||
elseif getProperty("platform") == "linux" then | |||
getObject("Conditions[linux]"):setValue(VConditionValue, true) | |||
elseif getProperty("platform") == "ios" then | |||
getObject("Conditions[ios]"):setValue(VConditionValue, true) | |||
elseif getProperty("platform") == "android" then | |||
getObject("Conditions[win]"):setValue(VConditionValue, true) | |||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 28: | Line 34: | ||
Example 2: "steam_initialized" | Example 2: "steam_initialized" | ||
<syntaxhighlight> | <syntaxhighlight> | ||
-- let's check if steam has initialized & set a value based on return value | -- let's check if steam has initialized & set a value based on return value | ||
local steamLoaded == getProperty("steam_initialized") | local steamLoaded == getProperty("steam_initialized") | ||
if steamLoaded then | if steamLoaded then | ||
getObject("Conditions[ | getObject("Conditions[steamInit]"):setValue(VConditionValue, true) | ||
else | else | ||
getObject("Conditions[ | getObject("Conditions[steamInit]"):setValue(VConditionValue, false) | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 40: | Line 46: | ||
Example 3: "system_language" | Example 3: "system_language" | ||
<syntaxhighlight> | <syntaxhighlight> | ||
-- let's check the current users operating system language & store it in a variable | -- let's check the current users operating system language & store it in a variable | ||
local sysLang == getProperty("system_language") | local sysLang == getProperty("system_language") | ||
| Line 46: | Line 52: | ||
game:setValue(VGameStandardLanguage, getObject("Languages[English]")) | game:setValue(VGameStandardLanguage, getObject("Languages[English]")) | ||
elseif sysLang == "German" then | elseif sysLang == "German" then | ||
game:setValue(VGameStandardLanguage, getObject("Languages[ | game:setValue(VGameStandardLanguage, getObject("Languages[German]")) | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 69: | Line 75: | ||
<span class="bold">property</span> <br/> | <span class="bold">property</span> <br/> | ||
The requested property value | The requested property value | ||
{{i18n| | {{i18n|GetProperty_(CMS)}} | ||
Revision as of 19:33, 19 March 2014
Command History
Available since v3.7
system_language property added to v3.8
Return the requested property.
Syntax:
getProperty(property)
Example 1: "platform"
-- if platform = windows then do some action else if ...
if getProperty("platform") == "win" then
getObject("Conditions[win]"):setValue(VConditionValue, true)
elseif getProperty("platform") == "mac" then
getObject("Conditions[mac]"):setValue(VConditionValue, true)
elseif getProperty("platform") == "linux" then
getObject("Conditions[linux]"):setValue(VConditionValue, true)
elseif getProperty("platform") == "ios" then
getObject("Conditions[ios]"):setValue(VConditionValue, true)
elseif getProperty("platform") == "android" then
getObject("Conditions[win]"):setValue(VConditionValue, true)
endExample 2: "steam_initialized"
-- let's check if steam has initialized & set a value based on return value
local steamLoaded == getProperty("steam_initialized")
if steamLoaded then
getObject("Conditions[steamInit]"):setValue(VConditionValue, true)
else
getObject("Conditions[steamInit]"):setValue(VConditionValue, false)
endExample 3: "system_language"
-- let's check the current users operating system language & store it in a variable
local sysLang == getProperty("system_language")
if sysLang == "English" then
game:setValue(VGameStandardLanguage, getObject("Languages[English]"))
elseif sysLang == "German" then
game:setValue(VGameStandardLanguage, getObject("Languages[German]"))
end
Arguments
property: "string"
- "platform" (returns "win" or "mac" depending on users operating system)
- "steam_initialized" (true/false depending if the steam_api is successfully loaded & client is connected)
- "system_language" (returns users system language in english; english, german, spanish etc)
Flags
none
Return
property
The requested property value