SteamVR

SteamVR

SteamVR Workshop
Customize your SteamVR experience by finding new backgrounds, 3D environments, controllers and base station models.
Learn More
How Are Parameters Passed To Vscript Functions?
So far I've only seen examples of Vscripts that use some apparently global value of PARAMS to pass values into the script. Is there a way to add arguments to PARAMS to give a script some more specific functionality. For example, if I wanted to add in the name of a target entity for the Vscript to act on.
< >
Showing 1-4 of 4 comments
Rectus 13 2 Aug, 2023 @ 2:20pm 
If you mean calling a function from Hammer I/O on a script running on an entity, there isn't really any clean way of setting parameters. IIRC the only option is using the RunScriptCode input to call the function, but it is limited to settign the paramters statically.

What are you trying to accomplish? It might be better to approach it from another direction.
Specifically, I've created a script using info from your teleport tutorial that moves the player around a map on a train. At times, I teleport the train with the player's HMD anchor parented to it to different locations and this additional script uses the SetForwardVector function to act on the player's HMDAnchor to turn the player's HMD anchor's front toward a specific direction using a defined target entity at each location immediately after the teleport. I can just create a different script for each location this occurs at using a different marker name defined within each new script but having been a software developer for many years, I'd like to use a single script for all locations with the name of the marker passed into it. And I was wondering if this was even possible for any other scripts I might need in the future. But from what you're saying this is not possible. Thanks for the quick response!
Last edited by The Evil Elvis™; 2 Aug, 2023 @ 5:18pm
I could always search for the nearest marker but that just makes me want passable arguments all the more.
Rectus 13 3 Aug, 2023 @ 12:26am 
Yeah, I feel you. This has always been an annoying limitation with VScript.
< >
Showing 1-4 of 4 comments
Per page: 1530 50