SteamVR/Environments/Scripting/Map Scripts: Difference between revisions
< SteamVR | Environments | Scripting
Jump to navigation
Jump to search
m (Updated links and references to match the other SteamVR Home pages) |
Thunder4ik (talk | contribs) m (clean up, added deadend tag) |
||
Line 1: | Line 1: | ||
{{Dead end|date=January 2024}} | |||
The SteamVR Workshop Tools support map specific scripts that are executed when the map loads. These scripts can contain specially named callback functions that get executed by the script system. | The SteamVR Workshop Tools support map specific scripts that are executed when the map loads. These scripts can contain specially named callback functions that get executed by the script system. | ||
Map scripts are designated by naming the script the same as the map, and placing it into the '''\steamvr_environments\game\steamtours_addons\<addon_name>\scripts\vscripts\map_scripts\''' directory. | Map scripts are designated by naming the script the same as the map, and placing it into the '''\steamvr_environments\game\steamtours_addons\<addon_name>\scripts\vscripts\map_scripts\''' directory. | ||
== Callbacks == | == Callbacks == | ||
Line 57: | Line 58: | ||
|- | |- | ||
|} | |} | ||
== Script System Functions == | == Script System Functions == |
Latest revision as of 10:14, 21 January 2024

This article has no
links to other VDC articles. Please help improve this article by adding links
that are relevant to the context within the existing text.
January 2024


January 2024
The SteamVR Workshop Tools support map specific scripts that are executed when the map loads. These scripts can contain specially named callback functions that get executed by the script system.
Map scripts are designated by naming the script the same as the map, and placing it into the \steamvr_environments\game\steamtours_addons\<addon_name>\scripts\vscripts\map_scripts\ directory.
Callbacks
Adding a function with the specific signature to the map script lets it get called from the game code.
Function | Signature | Description |
---|---|---|
OnInit | void OnInit()
|
Called when the script system loads. |
OnPostInit | void OnPostInit()
|
Called after the script system has been initialized. |
OnPrecache | void OnPrecache(handle context)
|
Called when assets are precached. |
OnActivate | void OnActivate()
|
|
OnInit | void OnInit()
|
Called when the script system loads. |
OnGameplayStart | void OnGameplayStart()
|
|
OnPlayerSpawned | void OnPlayerSpawned()
|
Called after the hosting player has spawned. |
OnHMDAvatarAndHandsSpawned | void OnHMDAvatarAndHandsSpawned()
|
Called when the VR equipment of the hosting player is accessible. |
OnDeactivate | void OnDeactivate()
|
|
OnPreShutdown | void OnPreShutdown()
|
|
OnShutdown | void OnShutdown()
|
Script System Functions
Functions available to the map script from the script system.
Function | Signature | Description |
---|---|---|
ScriptSystem_AddPerFrameUpdateFunction | void ScriptSystem_AddPerFrameUpdateFunction(function updateFunction)
|
Adds a function in the map script to be called every frame (90 FPS, 0.011 seconds). |
ScriptSystem_RemovePerFrameUpdateFunction | void ScriptSystem_RemovePerFrameUpdateFunction(function updateFunction)
|
Removes a previously added update function. |
AddConVar | void AddConVar(string conVarName, variable defaultValue, string type, table scope, string helpText, function callback)
|
Adds a new console variable bound to the specified script function. |
SetConVar | void SetConVar(string conVarName, variable value)
|
Sets a scripted convar value. |
GetConVar | string GetConVar(string conVarName, int prevIndex = nil)
|
Returns the name? of the specified convar. |