Difference between revisions of "GetProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
+
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
<b>Command History</b>
+
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v3.7</span></div>
+
<div class="alt-bg">Available since v3.7</div>
<div>system_language property added to <span style="color:orange">v3.8</span></div>
+
<div>system_language property added to v3.8</div>
 
</div></div>
 
</div></div>
  
Line 44: Line 44:
  
 
if sysLang == "English" then
 
if sysLang == "English" then
  game:setValue(VGameStandardLanguage, English) -- correct?
+
  game:setValue(VGameStandardLanguage, getObject("Languages[English]"))
 
elseif sysLang == "German" then
 
elseif sysLang == "German" then
  game:setValue(VGameStandardLanguage, Deutsch) -- correct?
+
  game:setValue(VGameStandardLanguage, getObject("Languages[Deutsch]"))
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 52: Line 52:
  
  
<b><u>Arguments</u></b>
+
<span class="bold underline">Arguments</span>
  
<b>property</b>: "string" <br/>
+
<span class="bold">property</span>: "string" <br/>
 
* "platform" (returns "win" or "mac" depending on users operating system)
 
* "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)
 
* "steam_initialized" (true/false depending if the steam_api is successfully loaded & client is connected)
Line 60: Line 60:
  
  
<b><u>Flags</u></b>
+
<span class="bold underline">Flags</span>
  
 
none
 
none
  
  
<b><u>Return</u></b>
+
<span class="bold underline">Return</span>
  
<b>property</b> <br/>
+
<span class="bold">property</span> <br/>
 
The requested property value
 
The requested property value
 
{{i18n|GetProperty}}
 
{{i18n|GetProperty}}

Revision as of 16:39, 2 April 2013

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 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

Example 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[steamLoaded?]"):setValue(VConditionValue, true)
else
 getObject("Conditions[steamLoaded?]"):setValue(VConditionValue, false)
end

Example 3: "system_language" (I'm not sure if this example is correct without testing!)

-- 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[Deutsch]"))
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