Global Command: getProperty

From The Official Visionaire Studio: Adventure Game Engine Wiki

Get the requested game property.

Related functions getGameClientAchievement | getGameClientStat | initGameClient | resetGameClientStats | setGameClientAchievement | setGameClientStat


Syntax

getProperty(name)


Parameters

Parameter Type Supported values Description
name string "platform" Identify the operating system the game is running on.
"steam_initialized" Check if the Steam API has been initialized.
"galaxy_initialized" Check if the GOG Galaxy API has been initialized.
"galaxy_ready" Check if the GOG Galaxy API is ready.
"system_language" Get the current operating system language.
"display_resolution" Detect which part of the window/screen the game takes up.


Return values

The return value depends on the passed "name" parameter:

Passed parameter Return type/structure Description
"platform" string Returns one of the following strings depending on the user's operating system:
  • win
  • mac
  • ios
  • android
  • linux
  • ps4
  • xbox1
  • html5
"steam_initialized" boolean Returns true if the Steam API was loaded and the client is connected.
"galaxy_initialized" boolean Returns true if the GOG Galaxy API was loaded and the client is connected.
"galaxy_ready" boolean Returns true if the GOG Galaxy API is ready.
"system_language" string Returns the English name of the operating system language or "unknown" if the language couldn't be retrieved.
"display_resolution" t_rect x (int) Returns a Visionaire "t_rect" field: an associative array with the elements x, y, width, and height holding the rectangle the game takes up in the game window or on the screen, respectively (optional black borders not included).
y (int)
width (int)
height (int)


Examples

Example 1: Do something depending on the user's operating system.

local userPlatform = getProperty("platform")

if userPlatform == "win" or userPlatform == "mac" or userPlatform == "linux" then 
  print("We're on desktop.")
elseif userPlatform == "ios" or userPlatform == "android" then
  print("This is mobile.")
elseif userPlatform == "ps4" or userPlatform == "xbox1" then 
  print("It's a console.")
elseif userPlatform == "html5" then 
  print("Browser is fine, too.")
end


Example 2: Check if the Steam API has initialized and store the result in a (pre-defined) Visionaire condition called "steamInit".

local steamLoaded = getProperty("steam_initialized")

if steamLoaded then
  Conditions["steamInit"].Value = true
else
  Conditions["steamInit"].Value = false
end


Example 3: Set the game language to the one we called "Deutsch" in our game settings, if the user's operating system is set to German. Set the game to English in all other cases.

if getProperty("system_language") == "German" then
  game.StandardLanguage = Languages["Deutsch"]
else
  game.StandardLanguage = Languages["English"]
end