- Joined
- Feb 27, 2007
- Messages
- 5,578
Anyone know how to do this? A bug/trick or some special combination of timers and .execute()s or whatever is all fine. If there's a way to hook something into the internal screen refresh call that would be cool. I know I could just use a 0.1 timeout timer or something but I'd like the delay to be as short as possible.
I want to do this because the UI needs 1 frame to update after selecting a unit, enabling a spell for a player, or adding a spell to a unit before it appears on the command card UI and will thus work with ForceUIKey.
Thoughts?
I want to do this because the UI needs 1 frame to update after selecting a unit, enabling a spell for a player, or adding a spell to a unit before it appears on the command card UI and will thus work with ForceUIKey.
JASS:
globals
unit u = SetSomewhere()
player p = SetSomewhereElse()
integer a = 'A000'
string hky = "f"
endglobals
function myfunc takes nothing returns nothing
call UnitAddAbility(u, a)
// Neither works without delaying by 1 frame
// call SetPlayerAbilityAvailable(p, a, true)
if GetLocalPlayer() == p then
call SelectUnit(u, true)
// This is where it would go
call DelayByFrames(1)
// ^^^
call ForceUIKey(hky)
endif
endfunction
//
// Something in this vein is also acceptable:
//
globals
unit u = SetSomewhere()
player p = SetSomewhereElse()
integer a = 'A000'
string hky = "f"
endglobals
function Press takes nothing returns nothing
if GetLocalPlayer() == p then
call ForceUIKey(hky)
endif
endif
function myfunc takes nothing returns nothing
call UnitAddAbility(u, a)
// Neither works without delaying by 1 frame
// call SetPlayerAbilityAvailable(p, a, true)
if GetLocalPlayer() == p then
call SelectUnit(u, true)
// This is where it would go
call Press.executeAfterFrames(1)
// ^^^
endif
endfunction
Thoughts?