Difference between revisions of "GetProperty"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 3: Line 3:
 
<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 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>
 
</div></div>
  
Line 15: Line 16:
  
  
Example:
+
Example 1: "platform"
 
<syntaxhighlight>
 
<syntaxhighlight>
n/a
+
-- 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>
 
</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")
 +
steam
 +
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>
 +
  
  
Line 24: Line 43:
 
<b><u>Arguments</u></b>
 
<b><u>Arguments</u></b>
  
property: <br/>
+
property: "string" <br/>
"string" - The requested property to retrieve. Currently supported properties: "platform" ("win"/"mac") <br/>
+
* "platform" (returns "win" or "mac" depending on users operating system)
"steam_initialized" (true/false depending if the steam_api was loaded and client is connected, false if the operation failed)
+
* "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
 
Flags: none

Revision as of 01:03, 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")
steam
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



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