That was the initial situation.
I used this simple coding
Code:
function aftercast(spell,action)
if buffactive['Sublimation: Activated'] == true then
equip(sets.Idle.Sublimation)
else
equip(sets.Idle)
end
end
It WAS working, except in one situation: the moment I activate Subli.
I could have solved the issue very simply creating a precast rule for Subli, but came here lookin for guidance regardless.
Thanks to the replies of other people I found out a bigger issue which was concerning not just Subli, but some other stratagems rules where I had buffactive checks.
So I kinda changed my aftercast and added a buff_change, and in the end they looked like this:
Code:
function aftercast(spell,action)
if not spell.interrupted then
if state.Buff[spell.name] ~= nil then
state.Buff[spell.name] = true
end
end
if state.Buff['Sublimation: Activated'] == true then
equip(sets.Idle.Sublimation)
else
equip(sets.Idle)
end
end
function buff_change(buff,gain)
if state.Buff[buff] ~= nil then
state.Buff[buff] = gain
if state.Buff['Sublimation: Activated'] == true then
equip(sets.Idle.Sublimation)
else
equip(sets.Idle)
end
end
end
This DOES work, everytime, even the second I activate Subli, it automatically changes when it's fully charged and so on.
So you could say I had solved my problems. But the thing is that even without fully understanding those lines of code, I was getting a hunch that something wasn't perfect, that there were some useless lines, some redundancy.
Aftercast was ==> assigning "true" to booleans on the use of JAs, handling my aftercast idle sets with a check on the boolean instead than buffactive
Buffchange was ==> assigning "true" or "false" to the same booleans according to buff gained or lost, equipping my idle sets with a check on the boolean.
So... Aftercast alone wasn't enough because I needed something to set booleans to "false" (otherwise they would have stayed on "true" endlessly once activated the first time). Buff_change was doing that, but it was also doing the "true" part a second time, and that was redundant.
Having if-then-equip in both functions was also useless and redundant.
I was confused by this, and came here to solve it. But it was just a matter of creating better code with less redundancy, because result-wise I had already reached my goal. (not with my own two hands of course

)