HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trace Systems

04-23-2004, 07:41 PM#1
JTG
TRACE SYSTEMS
These functions are the trace systems that can be EXTREMELY useful when
trying see how your functions progress within the game. There are three
differing types, each with thier own specific purposes.
1. BASIC:
- designed just to display a message to the user with some values
- starting with ^trace^ it will take the message and pass it on to
^trace1^ with a value of zero and progress through ^trace4^ with
values of zero for the inputs. In ^trace4^ it calls the message
function ^traceM^ which displays all the values in an easy to read
manner (more on how it does that in a sec)
2. CONDITIONAL:
- designed to display a message to the user with some values under the
condition that a requirement has been met (otherwise it ignores it).
This way it can display an error message if something fails but
won't display any message if it was successful.
- It progresses much in the same manner as the BASIC trace type with
one exception. When it reaches ^contrace4^ it calls the message
function ^traceM^ and passes it the requirement to display the
message.
3. ELSE:
- designed to display a message to the user with some values under the
condition that a requirement has been met. If the requirement was
NOT met, then it will display a DIFFERENT message. This way if you
wanted to see how far into a trigger the environment has progress
it can tell you that it went with one direction or another.
- It progresses much in the same manner as the BASIC trace type with
one exception. When it reaches ^traceelse4^ it calls the message
function ^traceM^ and passes it the requirement to display the FIRST
message, if it fails then it displays the SECOND message.

In the globals section IMMEDIATELY after constants
Collapse JASS:
    // trace add-in
    boolean            bj_trace_on                 = false
At the beggining of your custom script section in the map or at the end of Blizzard.j (before your custom script in there)
Collapse JASS:
//============================================================================
function traceM takes string message, string elsemsg, integer v1, integer v2, integer v3, integer v4, boolean req, boolean elsereq returns nothing
    if     bj_trace_on and req and     elsereq then
        call DisplayTextToForce(GetForceOfPlayer(Player(0)),"|n|cff32cd32Trace - |r" + message + ", " + I2S(v1) + ", " + I2S(v2) + ", " + I2S(v3) + ", " + I2S(v4))
    elseif bj_trace_on and req and not elsereq then
        call DisplayTextToForce(GetForceOfPlayer(Player(0)),"|n|cff32cd32Trace - |r" + elsemsg + ", " + I2S(v1) + ", " + I2S(v2) + ", " + I2S(v3) + ", " + I2S(v4))
    endif
endfunction
function trace4 takes string message, integer v1, integer v2, integer v3, integer v4 returns nothing
    call    traceM(message,"",v1,v2,v3,v4,true,true)
endfunction
function trace3 takes string message, integer v1, integer v2, integer v3 returns nothing
    call    trace4(message,   v1,v2,v3, 0     )
endfunction
function trace2 takes string message, integer v1, integer v2 returns nothing
    call    trace3(message,   v1,v2, 0        )
endfunction
function trace1 takes string message, integer v1 returns nothing
    call    trace2(message,   v1, 0           )
endfunction
function trace takes string message returns nothing
    call    trace1(message,    0              )
endfunction
function contrace4 takes string message, integer v1, integer v2, integer v3, integer v4, boolean req returns nothing
    call    traceM(message,"",v1,v2,v3,v4, req,true)
endfunction
function contrace3 takes string message, integer v1, integer v2, integer v3, boolean req returns nothing
    call contrace4(message,   v1,v2,v3, 0, req)
endfunction
function contrace2 takes string message, integer v1, integer v2, boolean req returns nothing
    call contrace3(message,   v1,v2, 0,    req)
endfunction
function contrace1 takes string message, integer v1, boolean req returns nothing
    call contrace2(message,   v1, 0,       req)
endfunction
function contrace takes string message, boolean req returns nothing
    call contrace1(message,    0,          req)
endfunction
function traceelse4 takes string message, string elsemsg, integer v1, integer v2, integer v3, integer v4, boolean elsereq returns nothing
    call     traceM(message,elsemsg,v1,v2,v3,v4,true,elsereq)
endfunction
function traceelse3 takes string message, string elsemsg, integer v1, integer v2, integer v3, boolean elsereq returns nothing
    call traceelse4(message,elsemsg,v1,v2,v3, 0,elsereq)
endfunction
function traceelse2 takes string message, string elsemsg, integer v1, integer v2, boolean elsereq returns nothing
    call traceelse3(message,elsemsg,v1,v2, 0,   elsereq)
endfunction
function traceelse1 takes string message, string elsemsg, integer v1, boolean elsereq returns nothing
    call traceelse2(message,elsemsg,v1, 0,      elsereq)
endfunction
function traceelse  takes string message, string elsemsg, boolean elsereq returns nothing
    call traceelse1(message,elsemsg, 0,         elsereq)
endfunction
//============================================================================
09-23-2007, 08:44 PM#2
Pyrogasm
I'm sure this is freakin' outdated... but I'm completely flummoxed. What is all this trace stuff supposed to do?