Do DebugMsgs show ingame?

PurgeandFire

zxcvmkgdfg
Reaction score
509
Yeah. Unless you put the keyword [ljass]debug[/ljass] before it, then it will only show up when debug mode is enabled.
 

shiFt

Member
Reaction score
8
So this will not show on bnet games? BJDebugMsg, shows for me obv in testmap mode
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
BJDebugMsg's show in game and on BNet. They are just like normal messages if you see what it is composed of. :)
JASS:
function BJDebugMsg takes string msg returns nothing
    local integer i = 0
    loop
        call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYERS
    endloop
endfunction


If you add the [ljass]debug[/ljass] keyword before it, it will only appear when debug mode is enabled and you are testing the map from the editor.
 

Romek

Super Moderator
Reaction score
963
You should only use [ljass]BJDebugMsg[/ljass] for debugging any problems in your code, and checking if things are running well. Once you're happy with the code, you should remove them. Any messages to be shown to players should be done with the other natives with more options.
Any release versions of your map shouldn't use it.
 

Sevion

The DIY Ninja
Reaction score
413
I choose to do this:

JASS:
debug function DebugMsg takes string s returns nothing
    debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, s)
debug endfunction


A bit cleaner and more efficient.

Also a little easier to type ;)

Then, whenever you are developing, save and test in Debug mode. When you're publishing? Save and distribute in default mode.
 

Romek

Super Moderator
Reaction score
963
> A bit cleaner and more efficient.
Efficiency matters in displaying a debug message?

> Also a little easier to type
It doesn't work with Autocomplete. BJD + Enter is easier, I think. :p

You should always delete debug messages when they're no longer needed, even if they're in 'debug mode'. You don't want to get swarmed with unnecessary debug messages whilst debugging something important, do you?
 

Sevion

The DIY Ninja
Reaction score
413
1. Yus. I cares about efficiency in debug :3 It could throw off your efficiency tests when testing efficiency for other things in Debug Mode :3 (lolz jk jk)

2. Meh. Make it Msg then :p The name is changeable.

3. True. But I usually use this more for showing errors and warnings when making systems. I.E. passing null arguments or out of bounds.
 

DioD

New Member
Reaction score
57
NEVER remove debug information from your code, you must keep comments and debug info permanently.

You cannot be 100% sure, is code free from any errors.

Debug keywork is useless in most cases, since you cant ON\OFF debug more runtime, better use function with option to display or not display messages, but track event anyway, this does not drain performance, but will help you if you encounter problems, since you can turn debug display at any time.
 

Sevion

The DIY Ninja
Reaction score
413
Having trouble understanding parts of your post.

"cant ON\OFF debug more runtime"??
 

Romek

Super Moderator
Reaction score
963
> True. But I usually use this more for showing errors and warnings when making systems. I.E. passing null arguments or out of bounds.
Ahh, that's fine.

> NEVER remove debug information from your code, you must keep comments and debug info permanently.
Comments, yes. Debug stuff, no. There comes a point at which you probably don't care whether or not a unit spawned successfully every 0.6 seconds, or what angle X unit is facing. Unless you're talking about this in a similar context to Sevion (finding potential causes of errors (eg. null structs being passed around), and displaying that); In which case I agree.
 

DioD

New Member
Reaction score
57
JASS:
set displaydebug = true
set displaydebug = false

this is runtime on\off

if you encounter something strange ingame, you able to turn debug on at any time.

if you are using debug keywork, you have no chance to do it.

also with a bit of skill, you may always force debug output for replays, or debug output for yourself only (by nickname).
There is no reason to keep debug on unit creation or something similar, but struct fails, null handles and similar stuff MUST always provide debug output.

JASS:
function DebugMsg takes string s returns nothing
if displaydebug then
     call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, s)
endif
endfunction

if localplayer = triggerplayer
set displaydebug = true
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top