Difference between revisions of "GetProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 44: Line 44:
  
 
if sysLang == "English" then
 
if sysLang == "English" then
  Game.GameStandardLanguage:setValue(VValueString, "English")
+
  Game.GameStandardLanguage:setValue(VValueString, "English") -- fix
 
elseif sysLang == "German" then
 
elseif sysLang == "German" then
  Game.GameStandardLanguage:setValue(VValueString, "Deutsch")
+
  Game.GameStandardLanguage:setValue(VValueString, "Deutsch") -- fix
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 54: Line 54:
 
<b><u>Arguments</u></b>
 
<b><u>Arguments</u></b>
  
property: "string" <br/>
+
<b>property</b>: "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:
  
  
Flags: none
+
<b><u>Flags</u></b>
  
Return: property <br/>
+
none
 +
 
 +
 
 +
<b><u>Return</u></b>
 +
 
 +
<b>property</b> <br/>
 
requested property value
 
requested property value
 
{{i18n|GetProperty}}
 
{{i18n|GetProperty}}

Revision as of 15:49, 12 March 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.GameStandardLanguage:setValue(VValueString, "English") -- fix
elseif sysLang == "German" then
 Game.GameStandardLanguage:setValue(VValueString, "Deutsch") -- fix
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
requested property value