Difference between revisions of "GetProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Redirected page to Global Command: getProperty)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
+
#REDIRECT [[Global Command: getProperty]]
<b>Command History</b>
 
<div class="mw-collapsible-content">
 
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v3.7</span></div>
 
<div>system_language property added to <span style="color:orange">v3.8</span></div>
 
</div></div>
 
 
 
 
 
Return the requested property.
 
 
 
 
 
Syntax:
 
<syntaxhighlight>
 
getProperty(property)
 
</syntaxhighlight>
 
 
 
 
 
Example 1: "platform"
 
<syntaxhighlight>
 
-- if platform equals windows then do some action else if mac do some other action!
 
if getProperty("platform") == "win" then
 
getObject("Conditions[win?]"):setValue(VConditionValue, true)
 
elseif getProperty("platform") == "mac" then
 
getObject("Conditions[mac?]"):setValue(VConditionValue, true)
 
end
 
</syntaxhighlight>
 
 
 
Example 2: "steam_initialized"
 
<syntaxhighlight>
 
-- let's check if steam has initialized & set a value based on return value!
 
local steamLoaded == getProperty("steam_initialized")
 
 
 
if steamLoaded then
 
getObject("Conditions[steamLoaded?]"):setValue(VConditionValue, true)
 
else
 
getObject("Conditions[steamLoaded?]"):setValue(VConditionValue, false)
 
end
 
</syntaxhighlight>
 
 
 
Example 3: "system_language" (I'm not sure if this example is correct without testing!)
 
<syntaxhighlight>
 
-- let's check the current users operating system language & store it in a variable!
 
local sysLang == getProperty("system_language")
 
 
 
if sysLang == "English" then
 
Game.GameStandardLanguage:setValue(VValueString, "English") -- fix
 
elseif sysLang == "German" then
 
Game.GameStandardLanguage:setValue(VValueString, "Deutsch") -- fix
 
end
 
</syntaxhighlight>
 
 
 
 
 
 
 
<b><u>Arguments</u></b>
 
 
 
<b>property</b>: "string" <br/>
 
* "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)
 
 
 
 
 
<b><u>Flags</u></b>
 
 
 
none
 
 
 
 
 
<b><u>Return</u></b>
 
 
 
<b>property</b> <br/>
 
requested property value
 
{{i18n|GetProperty}}
 

Latest revision as of 12:25, 19 May 2023