Difference between revisions of "GetProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 30: Line 30:
 
-- 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")
steam
+
steamStatus = 0 -- by default the steam status should be set as unloaded!
 +
 
 
if steamLoaded then
 
if steamLoaded then
 
  steamStatus = 1 -- we will use "1" for: has successfully loaded status!
 
  steamStatus = 1 -- we will use "1" for: has successfully loaded status!
Line 38: Line 39:
 
</syntaxhighlight>
 
</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>
  
  
Line 47: Line 59:
 
* "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)
 
* "system_language" (returns users system language in english; english, german, spanish etc)
 
* "system_language" (returns users system language in english; english, german, spanish etc)
 +
  
 
Flags: none
 
Flags: none

Revision as of 01:36, 8 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
 -- do some action!
elseif getProperty("platform") == "mac then
 -- do some other action!
end

Example 2: "steam_initialized"

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

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")
elseif sysLang == "German" then
 Game.GameStandardLnaguage:setValue(VValueString, "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
requested property value