Originally Posted by zork
My newstate returns strings. I do not work with preset actionpage numbers.
|
Each macro condition is associated with a specific bar. When your macro condition triggers a new state, it calls your attribute and tells it which bar is now active.
If you use a condition like [form:1] form1; [form:2] form2; [form:3] form3; [form:4] form4, you don't need the api function to check which form you're in because it's being passed via newstate to your attribute.
This is good, because GetShapeshiftForm() is generally wrong about what form you're shifting into when the condition fires and returns the form that you're shifting out of due to the order of events.
You can
try it yourself by making a druid on the beta, I wouldn't be surprised if other conditions are also capable of firing before the api function returns valid data.
Lua Code:
local driver = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
RegisterStateDriver(driver, 'form', '[noform]0;[form:1]1;[form:2]2;[form:3]3;[form:4]4')
driver:SetAttribute('_onstate-form', "print('_onstate-form:', newstate, 'GetShapeshiftForm:', GetShapeshiftForm())")