• Hi Guest!

    We are extremely excited to announce the release of our first Beta1.1 and the first release of our Public AddonKit!
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. For access to the Public AddonKit you must be a Creator tier member. Once subscribed, download instructions can be found here.

    Click here for information and guides regarding the VaM2 beta. Join our Discord server for more announcements and community discussion about VaM2.
  • Hi Guest!

    VaM2 Resource Categories have now been added to the Hub! For information on posting VaM2 resources and details about VaM2 related changes to our Community Forums, please see our official announcement here.

VaM 1.x Plugin Help, how to create a Configure Trigger button and activate it.

Threads regarding the original VaM 1.x

Aether15

Active member
Joined
Oct 10, 2022
Messages
85
Reactions
160
I'm trying to work on a plugin for breathing. I have a slider bar so breathing can go faster or slower. I'm trying to create a "Configure On Breath" button that will show a "Discreet Actions" menu where you can add a bunch of triggers, but its not working. Here's a snippet of the code. Right now I just have a single .CS file. I don't have much experience with these and I'm just trying to throw something together. Edit: The purpose of the trigger is to add a trigger for Audiomate where I have a random breath sound collection.

I have this, but the Configure button is not working.
1763594076753.png


I want one of these menus to pop up so I can configure triggers.
1763594128523.png


// Define and register the action
var breathTrigger = new JSONStorableAction("OnBreath", () => {
OnBreath.Invoke();
});
RegisterAction(breathTrigger);

// Manual test button
CreateButton("Test Breath Trigger").button.onClick.AddListener(() => breathTrigger.actionCallback());

// Configure button that opens the discrete actions editor
CreateButton("Configure Breath Trigger").button.onClick.AddListener(() => {
if (breathTrigger.actionCallback != null)
{
breathTrigger.actionCallback(); // VaM will open the discrete actions popup for this action
}
});
}
 
Those actions aren't accessible so you'll have to use MacGruber's utilities (I think that's the one) to enable having those options open for your plugin to access. You can also get better help in the vam discord when it comes to scripts. Reach out to MacGruber or ask in the scripting discord channel.
 
Upvote 0
You can't manually create this "yourself". You need to use the hacks Acid found to use VAM's native trigger system.

You can find a good example in a somewhat "short" source in VAMStory.
Look in the Tools folder of the var file for a script named vams_distance.cs.

It features a set of 3 triggers. Everything is in there, from the trigger creation, button interaction to a clean iterative way of saving multiple triggers stored in a List (yes you also need to handle the save/restore system).
 
Upvote 0
Back
Top Bottom