Difference between revisions of "GetProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Redirected page to Global Command: getProperty)
 
(11 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
 
-- do some action!
 
elseif getProperty("platform") == "mac then
 
-- do some other action!
 
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")
 
steamStatus = 0 -- by default the steam status should be set as unloaded!
 
 
 
if steamLoaded then
 
steamStatus = 1 -- we will use "1" for: has successfully loaded status!
 
else
 
steamStatus = 0 -- we will use "0" for: has not successfully loaded status!
 
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")
 
elseif sysLang == "German" then
 
Game.GameStandardLnaguage:setValue(VValueString, "Deutsch")
 
end
 
</syntaxhighlight>
 
 
 
 
 
 
 
<b><u>Arguments</u></b>
 
 
 
property: "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)
 
 
 
 
 
Flags: none
 
 
 
Return: property <br/>
 
requested property value
 
{{i18n|GetProperty}}
 

Latest revision as of 12:25, 19 May 2023