• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

JASS Message Linebreaks & BJs

Not open for further replies.



Level 40
Jan 7, 2005
Hi. I have a few questions about things working in JASS.

  • First: About line-breaks on text messages (not the actual script, but for using the BJDebugMSG for example). The "|n" does not appear to work.
  • Second: There are certain BJs that feel tempting to use.
    For example, the BJ function that fades in/out of the screen, appears to do a lot of the native typing for us.
    What do you recommend in these situations? Using natives or these BJ quick-functions?

Thank you for your time. Do not be afraid to answer.:razz:
Level 11
Aug 25, 2006
Ok for the first, I'd solve that by simply sending two messages.
function This takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,"This is on one line")
    call DisplayTextToPlayer(Player(0),0,0,"This is on the next line")

Not all the bj's are useless. Check them over for leaks first though.

Beware, some bj's are extremely inefficient and can be done in much less code.

For example, heres the bj for setting the value of a multiboard item:
function MultiboardSetItemValueBJ takes multiboard mb, integer col, integer row, string val 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
        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
                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 MultiboardSetItemValue(mbitem, val)
                    call MultiboardReleaseItem(mbitem)
It has one feature I don't need, the ability to set all values at the same time. Without this feature, it becomes much smaller.
    function MIB takes multiboard mb, integer col, integer row, string value returns nothing
    local multiboarditem mbitem
        set mbitem = MultiboardGetItem(mb, row -1, col -1)
        call MultiboardSetItemValue(mbitem, value)
        call MultiboardReleaseItem(mbitem)
        set mbitem = null
Level 19
Aug 24, 2007
Well there is an easy way for this
local string ENTER = "
call BJDebugMsg("You got"+ENTER+"PWN3D")
// well... Enter button creates a weird character inside text that carries text to down line (bad english)
// But still its a character and we can store it in a variable

About BJ's: I well dont like them
They are slow usualy, but running 50 functions in same thread doesnt seem to make lag,
so I dont have a real reason to say "Dont use them".
But there are good ones if you ask me:
- PanCameraTimedToPlayer (saves me from CnP'ing GetLocalPlayer etc)
- RectContainsCoords, RectContainsUnit (I love these ones)
- GroupAddGroup (pwnaz0rs)
Not open for further replies.