For what it’s worth, This style simply “charges up” to a max level of 6 (so 7 total steps), and resets back to 0 when FIRE is pressed.
Font is setup like this:
./Fallout/alt000/altchng.wav
./Fallout/alt000/blast.wav
./Fallout/alt000/hum.wav
./Fallout/alt001/altchng.wav
./Fallout/alt001/blast.wav
./Fallout/alt001/hum.wav
./Fallout/alt002/altchng.wav
./Fallout/alt002/blast.wav
./Fallout/alt002/hum.wav
./Fallout/alt003/altchng.wav
./Fallout/alt003/blast.wav
./Fallout/alt003/hum.wav
./Fallout/alt004/altchng.wav
./Fallout/alt004/blast.wav
./Fallout/alt004/hum.wav
./Fallout/alt005/altchng.wav
./Fallout/alt005/blast.wav
./Fallout/alt005/hum.wav
./Fallout/alt006/altchng.wav
./Fallout/alt006/blast.wav
./Fallout/alt006/hum.wav
./Fallout/boot.wav
./Fallout/empty.wav
./Fallout/font.wav
./Fallout/maxcharge.wav
./Fallout/quote01.wav
./Fallout/tracks/wasteland.wav
here’s the button event code with the printouts:
// Crank to charge
case EVENTID(BUTTON_AUX, EVENT_FIRST_SAVED_CLICK_SHORT, MODE_ON):
PVLOG_DEBUG << "**** current_alternative BEFORE = " << current_alternative << "\n";
if (current_alternative == 6) {
hybrid_font.PlayCommon(&SFX_maxcharge);
return true;
} else {
PVLOG_DEBUG << "**** EFFECT_USER1 - Next Phase **\n";
SaberBase::DoEffect(EFFECT_USER1, 0);
PVLOG_DEBUG << "**** current_alternative AFTER = " << current_alternative << "\n";
}
return true;
// Trigger to fire
case EVENTID(BUTTON_POWER, EVENT_PRESSED, MODE_ON):
PVLOG_DEBUG << "**** current_alternative At BOOT = " << current_alternative << "\n";
if (current_alternative == 0) {
PVLOG_DEBUG << "**** No charge = EMPTY - No FIRE **\n";
SaberBase::DoEffect(EFFECT_EMPTY, 0);
} else {
PVLOG_DEBUG << "**** FIRE ****\n";
SaberBase::DoEffect(EFFECT_FIRE, 0);
ResetCurrentAlternative();
}
return true;
and then using this blade style:
StylePtr<Layers<Black,
ColorSelect<AltF,TrFadeX<Int<1000>>,
//Default
Black,
// 1 crank: 6%
Mix<Sin<Int<30>,Int<2000>>,Rgb<30,0,0>,Red>,
// 2 cranks: 18%
Mix<Sin<Int<50>,Int<6000>,Int<2500>>,Rgb<30,0,0>,Red>,
// 3 cranks: 31%
Mix<Sin<Int<85>,Int<10000>,Int<6800>>,Rgb<30,0,0>,Red>,
// 4 cranks: 44%
Mix<Sin<Int<150>,Int<14400>,Int<9200>>,Rgb<30,0,0>,Red>,
// 5 cranks: 52%
Mix<Sin<Int<240>,Int<17000>,Int<12000>>,Rgb<30,0,0>,Red>,
// 6 cranks: 64%
Mix<Sin<Int<400>,Int<21000>,Int<15000>>,Rgb<30,0,0>,Red>>,
// USER1 = next phase
TransitionEffectL<TrDoEffectAlwaysX<TrInstant,EFFECT_ALT_SOUND,ModF<Sum<AltF,Int<1>>,Int<7>>,Int<-1>>,EFFECT_USER1>,
// FIRE and reset to default phase
TransitionEffectL<TrConcat<TrInstant,TrDoEffectAlwaysX<TrInstant,EFFECT_ALT_SOUND,Int<0>,Int<-1>>,HumpFlicker<White,Black,100>,TrDelay<200>,TrFade<700>>,EFFECT_FIRE>>(),
powering on , trying to fire, then incrementing to max and firing gives this result (trimmed down to relevant messages):
10:57:56.815 -> Playing Fallout/alt000/hum.wav
10:57:56.980 -> EVENT: Power-Pressed ON millis=8491
10:57:56.980 -> **** current_alternative At BOOT = 0
10:57:56.980 -> **** No charge = EMPTY - No FIRE **
10:57:56.980 -> unit = 0 vol = 0.50, Playing Fallout/empty.wav
10:57:58.814 -> Playing Fallout/alt000/hum.wav
10:58:00.389 -> EVENT: Aux-SavedShortclick#1 ON millis=11924
10:58:00.389 -> **** current_alternative BEFORE = 0
10:58:00.389 -> **** EFFECT_USER1 - Next Phase **
10:58:00.389 -> **** current_alternative AFTER = 0
10:58:00.418 -> unit = 0 vol = 0.50, Playing Fallout/alt001/hum.wav
10:58:00.418 -> unit = 2 vol = 0.50, Playing Fallout/alt001/altchng.wav
10:58:01.825 -> EVENT: Aux-SavedShortclick#1 ON millis=13349
10:58:01.825 -> **** current_alternative BEFORE = 1
10:58:01.825 -> **** EFFECT_USER1 - Next Phase **
10:58:01.825 -> **** current_alternative AFTER = 1
10:58:01.825 -> unit = 1 vol = 0.50, Playing Fallout/alt002/hum.wav
10:58:01.825 -> unit = 3 vol = 0.50, Playing Fallout/alt002/altchng.wav
10:58:03.261 -> EVENT: Aux-SavedShortclick#1 ON millis=14780
10:58:03.261 -> **** current_alternative BEFORE = 2
10:58:03.261 -> **** EFFECT_USER1 - Next Phase **
10:58:03.261 -> **** current_alternative AFTER = 2
10:58:03.261 -> unit = 0 vol = 0.50, Playing Fallout/alt003/hum.wav
10:58:03.261 -> unit = 2 vol = 0.50, Playing Fallout/alt003/altchng.wav
10:58:04.898 -> EVENT: Aux-SavedShortclick#1 ON millis=16416
10:58:04.898 -> **** current_alternative BEFORE = 3
10:58:04.898 -> **** EFFECT_USER1 - Next Phase **
10:58:04.898 -> **** current_alternative AFTER = 3
10:58:04.898 -> unit = 1 vol = 0.50, Playing Fallout/alt004/hum.wav
10:58:04.898 -> unit = 3 vol = 0.50, Playing Fallout/alt004/altchng.wav
10:58:06.662 -> EVENT: Aux-SavedShortclick#1 ON millis=18203
10:58:06.662 -> **** current_alternative BEFORE = 4
10:58:06.694 -> **** EFFECT_USER1 - Next Phase **
10:58:06.694 -> **** current_alternative AFTER = 4
10:58:06.694 -> unit = 0 vol = 0.50, Playing Fallout/alt005/hum.wav
10:58:06.694 -> unit = 2 vol = 0.50, Playing Fallout/alt005/altchng.wav
10:58:08.689 -> EVENT: Aux-SavedShortclick#1 ON millis=20228
10:58:08.689 -> **** current_alternative BEFORE = 5
10:58:08.689 -> **** EFFECT_USER1 - Next Phase **
10:58:08.689 -> **** current_alternative AFTER = 5
10:58:08.721 -> unit = 1 vol = 0.50, Playing Fallout/alt006/hum.wav
10:58:08.721 -> unit = 2 vol = 0.50, Playing Fallout/alt006/altchng.wav
10:58:11.012 -> EVENT: Aux-SavedShortclick#1 ON millis=22543
10:58:11.012 -> **** current_alternative BEFORE = 6
10:58:11.012 -> unit = 0 vol = 0.50, Playing Fallout/maxcharge.wav
10:58:15.822 -> EVENT: Aux-SavedShortclick#1 ON millis=27358
10:58:15.823 -> **** current_alternative BEFORE = 6
10:58:15.823 -> unit = 0 vol = 0.50, Playing Fallout/maxcharge.wav
10:58:18.341 -> EVENT: Power-Pressed ON millis=29866
10:58:18.341 -> **** current_alternative At BOOT = 6
10:58:18.341 -> **** FIRE ****
10:58:18.341 -> unit = 0 vol = 0.50, Playing Fallout/alt006/blast.wav
10:58:18.341 -> unit = 2 vol = 0.50, Playing Fallout/alt000/hum.wav
10:58:18.372 -> unit = 3 vol = 0.50, Playing Fallout/alt000/altchng.wav
10:58:18.863 -> EVENT: Power-SavedShortclick ON millis=30375
10:58:20.334 -> Playing Fallout/alt000/hum.wav
10:58:21.644 -> EVENT: Power-Pressed ON millis=33173
10:58:21.644 -> **** current_alternative At BOOT = 0
10:58:21.644 -> **** No charge = EMPTY - No FIRE **
10:58:21.644 -> unit = 1 vol = 0.50, Playing Fallout/empty.wav
10:58:22.363 -> Playing Fallout/alt000/hum.wav
So the timing of the “AFTER” printout must just not be late enough in the runtime to pickup the change to the current_alternative, since the alt folder is incremented correctly, and the next button press printout of “BEFORE” shows the correct alt.
Just a weird timing thing I guess.
Anyway, it works. Thanks.