• 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.

DebugLog v1.2

  • DebugLog v1.0
  • By Me,Almia
  • What does this do?
    • If you want to view the debug messages outside warcraft,use this.This records the debugs messages you want,but it wont appear in-game.The debug messages then will be created inside a text document found in a folder path w/c can be configured inside.The messages will be recorded w/ their time of execution.
  • The Trigger:

    • DebugLog
      • Events
        • Map initialization
      • Conditions
      • Actions
        • -------- ------------------------------------------------------------ --------
        • -------- ------------------------------------------------------------ --------
        • -------- DEBUG LOG --------
        • -------- ------------------------------------------------------------ --------
        • -------- ------------------------------------------------------------ --------
        • -------- Records all messages (not the ones that spawn in the screen) --------
        • -------- as debug messages then adds it into a text document w/c is created --------
        • -------- ------------------------------------------------------------ --------
        • -------- ------------------------------------------------------------ --------
        • -------- ------------------------------------------------------------ --------
        • -------- CONFIGURATION --------
        • -------- ------------------------------------------------------------ --------
        • -------- ------------------------------------------------------------ --------
        • -------- Below,determines the folder path where you --------
        • -------- are going to save the document --------
        • -------- ------------------------------------------------------------ --------
        • Set DL_SavePath = Map Errors\\
        • Set DL_MapName = MyMap
        • -------- ------------------------------------------------------------ --------
        • -------- Below,allows you to auto-update or create the document --------
        • -------- ------------------------------------------------------------ --------
        • Set DL_Auto = False
        • -------- ------------------------------------------------------------ --------
        • -------- Below,the interval value where it will record all messages --------
        • -------- ------------------------------------------------------------ --------
        • Set DL_Int = 0.03
        • -------- ------------------------------------------------------------ --------
        • -------- END --------
        • -------- ------------------------------------------------------------ --------
        • Custom script: call ExecuteFunc("DL_OnInit")
        • Custom script: endfunction
        • -------- ------------------------------------------------------------ --------
        • -------- LogAdd --------
        • -------- ------------------------------------------------------------ --------
        • -------- Records the debug msg you want to add --------
        • -------- ------------------------------------------------------------ --------
        • -------- Recquires : DL_Msg --------
        • -------- ------------------------------------------------------------ --------
        • Custom script: function DL_LogAdd takes nothing returns nothing
          • Custom script: local string sec = I2S(udg_DL_Sec)
          • Custom script: local string msec = I2S(udg_DL_MSec)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DL_Sec Less than 10
            • Then - Actions
              • Custom script: set sec = "0" + sec
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DL_MSec Less than 10
            • Then - Actions
              • Custom script: set msec = "0" + msec
            • Else - Actions
          • Custom script: set udg_DL_Log[udg_DL_Index] = "[ " + I2S(udg_DL_Mins) + " : " + sec + " : " + msec + " ] : " + udg_DL_Msg + "\r\n\t"
          • Set DL_Index = (DL_Index + 1)
        • Custom script: endfunction
        • -------- ------------------------------------------------------------ --------
        • -------- LogClear --------
        • -------- ------------------------------------------------------------ --------
        • -------- Clears all recorded logs --------
        • -------- ------------------------------------------------------------ --------
        • Custom script: function DL_LogClear takes nothing returns nothing
          • Custom script: local integer i = 0
          • Custom script: loop
          • Custom script: exitwhen i > udg_DL_Index
          • Custom script: set udg_DL_Log[i] = ""
          • Custom script: set i = i + 1
          • Custom script: endloop
          • Set DL_Index = 0
        • Custom script: endfunction
        • -------- ------------------------------------------------------------ --------
        • -------- LogUpdate --------
        • -------- ------------------------------------------------------------ --------
        • -------- Updates or creates the text document --------
        • -------- which all of the msgs recorded are inside --------
        • -------- ------------------------------------------------------------ --------
        • Custom script: function DL_LogUpdate takes nothing returns nothing
          • Custom script: local integer i = 0
          • Custom script: call PreloadGenClear()
          • Custom script: call PreloadGenStart()
          • Custom script: loop
          • Custom script: exitwhen i > udg_DL_Index
          • Custom script: call Preload("\")\r\n\t" + udg_DL_Log[i] + "\r\n\t(\"")
          • Custom script: set i = i + 1
          • Custom script: endloop
          • Custom script: call PreloadGenEnd(udg_DL_SavePath + udg_DL_MapName +" - DebugLog.txt")
        • Custom script: endfunction
        • -------- ------------------------------------------------------------ --------
        • -------- TimeBuffer --------
        • -------- ------------------------------------------------------------ --------
        • -------- Records minutes , seconds and deciseconds --------
        • -------- ------------------------------------------------------------ --------
        • Custom script: function DL_TimeBuffer takes nothing returns nothing
          • Set DL_MSec = (DL_MSec + (Integer((DL_Int x 100.00))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DL_MSec Greater than 99
            • Then - Actions
              • Set DL_MSec = (DL_MSec - 100)
              • Set DL_Sec = (DL_Sec + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DL_Sec Greater than 59
                • Then - Actions
                  • Set DL_Sec = 0
                  • Set DL_Mins = (DL_Mins + 1)
                • Else - Actions
            • Else - Actions
        • Custom script: endfunction
        • -------- ------------------------------------------------------------ --------
        • -------- Initialize --------
        • -------- ------------------------------------------------------------ --------
        • Custom script: function DL_OnInit takes nothing returns nothing
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DL_Auto Equal to True
            • Then - Actions
              • Custom script: call TimerStart(CreateTimer(),udg_DL_Int,true,function DL_LogUpdate)
            • Else - Actions
          • Custom script: call TimerStart(CreateTimer(),udg_DL_Int,true,function DL_TimeBuffer)
  • How to use?
    • declare the variable DL_Msg then put the path of the message.Then use the custom script then call ExecuteFunc("DL_LogAdd") to record the message.
    • If you want to create the text document,call ExecuteFunc("DL_LogUpdate") then find the folder where you want the text document to be created.
    • You can configure the folder path in the configuration function of the system.The variable is named DL_SavePath.
    • Example:

      • Example
        • Events
          • Unit - A unit Is attacked
        • Conditions
        • Actions
          • Set DL_Msg = (((Name of (Owner of (Attacking unit))) + ('s + (Name of (Attacking unit)))) + ( attacks + ((Name of (Triggering player)) + ('s + (Name of (Triggering unit))))))
          • Custom script: call ExecuteFunc("DL_LogAdd")
          • Game - Display to (All players) the text: DL_Msg
          • -------- Example of updating --------
          • Set I = (I + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • I Equal to 10
            • Then - Actions
              • Custom script: call ExecuteFunc("DL_LogUpdate")
              • Game - Display to (All players) the text: Created Text Docume...
              • Set I = 0
            • Else - Actions
      In the example,the system records the attackers name and the attacked unit's name w/ their player owner's name.Once the example integer reaches 10,it will create the text document.
  • Credits
    -Magtheridon96 w/c helps me a lot to debug my unfixable spell :D
    -Geries for an awesome help :D
    -Doctor Gester for the original script
  • Changelogs
    -Fixed math on GUI version
    -Optimized code(I love you Geries for this :D)
Contents

Debug Log v1.2 (Map)

Reviews
DebugLog v1.2 - Reviewed by Maker - 15th Feb 2013 Approved I used it to write a log of the actual crit chance of Critical Strike, it works as advertized and is useful for debugging.

Moderator

M

Moderator


DebugLog v1.2 - Reviewed by Maker - 15th Feb 2013
Approved

I used it to write a log of the actual crit chance of Critical Strike,
it works as advertized and is useful for debugging.
[td]
[/td]
 
Level 13
Joined
Sep 13, 2010
Messages
550
I suggest you to change \n into \r\n\t so newlines will appear properly in notepad.

Also, since we already have the same in the Jass Section, you shall make your code unique or something: I suggest you to change your script to be able to handle more than one debug log files, for instance every system could have its own debug log at its own specified path, but you can still have a map specified instance( at ID 1 or something ) which every script can use. Also you should have some limitations for string length, or make it auto break the strings into 240 sized parts so long messages won't get cropped. Last but not least, change the path of the output at config not to "C:\\" but to "Map Errors\\Log.txt" so it will output it to C:\\Blabla\Warcraft III\Map Errors\Log.txt. Also you might want to make the output file name configurable, so overwriting other's dumps will less likely happen.
 
Top