HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

an other bug : GetIssuedOrderId() return 0 in a boolexpr fillter (PlayerUnitEvent)

08-09-2008, 09:01 AM#1
Troll-Brain
I just want to report it.
Collapse JASS:
scope TestLameBug initializer init
   
    function UselessFilter takes nothing returns boolean
        call BJDebugMsg("fail")
        call BJDebugMsg("GetIssuedOrderId() == "+I2S(GetIssuedOrderId()))
        return false // what else ? :p
    endfunction
    
    public function init takes nothing returns nothing
        local trigger trig= CreateTrigger()
        
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_ORDER,Condition(function UselessFilter))
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,Condition(function UselessFilter))
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,Condition(function UselessFilter))
        
    call CreateUnit(Player(0),'hpea',0.0,0.0,0.0)
    endfunction
    
endscope
08-09-2008, 10:03 AM#2
Anitarf
Does it also return 0 if used as an actual condition with TriggerAddCondition, or as a filter in a GroupEnum? I'm asking because those are what we usualy use, not conditions added to the event like that. Have you confirmed that other event responses work in such a condition at all?
08-09-2008, 10:38 AM#3
Troll-Brain
Quote:
Originally Posted by Anitarf
Does it also return 0 if used as an actual condition with TriggerAddCondition, or as a filter in a GroupEnum? I'm asking because those are what we usualy use, not conditions added to the event like that. Have you confirmed that other event responses work in such a condition at all?

I only tried with the filter event.
I assumed it works for a condition and a group enum.

It works :

Collapse JASS:
scope TestCondition initializer init
   
    function Check takes nothing returns boolean
        call BJDebugMsg("GetIssuedOrderId() == "+I2S(GetIssuedOrderId()))
        return false
    endfunction
    
    public function init takes nothing returns nothing
        local trigger trig= CreateTrigger()
        
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null)
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null)
        call TriggerAddCondition(trig,Condition(function Check))
        
    call CreateUnit(Player(0),'hpea',0.0,0.0,0.0)
    endfunction
    
endscope

It works also for a GroupEnum.

Collapse JASS:
scope TestCondition initializer init
   
    function Check takes nothing returns boolean
        call BJDebugMsg("GetIssuedOrderId() == "+I2S(GetIssuedOrderId()))
        return false
    endfunction
    
    function Test takes nothing returns boolean
        local group g= CreateGroup()
        
        call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Condition(function Check))
        call DestroyGroup(g) // yeah i know i should create only once at the init, doesn't matter
        set g= null
        return false
    endfunction
    
    public function init takes nothing returns nothing
        local trigger trig= CreateTrigger()
        
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null)
        call TriggerRegisterPlayerUnitEvent(trig,Player(0),EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null)
        call TriggerAddCondition(trig,Condition(function Test))
        
    call CreateUnit(Player(0),'hpea',0.0,0.0,0.0)
    endfunction
    
endscope

And you are right, i can't read any Get as far i tested.
I know why blizzard don't use them now :p
08-09-2008, 10:40 AM#4
Captain Griffen
Interestingly, if you pause the unit, then the event responses stop working.
08-09-2008, 10:42 AM#5
Troll-Brain
Quote:
Originally Posted by Captain Griffen
Interestingly, if you pause the unit, then the event responses stop working.
For a condition or an enum filter ?
08-09-2008, 10:53 AM#6
Captain Griffen
Quote:
Originally Posted by Troll-Brain
For a condition or an enum filter ?

Condition; I think I also tested it with action. Didn't test with an enum.

Note the deviation from general Blizzard naming conventions. This implies that it was by different programmers, I think, and they balls it up.
08-09-2008, 11:00 AM#7
Troll-Brain
So it seems to using the conditions like they are not supposed to use is really unsafe, or at least there are many traps to know.
08-09-2008, 11:04 AM#8
DioD
Check any other event related returns, like GetTriggerUnit()
08-09-2008, 11:06 AM#9
Troll-Brain
Quote:
Originally Posted by DioD
Check any other event related returns, like GetTriggerUnit()
Already tried.
Quote:
Originally Posted by Troll-Brain
And you are right, i can't read any Get as far i tested.
It returns null.
08-09-2008, 11:24 AM#10
Captain Griffen
Quote:
Originally Posted by Troll-Brain
So it seems to using the conditions like they are not supposed to use is really unsafe, or at least there are many traps to know.

No. It doesn't. Using boolexprs on unit events is borked, we know that. Blizzard probably meant to implement it, and then didn't do it properly (hence why GUI makes no use of it?).

Nothing here indicates conditions, as opposed to unit event filters, are broken. What I reported with GetOrder stuff being broken after a pause also applies to actions - it's a bug with WC3 not storing the stuff in the stack properly, but probably storing a pointer to the unit or something.
09-06-2008, 08:15 PM#11
Troll-Brain
Just to say that GetFilterUnit() returns the TriggerUnit.
GetUnitCurrentOrder() works as well.