Ignition time based on which button is used

I am trying to get a fast or slow ignition based on which button I use to ignite my saber on a 2 button saber.
Using the style library I could use the blade angle for faster/slower ignition.
Would it be possible with OS6 to define different ignition retraction times for a preset coupled to which button I use to ignite the saber?
Modifying the prop file is not the issue for me, it has more to do with what argument I could parse to the style the moment the button is pressed?

You could use IgnitionTime<0> combined with SFX_out.Select(X) to choose a fast or slow sound and have the ignition time to it (“0” uses WavLen<> for IgnitionTime).

So if you set your out01.wav to be fast you’d set the prop case for fast ignition to use:

SFX_out.Select(0);
On(); //or  you can use FastOn() to skip any preons

then set out02.wav to be slow and set the prop case for slow ignition as:

SFX_out.Select(1);
On();

then the style would be something like:

TrWipeX<IgnitionTime<0>>

and it would be able to have the animation run faster or slower. The Select() picks the sound before the EFFECT is called so it would allow you dictate which sound to use based on the button, which then in turn sets how long the EFFECT transition runs if you use IgnitionTime<0> or WavLen<>.

I actually have something in development for OS7 that would enable this and a bunch of other features like it, but it’s not ready yet.

1 Like

Thank you so much!. That seems like a really neat way of getting this to work.
Was not aware that this function exists and can be used for this.
(I was going to try to use WavLen() en try to switch between presets wit longer and shorter out.wav’s using the different buttons)
Will try this out tommorow!

Tested it today, and it works perfect using the suggested solution, thanks again!

Just out of curiosity I also tried to modify the ignition timing directly by modifying the style,

char style_arg[10];
itoa(2345, style_arg, 10);
current_preset_.SetStyle(1,style_parser.SetArgument(current_preset_.GetStyle(1), IGNITION_TIME_ARG +2, style_arg));

Although the new Ignition time is set in the style (when I read it back, it has been set) the style itself does not use this new value. Only after

current_preset_.Save();
SetPresetFast(current_preset_.preset_num);

is the style using the new Ignition timing, but this takes a while, and makes the response to the button quite slow.

Is there a way of modifying parameters of the current style that is loaded into RAM directly?

Currently there is no way to do this. Once the style has been created we don’t have a way where the parsed argument is stored any more. (Possibly multiple locations.)

It’s trivial to write special-purpose style templates that do this though. See the edit mode code for an example of this.

You could try using IntSelect if you wanted specific ms for the two out.wav sounds.

TrWipeX<IntSelect<WavNum<>,300,800>>

I threw this together, it should work in theory but I haven’t done a lot with WavNum, but it will select “300” when out01.wav is played and “800” when out02.wav is used.

or you can set up different transitions using TrSelect<>

TrSelect<WavNum<>,TrWipe<300>,TrFade<500>>

This would select TrWipe for 1st wav and TrFade for 2nd.

All of the “Select” options ColorSelect<>, IntSelect<> and TrSelect<> allow you to “select” from an array based on an Int<> value and since WavNum<> returns the current wav file it can be paired with the Select() in your prop to keep everything aligned.

2 Likes

I wish I could double-heart this post.

1 Like

Using the IntSelect<> as suggested, worked almost first try. The WavNum<> function should be called with;

WavNum<EFFECT_IGNITION>
As the Hum is actually the first Wav being played, and would otherwise be used as the WavNum<>. Calling this function with the desired EFFECT_… , gives me the fuinctionality that I was looking for!

Also modified it even further to be able to alter the values of the slow and fast ignition using the Proffie Workbench. I hijacked the IGNITION_DELAY_ARG for the slow ignition, as there are no user defined ARGs possible afaik?

TrSelect<WavNum<EFFECT_IGNITION>,TrWipeX<IgnitionTime<78>>,TrWipeX<IntArg<IGNITION_DELAY_ARG,1234>>>

Maybe something for OS7 to add some USER_ARG that can be accessed from the Proffie Workbench and can be used for any IntArg<>?

Cool, yeah I haven’t used WavNum<> much, makes sense.

I do have more ARG values coming for OS7 for Edit Mode and they’d most likely be added to the Workbench I assume but if you’re not using an IgnitionDelay in your style it’s perfectly fine to “hijack” it for custom use. The name is really based off of Edit Mode’s menu system and my library but since the arguments are just Rgb16 or Int values they could be interchanged for anything, particularly in styles that aren’t using specific slots.