Static if problem

Executor

I see you
Reaction score
57
Hi

JASS:
    private static constant boolean     INVERT_ABILITIES    = true
    
    private static method onInit takes nothing returns nothing
        static if not thistype.INVERT_ABILITIES then
            local string    s   = .NORMAL_HOTKEY
            local integer   i   = .NORMAL_ABIL
            
            set .NORMAL_ABIL    = .SPECIAL_ABIL
            set .SPECIAL_ABIL   = i
        
            set i               = .NORMAL_ORDER
            set .NORMAL_ORDER   = .SPECIAL_ORDER
            set .SPECIAL_ORDER  = i
            
            set .NORMAL_HOTKEY  = .SPECIAL_HOTKEY
            set .SPECIAL_HOTKEY = s
            
            set s = ""
            
            call BJDebugMsg("TRUE")
        endif
        if .INVERT_ABILITIES then
            call BJDebugMsg("TRUE")
        else
            call BJDebugMsg("FALSE")
        endif 
    endmethod


When the bool is true ingame is returned "TRUE" "TRUE"
When the bool is false ingame is returned "TRUE" "FALSE"

lol?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Use thistype on both ifs, it might work.
Read the JassHelper documentation i think thistype is mandatory.
 

Executor

I see you
Reaction score
57
Well but this won't solve the problem why the static if is printed even when the bool is true.
Or rather I added this "not" because else the static if NEVER gets printed even when the bool is true ..
 

Romek

Super Moderator
Reaction score
963
Perhaps this has something too do with having local variables in the static if?
Just a wild guess here, but try moving them outside the if.
 

Executor

I see you
Reaction score
57
Didn't help. Hm solved this case for me by just removing the static and copying the local vars above the if. I already removed the "constant" from these "constants" so, here is no difference.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top