• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

What is BJ?

Status
Not open for further replies.
Level 13
Joined
Jan 2, 2016
Messages
978
I've noticed that in custom scripts / Jass there are normal functions and functions with "BJ" in the end. Can anyone explain what's the difference?
When I tried to do "call FlushChildHashtable( GetHandleId(udg_Temp_Unit), udg_Table )" - I got an error. But "call FlushChildHashtableBJ( GetHandleId(udg_Temp_Unit), udg_Table )" works...
So what's the difference?
 
BJs usually just rearranges, or even removes, parameters, and then calls the non-bj version:

JASS:
function IsUnitAliveBJ takes unit whichUnit returns boolean
    return not IsUnitDeadBJ(whichUnit)
endfunction

JASS:
function IsUnitDeadBJ takes unit whichUnit returns boolean
    return GetUnitState(whichUnit, UNIT_STATE_LIFE) <= 0
endfunction


Other times they just hide larger pieces of code:
JASS:
function MultiboardSetItemWidthBJ takes multiboard mb, integer col, integer row, real width returns nothing
    local integer curRow = 0
    local integer curCol = 0
    local integer numRows = MultiboardGetRowCount(mb)
    local integer numCols = MultiboardGetColumnCount(mb)
    local multiboarditem mbitem = null

    // Loop over rows, using 1-based index
    loop
        set curRow = curRow + 1
        exitwhen curRow > numRows

        // Apply setting to the requested row, or all rows (if row is 0)
        if (row == 0 or row == curRow) then
            // Loop over columns, using 1-based index
            set curCol = 0
            loop
                set curCol = curCol + 1
                exitwhen curCol > numCols

                // Apply setting to the requested column, or all columns (if col is 0)
                if (col == 0 or col == curCol) then
                    set mbitem = MultiboardGetItem(mb, curRow - 1, curCol - 1)
                    call MultiboardSetItemWidth(mbitem, width/100.0)
                    call MultiboardReleaseItem(mbitem)
                endif
            endloop
        endif
    endloop
endfunction
 
Level 11
Joined
Dec 19, 2012
Messages
411
BJ stands for Blizzard Jass, all BJs functions are located inside blizzard.j

JASS:
function FlushChildHashtableBJ takes integer missionKey, hashtable table returns nothing
    call FlushChildHashtable(table, missionKey)
endfunction
This is a BJ function.

native FlushChildHashtable takes hashtable table, integer parentKey returns nothing
This is a native function.


Hopefully this could clears up your thought.

EDIT : ^ 1 minute after you :O
 
Level 12
Joined
May 22, 2015
Messages
1,051
I often refer here to see the blizzard.j code.
http://jass.sourceforge.net/doc/api/Blizzard_j-source.shtml

In all (maybe not all?) cases, it is better to replace the BJ (and sometimes Swapped) functions with native functions.
http://wiki.thehelper.net/wc3/jass/common.j

Some get really complicated, so you can skip over them until you are more comfortable with it (or you could skip it all until you are comfortable with it).

The order of the parameters in the BJ functions usually match the order shown in the wording when you are using the GUI to make triggers. In most cases, this ends up with the parameters in the exact reverse order lol.
 
Status
Not open for further replies.
Top