Session Plugins Hook

Plugins Session Plugins Hook

everlaster

Well-known member
Featured Contributor
Messages
464
Reactions
2,697
Points
93
Website
patreon.com
Twitter
everlasterVR
Patreon
everlaster
everlaster submitted a new resource:

Session Plugins Hook - Exposes parameters of Session plugins to Virt-A-Mate's triggers system.

Want to share something or need help? Join my Discord: https://discord.gg/2h8PgczkeW

Session Plugins Hook looks up the triggerable parameters of session plugins and exposes them to the triggers system. It lists all session plugin parameters in its own list of parameters, and mirrors the values.

You might ask, what's the point? Great question! I'll let you answer that. :p

Add the plugin to any atom or to Scene Plugins, and its values will save with the...

Read more about this resource...
 
omg if this works with the plugins I'm thinking of , this could be amazing!!! I hope it can do what I think it can, very cool.
 
Hm. .So I see ToySerialController in the list. However, when using a Slider trigger, I don't see any of the exposed variables. I do see them for other plugins, but not this one :(
 
Hm. .So I see ToySerialController in the list. However, when using a Slider trigger, I don't see any of the exposed variables. I do see them for other plugins, but not this one :(
It's likely that ToySerialController doesn't "register" its parameters. Registering parameters does two things:
1) The parameters will save when the plugin is saved. For session plugins, this happens when saving a session plugin preset. For other plugins, their parameter save also with the scene and atom presets.
2) The parameters become exposed to the VAM trigger system and to other plugins. (But session plugins aren't available via the trigger system since the session plugin manager atom is unselectable in the trigger menu.)

Session Plugins Hook can only see parameters that are exposed via registering. You can easily test if a parameter of a session plugin is registered by setting it to a non default value in the plugin UI, saving a new session plugins preset, and loading that preset. If after loading the value is still what you set it to, it should also be visible to Session Plugins Hook.
 
It's likely that ToySerialController doesn't "register" its parameters. Registering parameters does two things:
1) The parameters will save when the plugin is saved. For session plugins, this happens when saving a session plugin preset. For other plugins, their parameter save also with the scene and atom presets.
2) The parameters become exposed to the VAM trigger system and to other plugins. (But session plugins aren't available via the trigger system since the session plugin manager atom is unselectable in the trigger menu.)

Session Plugins Hook can only see parameters that are exposed via registering. You can easily test if a parameter of a session plugin is registered by setting it to a non default value in the plugin UI, saving a new session plugins preset, and loading that preset. If after loading the value is still what you set it to, it should also be visible to Session Plugins Hook.

Thanks for the reply, Everlaster. Makes perfect sense. The plugin doesn't register the parameters because they don't save from session to session; you have to manually load a default.

Is there a way that we can get in there and register them? Is it an easy process if I go into the code? I can code a *little* but not sure what to do in this case.
 
Thanks for the reply, Everlaster. Makes perfect sense. The plugin doesn't register the parameters because they don't save from session to session; you have to manually load a default.

Is there a way that we can get in there and register them? Is it an easy process if I go into the code? I can code a *little* but not sure what to do in this case.
It's very easy to do. In the code,
1. find where the JSONStorableFloat is created (search for new JSONStorableFloat)
2. make sure it's assigned to a variable (usually it is; but if it's just new JSONStorableFloat ... change it to var jsf = new JSONStorableFloat ...)
3. register it: RegisterFloat(jsf); right after the line where jsf (or whatever the existing variable name is) is assigned

That should be it usually.
 
It's very easy to do. In the code,
1. find where the JSONStorableFloat is created (search for new JSONStorableFloat)
2. make sure it's assigned to a variable (usually it is; but if it's just new JSONStorableFloat ... change it to var jsf = new JSONStorableFloat ...)
3. register it: RegisterFloat(jsf); right after the line where jsf (or whatever the existing variable name is) is assigned

That should be it usually.
Nice! I will try this and get back to you. Thanks so much!
 
@Blazedust I am sure you are busy and you don't support this any longer, but is there a chance you could give me a hint as to which files I will need to locate the JSONStorableFloat variables to register? I tried doing this a few weeks back and broke it all. I wish I was a developer but I am not :(
 
It's very easy to do. In the code,
1. find where the JSONStorableFloat is created (search for new JSONStorableFloat)
2. make sure it's assigned to a variable (usually it is; but if it's just new JSONStorableFloat ... change it to var jsf = new JSONStorableFloat ...)
3. register it: RegisterFloat(jsf); right after the line where jsf (or whatever the existing variable name is) is assigned

That should be it usually.

So I'm editing the code, and it looks like in my editor "RegisterFloat()" is not a recognized command. When I add it anyway as you instructor, VAM doesn't recognize the plugin, and throws this error: !> [CS103]: The name `RegisterFloat' does not exist in the current context in <Unknown> at [70, 13]
 
So I'm editing the code, and it looks like in my editor "RegisterFloat()" is not a recognized command. When I add it anyway as you instructor, VAM doesn't recognize the plugin, and throws this error: !> [CS103]: The name `RegisterFloat' does not exist in the current context in <Unknown> at [70, 13]
Not sure what causes that error. Maybe one of two things:
1. RegisterFloat expects the JSONStorableFloat object as a parameter.
2. The plugin needs to inherit from MVRScript

In any case, I'd suggest heading over to the official VAM discord's #scripting channel for plugin coding related help! This resource's discussion thread isn't really the best place for this.
 
Not sure what causes that error. Maybe one of two things:
1. RegisterFloat expects the JSONStorableFloat object as a parameter.
2. The plugin needs to inherit from MVRScript

In any case, I'd suggest heading over to the official VAM discord's #scripting channel for plugin coding related help! This resource's discussion thread isn't really the best place for this.
Thanks a lot - I just posted there.
 
Back
Top Bottom