• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] Needs some tester

Status
Not open for further replies.
Because i don't have WE/JNGP in this PC and my other PC was so far to this location,can i ask somebody to test this WIP?
JASS:
library DebugLog /* v1.0
*************************************************************************************
*
*    Allows you to print messages in Warcraft 3 In-Game and writes them
*    inside a .bat file. Run the .bat file and it will download the text document
*    where the messages are written. The messages will be written along with the 
*    elapsed game time. All .bat files will go to Warcraft 3\\Map Errors\\DebugLog
*    folder.
*
*************************************************************************************
*
*    API
*
*    Struct Log extends array
*
*        static method add takes string s returns nothing
*        - Prints the messages(if ALLOW_PRINT is true) and writes it in the .bat file
*
*        static method clear takes nothing returns nothing
*        - Clears all written messages
*
*        static method update takes nothing returns nothing
*        - Creates the .bat file
*
*        private static method buffer takes nothing returns nothing
*        - Autocreates the file (and updates the document) every 0.031250000 timeout
*
*************************************************************************************
*
*    Settings
*
************************************************************************************/
    globals
/************************************************
*
*   Map Name
*   ------------------------------------------
*       Put the map's name here.
*       This is for you to easily find where
*       the log is.
*
************************************************/
        private constant string MAP_NAME = "YourMap"
/************************************************
*
*    Folder
*   ------------------------------------------
*       This is where the log will be created
*       Recommended not to be touched
*
************************************************/
        private constant string LOG_FOLDER = "Map Errors\\DebugLogs\\"
/************************************************
*
*    Allow Print
*   ------------------------------------------
*       Allows you to print messages in-game not
*       just outside.
*
************************************************/
        private constant boolean ALLOW_PRINT = false
/************************************************
*
*    Allow Auto-Update
*   ------------------------------------------
*       Allows you to update the document
*       automatically.
*
************************************************/
        private constant boolean ALLOW_AUTO = true
    endglobals
/*************************************************************************************
*
*    Credits
*
*        Doctor Gester
*        Magtheridon96
*        Geries
*        Nestharus
*
*************************************************************************************/    
    globals
        private string array l
        private integer i = 0
        private timer t = CreateTimer()
        private integer mil = 0
        private integer sec = 0
        private integer min = 0
        private string lastRecorded
    endglobals
    
	/*****************************************************
	*
	*   Document Header
	*
	******************************************************/
    private function Header takes nothing returns nothing
	    call Preload("\")\r\n\t echo  ************************************************************************************* >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
        call Preload("\")\r\n\t echo  *     Warcraft 3 Debug Log                                                            >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *         Logs of " + MAP_NAME + "                                                    >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *     --------------------------------------------------------------------------      >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
        call Preload("\")\r\n\t echo  *         Statistics:                                                                 >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *         ------------------------------------------                                  >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
        call Preload("\")\r\n\t echo  *             Number of Lines : " + I2S(i) + "                                        >> " + MAP_NAME + "Log.txt \r\n\t(\"")
        call Preload("\")\r\n\t echo  *             Last Recorded Time : " + lastRecorded + "                               >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
        call Preload("\")\r\n\t echo  *    --------------------------------------------------------------------------       >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
        call Preload("\")\r\n\t echo  *             Time:                               Message:                            >> " + MAP_NAME + "Log.txt \r\n\t(\"")
		call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
    endfunction
    
    private module Init
        private static method onInit takes nothing returns nothing
            call init()
        endmethod
    endmodule
    
    struct Log extends array
        static method add takes string s returns nothing
            local string mils = I2S(mil)
            local string secs = I2S(sec)
            if mil < 10 then
                set mils = "0" + mils
            endif
            if sec < 10 then
                set secs = "0" + secs
            endif
            set lastRecorded = "[ " + I2S(min) + " : " + secs + " : " + mils + " ]"
            set l[i] = "echo *        " + lastRecorded + " : " + s + ">> " + MAP_NAME + "Log.txt "
            if ALLOW_PRINT then
                call BJDebugMsg(s)
            endif
            set i = i + 1
        endmethod
        
        static method clear takes nothing returns nothing
            local integer id = 0
            loop
                exitwhen i == id
                set l[id] = ""
                set id = id + 1
            endloop
            set i = 0
        endmethod
        
        static method update takes nothing returns nothing
            local integer id = 0
            call PreloadGenClear()
            call PreloadGenStart()
            call Header()
            loop
                exitwhen id == i
                call Preload("\")r\n\t"+ l[i] + "\r\n\t(\"")
                set id = id + 1
            endloop
			call Preload("\")\r\n\t echo  *                                                                                     >> " + MAP_NAME + "Log.txt \r\n\t(\"")
			call Preload("\")\r\n\t echo  ************************************************************************************* >> " + MAP_NAME + "Log.txt \r\n\t(\"")
            call Preload("\")\r\n\t start " + MAP_NAME + "Log.txt\r\n\t(\"")
            call PreloadGenEnd(LOG_FOLDER + "Download" + MAP_NAME + "Log.bat")
        endmethod
        
        private static method buffer takes nothing returns nothing
            set mil = mil + R2I(0.031250000 * 100)
            if mil > 99 then
                set mil = 0
                set sec = sec + 1
                if sec > 59 then
                    set sec = 0
                    set mil = mil + 1
                endif
            endif
			if ALLOW_AUTO then
			    call Log.update()
			endif
        endmethod
        
        private static method init takes nothing returns nothing
            call TimerStart(t, 0.031250000, true, function Log.buffer)
        endmethod
        
        implement Init
    endstruct
endlibrary
 
Last edited:
Level 19
Joined
Aug 8, 2007
Messages
2,765
JASS:
            set mil = mil + R2I(0.031250000 * 100)

?

JASS:
            set mil = mil + 3

both perform the same function and the second one is faster, though im not really sure what your trying to accomplish with this statement.

Also, what is the purpose of writing a .bat? Why not just write the .txt?
 
Status
Not open for further replies.
Top