Difference between revisions of "Global Commands"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "This is a list of global commands available in Visionaire Studio. == General commands == * createScreenshot * Global Command: createSp...") |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This is a list of global | + | This is a list of global methods and fields available in Visionaire Studio. |
− | == General | + | == Methods == |
+ | === General === | ||
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
− | + | ! Description | |
− | + | |- | |
− | + | | [[Global Command: createScreenshot|createScreenshot]] | |
− | + | | Create a screenshot to be used for the next savegame or to save into an external folder as a .png file. | |
− | + | |- | |
− | + | | [[Global Command: createSprite|createSprite]] | |
− | + | | | |
− | + | |- | |
− | + | | [[Global Command: getCursorPos|getCursorPos]] | |
− | + | | Get the current position of the mouse cursor. | |
− | + | |- | |
− | + | | [[Global Command: getObject|getObject]] | |
− | + | | Get a Visionaire object. | |
− | + | |- | |
− | + | | [[Global Command: getProperty|getProperty]] | |
+ | | Get the requested game property. | ||
+ | |- | ||
+ | | [[Global Command: getTime|getTime]] | ||
+ | | Returns the number of milliseconds since the "getTime()" function was first called or since the timer was reset. | ||
+ | |- | ||
+ | | [[Global Command: isPointInsidePolygon|isPointInsidePolygon]] | ||
+ | | Test if a point lies inside a polygon. | ||
+ | |- | ||
+ | | [[Global Command: replaceGame|replaceGame]] | ||
+ | | Replaces the Visionaire game file and starts the game from the beginning. | ||
+ | |- | ||
+ | | [[Global Command: setCursorPos|setCursorPos]] | ||
+ | | Sets the mouse cursor to the {x,y} position provided. | ||
+ | |- | ||
+ | | [[Global Command: setDelay|setDelay]] | ||
+ | | Executes a function with a delay. | ||
+ | |- | ||
+ | | [[Global Command: sha1|sha1]] | ||
+ | | Calculates the 160-bit (20-byte) SHA-1 (Secure Hash Algorithm 1) hash of a string. | ||
+ | |- | ||
+ | | [[Global Command: startAction|startAction]] | ||
+ | | Starts an action. | ||
+ | |- | ||
+ | | [[Global Command: startAnimation|startAnimation]] | ||
+ | | Starts an animation. | ||
+ | |- | ||
+ | | [[Global Command: startDefaultBrowser|startDefaultBrowser]] | ||
+ | | Open a URL in the user's default browser or in the steam overlay (if active). | ||
+ | |- | ||
+ | | [[Global Command: startObjectTween|startObjectTween]] | ||
+ | | Start tween on a Visionaire object field. | ||
+ | |- | ||
+ | | [[Global Command: startTween|startTween]] | ||
+ | | Start tween on a Lua variable. | ||
+ | |- | ||
+ | | [[Global Command: stopAction|stopAction]] | ||
+ | | Stop an active action. | ||
+ | |- | ||
+ | | [[Global Command: stopAnimation|stopAnimation]] | ||
+ | | Stop a running animation. | ||
+ | |} | ||
− | == | + | === Sound & Volume === |
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
− | + | ! Description | |
− | + | |- | |
− | + | | [[Global Command: getSoundId|getSoundId]] | |
+ | | Retrieve the id of a currently active audio file. | ||
+ | |- | ||
+ | | [[Global Command: getSoundProperty|getSoundProperty]] | ||
+ | | Retrieve various properties of a sound. | ||
+ | |- | ||
+ | | [[Global Command: getVolume|getVolume]] | ||
+ | | Retrieve general volume levels. | ||
+ | |- | ||
+ | | [[Global Command: setSoundProperty|setSoundProperty]] | ||
+ | | Set properties of a sound. | ||
+ | |- | ||
+ | | [[Global Command: setVolume|setVolume]] | ||
+ | | Set general volume levels. | ||
+ | |- | ||
+ | | [[Global Command: startSound|startSound]] | ||
+ | | Play an audio file. | ||
+ | |- | ||
+ | | [[Global Command: stopSound|stopSound]] | ||
+ | | Stop a playing sound. | ||
+ | |- | ||
+ | | [[Global Command: toggleSoundPause|toggleSoundPause]] | ||
+ | | Toggle an active sound between playing and paused states. | ||
+ | |} | ||
− | == | + | === Events & Hooks === |
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
− | + | ! Description | |
− | + | |- | |
− | + | | [[Global Command: createEvent|createEvent]] | |
− | + | | | |
− | + | |- | |
+ | | [[Global Command: registerEventHandler|registerEventHandler]] | ||
+ | | Registering an event handler allows you to run custom functions on specific engine events. | ||
+ | |- | ||
+ | | [[Global Command: registerHookFunction|registerHookFunction]] | ||
+ | | Register a hook function for a specific operation. | ||
+ | |- | ||
+ | | [[Global Command: unregisterEventHandler|unregisterEventHandler]] | ||
+ | | Unregister an event handler for a specific engine event which had been registered before. | ||
+ | |} | ||
− | == | + | === Window === |
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
− | + | ! Description | |
+ | |- | ||
+ | | [[Global Command: getWindowBrightness|getWindowBrightness]] | ||
+ | | Returns the brightness (gamma) of the window. | ||
+ | |- | ||
+ | | [[Global Command: getWindowMode|getWindowMode]] | ||
+ | | Returns the current window mode, i. e. if the game is running at fullscreen or in a window. | ||
+ | |- | ||
+ | | [[Global Command: setWindowBrightness|setWindowBrightness]] | ||
+ | | Set the global brightness (gamma) of the window. | ||
+ | |- | ||
+ | | [[Global Command: setWindowSize|setWindowSize]] | ||
+ | | Set the size of the game window. | ||
+ | |- | ||
+ | | [[Global Command: setWindowTitle|setWindowTitle]] | ||
+ | | Set a custom title in the game application title bar. | ||
+ | |- | ||
+ | | [[Global Command: toggleWindowMode|toggleWindowMode]] | ||
+ | | Toggle the current window mode form fullscreen to windowed or vice versa. | ||
+ | |} | ||
− | == Shaders == | + | === Shaders === |
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
+ | ! Description | ||
+ | |- | ||
+ | | [[Global Command: shaderCompile|shaderCompile]] | ||
+ | | Compile a shader. | ||
+ | |- | ||
+ | | [[Global Command: shaderSetOptions|shaderSetOptions]] | ||
+ | | Set shader options. | ||
+ | |- | ||
+ | | [[Global Command: shaderUniform|shaderUniform]] | ||
+ | | Set uniforms for shader. | ||
+ | |} | ||
− | == Game clients (Steam, GOG Galaxy) == | + | === Game clients (Steam, GOG Galaxy) === |
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
− | + | ! Description | |
− | + | |- | |
− | + | | [[Global Command: getGameClientAchievement|getGameClientAchievement]] | |
+ | | Get the current state of a game client achievement. | ||
+ | |- | ||
+ | | [[Global Command: getGameClientStat|getGameClientStat]] | ||
+ | | Returns the requested game client stat. | ||
+ | |- | ||
+ | | [[Global Command: initGameClient|initGameClient]] | ||
+ | | Initialize the GOG Galaxy client with the given values. | ||
+ | |- | ||
+ | | [[Global Command: resetGameClientStats|resetGameClientStats]] | ||
+ | | Resets all game client stats. | ||
+ | |- | ||
+ | | [[Global Command: setGameClientAchievement|setGameClientAchievement]] | ||
+ | | Set a game client achievement to "done". | ||
+ | |- | ||
+ | | [[Global Command: setGameClientStat|setGameClientStat]] | ||
+ | | Sets the specified game client stat to the given value. | ||
+ | |} | ||
− | == Haptic | + | === Haptic effects === |
− | + | {| class="ts" | |
− | + | |- | |
− | + | ! style="width:20%" | Function Name | |
− | + | ! Description | |
− | + | |- | |
− | + | | [[Global Command: createHapticEffectCondition|createHapticEffectCondition]] | |
− | + | | Create a haptic effect for devices which support haptic effects. | |
− | + | |- | |
− | + | | [[Global Command: createHapticEffectConstant|createHapticEffectConstant]] | |
+ | | Create a constant haptic effect for devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: createHapticEffectLeftRight|createHapticEffectLeftRight]] | ||
+ | | Create a haptic left/right effect for devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: createHapticEffectPeriodic|createHapticEffectPeriodic]] | ||
+ | | Create a periodic haptic effect for devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: createHapticEffectRamp|createHapticEffectRamp]] | ||
+ | | Create a haptic ramp effect for devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: startHapticEffect|startHapticEffect]] | ||
+ | | Start a previously created haptic effect for devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: startHapticRumble|startHapticRumble]] | ||
+ | | Start a haptic rumble effect for devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: stopHapticEffect|stopHapticEffect]] | ||
+ | | Stop a haptic effect on devices which support haptic effects. | ||
+ | |- | ||
+ | | [[Global Command: stopHapticRumble|stopHapticRumble]] | ||
+ | | Stop a haptic rumble effect on devices which support haptic effects. | ||
+ | |} | ||
− | == Debug == | + | === Debug === |
− | + | {| class="ts" | |
− | + | |- | |
+ | ! style="width:20%" | Function Name | ||
+ | ! Description | ||
+ | |- | ||
+ | | '''debugerror''' | ||
+ | | Internal debug function to create a stacktrace | ||
+ | |- | ||
+ | | '''debugfunc''' | ||
+ | | Internal debug function to create a stacktrace | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Fields == | ||
+ | {| class="ts" | ||
+ | |- | ||
+ | ! style="width:20%" | Field Name | ||
+ | ! style="width:10%" | Type | ||
+ | ! Description | ||
+ | |- | ||
+ | | '''currentAction''' | ||
+ | | TVisObj | ||
+ | | The action where the current script was called from. | ||
+ | |- | ||
+ | | '''DIVIDING_POINT''' | ||
+ | | t_point | ||
+ | | An associative array containing the elements '''x''' and '''y''' with the values {x = -10000, y = -10000}. This constant is used to separate multiple polygons from each other in the game data structure. Usually a point list can contain multiple polygons, and a point which is equal to DIVIDING_POINT marks the end of the current polygon. | ||
+ | |- | ||
+ | | '''emptyObject''' | ||
+ | | TVisObj | ||
+ | | Empty Visionaire object | ||
+ | |- | ||
+ | | '''game''' | ||
+ | | TVisObj | ||
+ | | The game object, equal to <code>getObject("Game")</code> but faster and easier to use. | ||
+ | |- | ||
+ | | '''localAppDir''' | ||
+ | | String | ||
+ | | The directory where the savegames (in the "Savegames" folder), the messages.log file and possible dumps are written to. This directory is also used for the config.ini in case the project file is given as command line parameter for the player. | ||
+ | On Windows the returned path is <code>C:\Users\USERNAME\AppData\Local\VisionaireStudio\VIS_FILENAME</code> or <code>C:\Users\USERNAME\AppData\Local\COMPANY_NAME\GAME_NAME</code>, if you have defined company and game names in the game properties. | ||
+ | |- | ||
+ | | '''localResourcesDir''' | ||
+ | | String | ||
+ | | The directory of the Visionaire project or data file, respectively (.ved/.vis). | ||
+ | |- | ||
+ | | ''Visionaire data table'' | ||
+ | ''(e. g. "Actions", "Characters", "Scenes")'' | ||
+ | | Table | ||
+ | | All the [[Data Structure|tables of Visionaire's data structure]] are globally available through their names. | ||
+ | |} | ||
{{toc}} | {{toc}} |
Latest revision as of 11:54, 10 August 2023
This is a list of global methods and fields available in Visionaire Studio.
Methods
General
Function Name | Description |
---|---|
createScreenshot | Create a screenshot to be used for the next savegame or to save into an external folder as a .png file. |
createSprite | |
getCursorPos | Get the current position of the mouse cursor. |
getObject | Get a Visionaire object. |
getProperty | Get the requested game property. |
getTime | Returns the number of milliseconds since the "getTime()" function was first called or since the timer was reset. |
isPointInsidePolygon | Test if a point lies inside a polygon. |
replaceGame | Replaces the Visionaire game file and starts the game from the beginning. |
setCursorPos | Sets the mouse cursor to the {x,y} position provided. |
setDelay | Executes a function with a delay. |
sha1 | Calculates the 160-bit (20-byte) SHA-1 (Secure Hash Algorithm 1) hash of a string. |
startAction | Starts an action. |
startAnimation | Starts an animation. |
startDefaultBrowser | Open a URL in the user's default browser or in the steam overlay (if active). |
startObjectTween | Start tween on a Visionaire object field. |
startTween | Start tween on a Lua variable. |
stopAction | Stop an active action. |
stopAnimation | Stop a running animation. |
Sound & Volume
Function Name | Description |
---|---|
getSoundId | Retrieve the id of a currently active audio file. |
getSoundProperty | Retrieve various properties of a sound. |
getVolume | Retrieve general volume levels. |
setSoundProperty | Set properties of a sound. |
setVolume | Set general volume levels. |
startSound | Play an audio file. |
stopSound | Stop a playing sound. |
toggleSoundPause | Toggle an active sound between playing and paused states. |
Events & Hooks
Function Name | Description |
---|---|
createEvent | |
registerEventHandler | Registering an event handler allows you to run custom functions on specific engine events. |
registerHookFunction | Register a hook function for a specific operation. |
unregisterEventHandler | Unregister an event handler for a specific engine event which had been registered before. |
Window
Function Name | Description |
---|---|
getWindowBrightness | Returns the brightness (gamma) of the window. |
getWindowMode | Returns the current window mode, i. e. if the game is running at fullscreen or in a window. |
setWindowBrightness | Set the global brightness (gamma) of the window. |
setWindowSize | Set the size of the game window. |
setWindowTitle | Set a custom title in the game application title bar. |
toggleWindowMode | Toggle the current window mode form fullscreen to windowed or vice versa. |
Shaders
Function Name | Description |
---|---|
shaderCompile | Compile a shader. |
shaderSetOptions | Set shader options. |
shaderUniform | Set uniforms for shader. |
Game clients (Steam, GOG Galaxy)
Function Name | Description |
---|---|
getGameClientAchievement | Get the current state of a game client achievement. |
getGameClientStat | Returns the requested game client stat. |
initGameClient | Initialize the GOG Galaxy client with the given values. |
resetGameClientStats | Resets all game client stats. |
setGameClientAchievement | Set a game client achievement to "done". |
setGameClientStat | Sets the specified game client stat to the given value. |
Haptic effects
Function Name | Description |
---|---|
createHapticEffectCondition | Create a haptic effect for devices which support haptic effects. |
createHapticEffectConstant | Create a constant haptic effect for devices which support haptic effects. |
createHapticEffectLeftRight | Create a haptic left/right effect for devices which support haptic effects. |
createHapticEffectPeriodic | Create a periodic haptic effect for devices which support haptic effects. |
createHapticEffectRamp | Create a haptic ramp effect for devices which support haptic effects. |
startHapticEffect | Start a previously created haptic effect for devices which support haptic effects. |
startHapticRumble | Start a haptic rumble effect for devices which support haptic effects. |
stopHapticEffect | Stop a haptic effect on devices which support haptic effects. |
stopHapticRumble | Stop a haptic rumble effect on devices which support haptic effects. |
Debug
Function Name | Description |
---|---|
debugerror | Internal debug function to create a stacktrace |
debugfunc | Internal debug function to create a stacktrace |
Fields
Field Name | Type | Description |
---|---|---|
currentAction | TVisObj | The action where the current script was called from. |
DIVIDING_POINT | t_point | An associative array containing the elements x and y with the values {x = -10000, y = -10000}. This constant is used to separate multiple polygons from each other in the game data structure. Usually a point list can contain multiple polygons, and a point which is equal to DIVIDING_POINT marks the end of the current polygon. |
emptyObject | TVisObj | Empty Visionaire object |
game | TVisObj | The game object, equal to getObject("Game") but faster and easier to use.
|
localAppDir | String | The directory where the savegames (in the "Savegames" folder), the messages.log file and possible dumps are written to. This directory is also used for the config.ini in case the project file is given as command line parameter for the player.
On Windows the returned path is |
localResourcesDir | String | The directory of the Visionaire project or data file, respectively (.ved/.vis). |
Visionaire data table
(e. g. "Actions", "Characters", "Scenes") |
Table | All the tables of Visionaire's data structure are globally available through their names. |