• Hi Guest!

    We have posted a new VaM2 dev log on Patreon, starting a monthly cadence of written progress updates between Beta releases. Highlights include the new Gizmos System, Selection Carousel, and Modes System with Context-Specific Editing. Beta1.2 is 15 of 21 items complete.

    Read the full post on Patreon, or follow progress on the public Trello roadmap.

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
93
Reactions
173
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
Yes, like @murn mentioned you need to include this in your project

Then use the "MacGruber.EventTrigger.OpenPanel" function as a listener. You can check out Relay plugin in MacGruber LogicBriks or my Koboldlink plugin (for example, the listener for the "Actions OnCustomTrigger" button) for an example implementation.
 
Upvote 0
Back
Top Bottom