Snippet 's] A Couple Fun 'Tools'

WolfieeifloW

WEHZ Helper
Reaction score
372
TSA And Spawn Testing
By: Wolfie[NoCT]


I've been playing around the past few days;
Just practicing things.

It started off with making a test for TriggerSleepAction().
I hated having to exit WC3, change stuff, then test again so I added a function to allow me to change things in-game.
This turned into me making everything customizable in-game.
I then made a cool little spawn/kill testing map.

I decided to post these for people to play around with.
Trigger Forewarning said:
This is not meant to be a "serious" project or anything;
It's just for fun to play around with.

Anyways, here they are...
TSA Testing
Spawn Testing
I had to split it into two posts because it was too long as one.



TSA Testing
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |                -=-=- TSA Test [v1.0] -=-=-                 |
// |                -=-=- By Wolfie[NoCT] -=-=-                 |
// |              Requires Jass NewGen and ColorIt              |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   A TSA test; Well...That's what this started out as. It   |
// |      quickly turned into a map with a thousand different   |
// |         in-game customizable things. Either way; It's a    |
// |            fun little map to play around with; Try it out! |
// |                                                            |
// +------------------------------------------------------------+
// |   -=-=- Things To Fix -=-=-                                |
// |      -Telling user there's a loop in progress              |
// +------------------------------------------------------------+
// |   -=-=- Version History -=-=-                              |
// |                                                            |
// |      Version 1.0                                           |
// |         - Initial release                                  |
// |                                                            |
// +------------------------------------------------------------+
scope TSATest initializer TTInit

// +---------------------------------+
// |     -=-=- MODIFY HERE -=-=-     |
// |     -=-=- MODIFY HERE -=-=-     |
// |     -=-=- MODIFY HERE -=-=-     |
// +---------------------------------+
    globals
        private real INTERVAL = 0.01            //Initial TSA interval
        private integer LOOPS = 25              //Initial amount of loops
        private integer DOTNUM = 15             //Initial amount of dots before reset        
        private string LOOPMSG = "Running loop" //Message to display while loop is running
        private string XCOL = "gold"            //Initial 'X' color
        private string CCOL = "red"             //Initial command color
        private string MAPCOL = "cyan"          //Initial map name color
        private string NAMESCOL = "gold"        //Initial name color
        private string NUMCOL = "green"         //Initial number color
        private constant integer COLORSNUM = 10 //Number of colors in COLORS array
        
        //Don't touch this!
        private string array COLORS//Don't touch this!
        //Don't touch this!
    endglobals
    
// +------------------------------+
// |     Initiation of colors     |
// +------------------------------+
    private function COLORInit takes nothing returns nothing
        set COLORS[0] = "red"
        set COLORS[1] = "gold"
        set COLORS[2] = "cyan"
        set COLORS[3] = "blue"
        set COLORS[4] = "brown"
        set COLORS[5] = "grey"
        set COLORS[6] = "gray"
        set COLORS[7] = "green"
        set COLORS[8] = "orange"
        set COLORS[9] = "pink"
        //set COLORS[10] = ""
        
        //Make sure to change "COLORSNUM" to the amount of array slots used
    endfunction
        
// +------------------------------------------+
// |     -=-=- NO TOUCHIE PAST HERE -=-=-     |
// |     -=-=- NO TOUCHIE PAST HERE -=-=-     |
// |     -=-=- NO TOUCHIE PAST HERE -=-=-     |
// +------------------------------------------+
    globals
        private real array BIG
        private real array SMALL
        private real array OFFSET
        private real array INT
        private boolean array ABORTED
        private integer array LOOPARRAY
        private integer RT = 0
        private integer I = 0
        private boolean STOPPED = false
    endglobals
    

//==========================================================
//==========          "Useful" Functions          ==========
//==========================================================
// +---------------------------------+
// |     Check if color is valid     |
// +---------------------------------+
    private function CheckColor takes string Col returns boolean
        local integer i = 0
        local boolean cc = false
        
        loop
        exitwhen i == COLORSNUM
            if (Col != COLORS<i>) then //If the current looped color doesn&#039;t equal a known one
                set cc = false         //Keep boolean false
            else              //If it is known
                return true   //Return true
            endif
            set i = i + 1
        endloop
        return cc //Will only occur if input color is not known; AKA will return false
    endfunction
    
//=========================================================================================================
//==========          The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=-          ==========
//==========          The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=-          ==========
//==========          The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=-          ==========
//=========================================================================================================
    
//=========================================================
//==========          TSA Test Function          ==========
//=========================================================
    private function TTActions takes nothing returns nothing
        local real array gt
        local real big = 0
        local real small = 0
        local real array offset
        local string loopmsg = LOOPMSG
        
        if (I == 0) then //Check if loop is currently running already or not
            loop
            exitwhen I == LOOPS
                set gt<i> = GetFloatGameState(GAME_STATE_TIME_OF_DAY)         //Get current time
                call TriggerSleepAction(INTERVAL)
                set gt<i> = GetFloatGameState(GAME_STATE_TIME_OF_DAY) - gt<i> //Get time after wait
                if (gt<i> &gt; gt[I - 1]) then //Setting of big to the largest wait
                    set big = gt<i>
                elseif (gt<i> &lt; gt[I - 1]) then //Setting of small to the smallest wait
                    set small = gt<i>
                endif
                if (ModuloInteger(I, DOTNUM + 1) == 0) then
                    set loopmsg = LOOPMSG           //Making the string telling the
                else                                //User the loop is running reset the
                    set loopmsg = loopmsg + &quot;.&quot;     //Dots if it gets to the specified amount
                endif
                call ClearTextMessages()
                call BJDebugMsg(loopmsg) //Shows the loop message
                set I = I + 1
            endloop
            set offset[0] = INTERVAL - small      //
            set offset[1] = big - INTERVAL        //
            if (offset[0] &gt; offset[1]) then       //Setting of the largest
                set offset[3] = offset[0]         //Offset that occured
            elseif (offset[0] &lt; offset[1]) then   //Throughout the entire
                set offset[3] = offset[1]         //Looping
            else                                  //
                set offset[3] = offset[0]         //
            endif
            set BIG[RT] = big //Set BIG at the current results
            set SMALL[RT] = small //Set SMALL at the current results
            set OFFSET[RT] = offset[3] //Set OFFSET at the current results
            set INT[RT] = INTERVAL //Set INT(erval) at the current results
            set LOOPARRAY[RT] = LOOPS //Set LOOPARRAY at the current results
            if (RT &lt; 8190) then //
                set RT = RT + 1 //
            else                //Recycling of RT
                set RT = 0      //
            endif               //
            if (STOPPED == false) then //If the test was completed
                call ClearTextMessages()
                call BJDebugMsg(&quot;Results for test &quot; + ColorIt(NUMCOL, I2S(RT - 1)) + &quot; at interval &quot; + ColorIt(NUMCOL, R2S(INTERVAL)) + &quot; looped &quot; + ColorIt(NUMCOL, I2S(LOOPS)) + &quot; times:&quot;)
                call BJDebugMsg(&quot;The biggest wait was &quot; + ColorIt(NUMCOL, R2S(big)) + &quot;.&quot;)
                call BJDebugMsg(&quot;The smallest wait was &quot; + ColorIt(NUMCOL, R2S(small)) + &quot;.&quot;)
                call BJDebugMsg(&quot;The largest offset was &quot; + ColorIt(NUMCOL, R2S(offset[3])) + &quot;.&quot;)
                //Displays all the information to the user
                set I = 0
            elseif (STOPPED == true) then //If test was stopped
                call ClearTextMessages()
                call BJDebugMsg(&quot;Test aborted!&quot;) //Tell user
                set I = 0
                set ABORTED[RT - 1] = true //Set ABORTED to true for that test
                set STOPPED = false
            endif
        else //If there&#039;s already a loop going
            call BJDebugMsg(&quot;There&#039;s another loop already in progress!&quot;) //Tell user so
        endif
    endfunction
    
    
//=======================================================
//==========          Loops Functions          ==========
//=======================================================
// +-----------------------+
// |     Setting Loops     |
// +-----------------------+
    private function LoopSetActions takes nothing returns nothing
        if (I == 0) then //If there&#039;s not a loop already going
            if (GetEventPlayerChatString() == &quot;-loop&quot;) then //If the string is just &quot;-loop&quot;
                call BJDebugMsg(&quot;Please enter a number after &quot; + ColorIt(CCOL, &quot;-loop&quot;) + &quot;!&quot;) //Tell user to enter a value
                return
            endif
            if (LOOPS &gt;= 1) then //Check to make sure it&#039;s greater then 0
                set LOOPS = S2I(SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))) //Set it to entered value
            endif
            if (LOOPS &lt;= 0) then //If the input is less then 0
                call BJDebugMsg(&quot;Please enter a number after &quot; + ColorIt(CCOL, &quot;-loop&quot;) + &quot;!&quot;) //Tell user to enter a valid number
                return
            endif
            call BJDebugMsg(&quot;=========================&quot;)
            call BJDebugMsg(&quot;Number of loops is now set to &quot; + ColorIt(NUMCOL, I2S(LOOPS)) + &quot;!&quot;)
        endif
    endfunction
    
// +------------------------+
// |     Checking Loops     |
// +------------------------+
    private function LoopActions takes nothing returns nothing
        if (I == 0) then //Make sure there&#039;s a not a loop already running
            call BJDebugMsg(&quot;=========================&quot;)
            call BJDebugMsg(&quot;Number of loops is currently: &quot; + ColorIt(NUMCOL, I2S(LOOPS)) + &quot;!&quot;)
        endif
    endfunction

    
//==========================================================
//==========          Interval Functions          ==========
//==========================================================
// +--------------------------+
// |     Setting Interval     |
// +--------------------------+
    private function SetActions takes nothing returns nothing
        local real int = S2R(SubString(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString())))
        
        if (I == 0) then //If there&#039;s no loop running
            if (GetEventPlayerChatString() == &quot;-int&quot;) then //Check if string is just &quot;-int&quot;
                call BJDebugMsg(&quot;Please enter a number after &quot; + ColorIt(CCOL, &quot;-int&quot;) + &quot;!&quot;) //Tell user to enter a number
                return
            endif
            if (int &lt; 0.01) then //If the input is lower then 0.01
                call BJDebugMsg(&quot;Please enter a number larger then &quot; + ColorIt(NAMESCOL, &quot;0.009&quot;) + &quot;!&quot;) //Tell user to enter a higher number
                return
            elseif (int &gt;= 0.01) then //If it&#039;s high enough
                set INTERVAL = int
            endif
            call BJDebugMsg(&quot;=========================&quot;)
            call BJDebugMsg(&quot;INTERVAL is now: &quot; + ColorIt(NUMCOL, R2S(INTERVAL)) + &quot;.&quot;)
        endif
    endfunction
    
// +---------------------------+
// |     Checking Interval     |
// +---------------------------+
    private function IntActions takes nothing returns nothing
        if (I == 0) then //Check if a loop is currently running
            call BJDebugMsg(&quot;=========================&quot;)
            call BJDebugMsg(&quot;INTERVAL is currently: &quot; + ColorIt(NUMCOL, R2S(INTERVAL)) + &quot;!&quot;)
        endif
    endfunction
    
    
//=====================================================
//==========          Dot Functions          ==========
//=====================================================
// +---------------------+
// |     Dot Setting     |
// +---------------------+
    private function DotsActions takes nothing returns nothing
        if (I == 0) then //If there&#039;s no loop running
            if (GetEventPlayerChatString() == &quot;-dots&quot;) then //Check if just &quot;-dots&quot; was input
                call BJDebugMsg(&quot;Please enter a number after &quot; + ColorIt(CCOL, &quot;-dots&quot;) + &quot;!&quot;) //Tell user to enter a number
                return
            endif
            if (DOTNUM &gt;= 1) then //If input is greater then 0
                set DOTNUM = S2I(SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString())))
            endif
            if (DOTNUM &lt;= 0) then //If it&#039;s 0 or lower
                call BJDebugMsg(&quot;Please enter a number after &quot; + ColorIt(CCOL, &quot;-dots&quot;) + &quot;!&quot;) //Tell user to enter a valid number
                return
            endif
            call BJDebugMsg(&quot;=========================&quot;)
            call BJDebugMsg(&quot;DOTNUM is now: &quot; + ColorIt(NUMCOL, I2S(DOTNUM)) + &quot;!&quot;)
        endif
    endfunction
    
// +----------------------+
// |     Dot Checking     |
// +----------------------+
    private function DotCheckActions takes nothing returns nothing
        if (I == 0) then //If there&#039;s no loop currently running
            call BJDebugMsg(&quot;=========================&quot;)
            call BJDebugMsg(&quot;DOTNUM is currently: &quot; + ColorIt(NUMCOL, I2S(DOTNUM)) + &quot;!&quot;)
        endif
    endfunction


//========================================================
//==========          Results Function          ==========
//========================================================
    private function ResultsActions takes nothing returns nothing
        local string rtnum = SubString(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))
        local integer rtt = S2I(rtnum)
        
        if (I == 0) then //If there&#039;s no loop currently running
            if (GetEventPlayerChatString() == &quot;/res&quot;) then //If string is solely &quot;/res&quot;
                call BJDebugMsg(&quot;Please enter a number after &quot; + ColorIt(CCOL, &quot;/res&quot;) + &quot;!&quot;) //Tell user to enter a number
                return
            endif
            if (BIG[rtt] == 0 or SMALL[rtt] == 0) then //If the results for BIG or SMALL are 0 for input results
                call ClearTextMessages()
                call BJDebugMsg(&quot;No results for [&quot; + ColorIt(NUMCOL, I2S(rtt)) + &quot;]!&quot;) //Tell user there&#039;s no results for that test
            elseif (ABORTED[rtt] == true) then //If input test was aborted
                call ClearTextMessages()
                call BJDebugMsg(&quot;Test &quot; + ColorIt(NUMCOL, I2S(rtt)) + &quot; was aborted!&quot;) //Tell user so
            else
                call ClearTextMessages()
                call BJDebugMsg(&quot;Results for test &quot; + ColorIt(NUMCOL, I2S(rtt)) + &quot; at &quot; + ColorIt(NUMCOL, R2S(INT[rtt])) + &quot; looped &quot; + ColorIt(NUMCOL, I2S(LOOPARRAY[rtt])) + &quot; times:&quot;)
                call BJDebugMsg(&quot;The biggest wait was: &quot; + ColorIt(NUMCOL, R2S(BIG[rtt])) + &quot;.&quot;)
                call BJDebugMsg(&quot;The smallest wait was: &quot; + ColorIt(NUMCOL, R2S(SMALL[rtt])) + &quot;.&quot;)
                call BJDebugMsg(&quot;The largest offset was: &quot; + ColorIt(NUMCOL, R2S(OFFSET[rtt])) + &quot;.&quot;)
                //Else show the results for input test
            endif
        endif
    endfunction
    

//=============================================================
//==========          Command List Function          ==========
//=============================================================
    private function CommandsActions takes nothing returns nothing        
        if (I == 0) then //If there&#039;s not a loop runnning
            call ClearTextMessages()
            //Show the command list to the user
            call BJDebugMsg(&quot;Commands for &quot; + ColorIt(MAPCOL, &quot;TSA Test&quot;) + &quot; by &quot; + ColorIt(NAMESCOL, &quot;Wolfie[NoCT]&quot;) + &quot;:&quot;)
            call BJDebugMsg(&quot;Press &quot; + ColorIt(CCOL, &quot;ESC&quot;) + &quot; to run the test.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-stop&quot;) + &quot; at anytime to stop a test.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-loop&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the number of loops to &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot;.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;/loop&quot;) + &quot; to check the current number of loops.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-int&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the TSA time to &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot;.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;/int&quot;) + &quot; to check the current TSA time.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;/res&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to check the results for &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; test.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-ncol&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the color of names.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-mcol&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the color of the map name.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-ccol&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the color of commands.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-xcol&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the color of X&#039;s.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-numcol&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the color of numbers.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;-dots&quot;) + &quot; &quot; + ColorIt(XCOL, &quot;X&quot;) + &quot; to set the number of dots.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;/dots&quot;) + &quot; to check the current number of dots.&quot;)
            call BJDebugMsg(&quot;Type &quot; + ColorIt(CCOL, &quot;/clist&quot;) + &quot; to see a list of colors!&quot;)
        endif
    endfunction
    

//==========================================================
//==========          Coloring Functions          ==========
//==========================================================
// +-----------------------+
// |     Name Coloring     |
// +-----------------------+
    private function NameActions takes nothing returns nothing
        local string name = SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))
        
        if (I == 0) then //If there&#039;s no loop running
            if (GetEventPlayerChatString() == &quot;-ncol&quot;) then //Check if just &quot;-ncol&quot; was input
                call BJDebugMsg(&quot;Please enter a color after &quot; + ColorIt(CCOL, &quot;-ncol&quot;) + &quot;!&quot;) //Tell the user to put in a color
                return
            elseif (CheckColor(name) == false) then //If input color is invalid
                call BJDebugMsg(&quot;Invalid color, type &quot; + ColorIt(CCOL, &quot;/clist&quot;) + &quot; to view the colors list!&quot;) //Tell user so
            elseif (CheckColor(name) == true)then //Elseif input color is valid
                set NAMESCOL = name
                call BJDebugMsg(&quot;=========================&quot;)
                call BJDebugMsg(&quot;Names will now be colored &quot; + ColorIt(NAMESCOL, NAMESCOL) + &quot;!&quot;)
            endif
        endif
    endfunction

// +---------------------------+
// |     Map Name Coloring     |
// +---------------------------+
    private function MapNameActions takes nothing returns nothing
        local string map = SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))
        
        if (I == 0) then //If there&#039;s no loop running
            if (GetEventPlayerChatString() == &quot;-mcol&quot;) then //Check if just &quot;-mcol&quot; was input
                call BJDebugMsg(&quot;Please enter a color after &quot; + ColorIt(CCOL, &quot;-mcol&quot;) + &quot;!&quot;) //Tell the user to put in a color
                return
            elseif (CheckColor(map) == false) then //If input color is invalid
                call BJDebugMsg(&quot;Invalid color, type &quot; + ColorIt(CCOL, &quot;/clist&quot;) + &quot; to view the colors list!&quot;) //Tell user so
            elseif (CheckColor(map) == true)then //Elseif input color is valid
                set MAPCOL = map
                call BJDebugMsg(&quot;=========================&quot;)
                call BJDebugMsg(&quot;The map names will now be colored &quot; + ColorIt(MAPCOL, MAPCOL) + &quot;!&quot;)
            endif
        endif
    endfunction

// +--------------------------+
// |     Command Coloring     |
// +--------------------------+
    private function ComColActions takes nothing returns nothing
        local string comcol = SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))
        
        if (I == 0) then //If there&#039;s no loop running
            if (GetEventPlayerChatString() == &quot;-ccol&quot;) then //Check if just &quot;-ccol&quot; was input
                call BJDebugMsg(&quot;Please enter a color after &quot; + ColorIt(CCOL, &quot;-ccol&quot;) + &quot;!&quot;) //Tell the user to put in a color
                return
            elseif (CheckColor(comcol) == false) then //If input color is invalid
                call BJDebugMsg(&quot;Invalid color, type &quot; + ColorIt(CCOL, &quot;/clist&quot;) + &quot; to view the colors list!&quot;) //Tell user so
            elseif (CheckColor(comcol) == true)then //Elseif input color is valid
                set CCOL = comcol
                call BJDebugMsg(&quot;=========================&quot;)
                call BJDebugMsg(&quot;Commands will now be colored &quot; + ColorIt(CCOL, CCOL) + &quot;!&quot;)
            endif
        endif
    endfunction
    
// +----------------------+
// |     &#039;X&#039; Coloring     |
// +----------------------+
    private function XColActions takes nothing returns nothing
        local string xcol = SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))
        
        if (I == 0) then //If there&#039;s no loop running
            if (GetEventPlayerChatString() == &quot;-xcol&quot;) then //Check if just &quot;-xcol&quot; was input
                call BJDebugMsg(&quot;Please enter a color after &quot; + ColorIt(CCOL, &quot;-xcol&quot;) + &quot;!&quot;) //Tell the user to put in a color
                return
            elseif (CheckColor(xcol) == false) then //If input color is invalid
                call BJDebugMsg(&quot;Invalid color, type &quot; + ColorIt(CCOL, &quot;/clist&quot;) + &quot; to view the colors list!&quot;) //Tell user so
            elseif (CheckColor(xcol) == true)then //Elseif input color is valid
                set XCOL = xcol
                call BJDebugMsg(&quot;=========================&quot;)
                call BJDebugMsg(&quot;X&#039;s will now be colored &quot; + ColorIt(XCOL, XCOL) + &quot;!&quot;)
            endif
        endif
    endfunction
    
    
//===========================================================
//==========          Color List Function          ==========
//===========================================================
    private function ColListActions takes nothing returns nothing
        if (I == 0) then //If there&#039;s no loop running
            call ClearTextMessages()
            //Show user a list of colors
            call BJDebugMsg(&quot;List of colors:&quot;)
            call BJDebugMsg(ColorIt(&quot;red&quot;, &quot;red&quot;))
            call BJDebugMsg(ColorIt(&quot;gold&quot;, &quot;gold&quot;))
            call BJDebugMsg(ColorIt(&quot;cyan&quot;, &quot;cyan&quot;))
            call BJDebugMsg(ColorIt(&quot;blue&quot;, &quot;blue&quot;))
            call BJDebugMsg(ColorIt(&quot;brown&quot;, &quot;brown&quot;))
            call BJDebugMsg(ColorIt(&quot;grey&quot;, &quot;grey&quot;))
            call BJDebugMsg(ColorIt(&quot;green&quot;, &quot;green&quot;))
            call BJDebugMsg(ColorIt(&quot;orange&quot;, &quot;orange&quot;))
            call BJDebugMsg(ColorIt(&quot;pink&quot;, &quot;pink&quot;))
        endif
    endfunction

    
//=====================================================
//==========          Stop Function          ==========
//=====================================================
    private function StopActions takes nothing returns nothing
        if (I != 0) then //If there IS a loop running
            set I = LOOPS - 1 //Set I to the input number of LOOPS - 1 (To stop the loop)
            set STOPPED = true
        endif
    endfunction
    
    
//============================================================
//==========          Initializer Function          ==========
//============================================================
    private function TTInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        
        //Spawn function
        call TriggerRegisterPlayerEvent(t, Player(0), EVENT_PLAYER_END_CINEMATIC)
        call TriggerAddAction(t, function TTActions)
        
        //Set loop
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-loop&quot;, false)
        call TriggerAddAction(t, function LoopSetActions)
        
        //Check loop
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;/loop&quot;, true)
        call TriggerAddAction(t, function LoopActions)
        
        //Set interval
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-int&quot;, false)
        call TriggerAddAction(t, function SetActions)
        
        //Check interval
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;/int&quot;, true)
        call TriggerAddAction(t, function IntActions)
        
        //Set dots
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-dots&quot;, false)
        call TriggerAddAction(t, function DotsActions)
        
        //Check dots
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;/dots&quot;, true)
        call TriggerAddAction(t, function DotCheckActions)
        
        //Check results
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;/res&quot;, false)
        call TriggerAddAction(t, function ResultsActions)
        
        //Command list
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;/com&quot;, true)
        call TriggerAddAction(t, function CommandsActions)
        
        //Set name color
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-ncol&quot;, false)
        call TriggerAddAction(t, function NameActions)
        
        //Set map name color
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-mcol&quot;, false)
        call TriggerAddAction(t, function MapNameActions)
        
        //Set command colod
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-ccol&quot;, false)
        call TriggerAddAction(t, function ComColActions)
        
        //Set &#039;X&#039; color
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-xcol&quot;, false)
        call TriggerAddAction(t, function XColActions)
        
        //Color list
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;/clist&quot;, true)
        call TriggerAddAction(t, function ColListActions)
        
        //Stop loop
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;-stop&quot;, true)
        call TriggerAddAction(t, function StopActions)
        
        //Color initialization
        set t = CreateTrigger()
        call TriggerRegisterTimerEvent(t, 0.01, false)
        call TriggerAddAction(t, function COLORInit)
    endfunction

endscope</i></i></i></i></i></i></i></i>
 

Attachments

  • opt-TSA_Testing_v10.w3m
    24.3 KB · Views: 235

WolfieeifloW

WEHZ Helper
Reaction score
372
Spawn Testing
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |              -=-=- Spawn System [v1.0] -=-=-               |
// |                -=-=- By Wolfie[NoCT] -=-=-                 |
// |      Requires Jass NewGen, ExplodeString, and ColorIt      |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   A cool little spawn/kill system made for fun. This is    |
// |      not meant to be a &quot;serious&quot; project or anything;      |
// |         it&#039;s just for fun to play around with.             |
// |                                                            |
// +------------------------------------------------------------+
// |   -=-=- Things To Fix -=-=-                                |
// |      -Make system detect letter instead of number input    |
// |      -Fix Spawn not picking up on location being occupied  |
// +------------------------------------------------------------+
// |   -=-=- Version History -=-=-                              |
// |                                                            |
// |      Version 1.0                                           |
// |         - Initial release                                  |
// |                                                            |
// +------------------------------------------------------------+
scope Spawn initializer SInit

// +-----------------------+
// |     GLOBALS BLOCK     |
// |     GLOBALS BLOCK     |
// |     GLOBALS BLOCK     |
// +-----------------------+
    globals
    // All values should be left as they are;
    // Nothing needs to be modified
        private real X = 0.
        private real Y = 0.
        
        private boolean IsOccupied
        private group Group = CreateGroup()
        
        private integer array UNIT
        private boolean CHECKING = false
        private boolean CONTINUE = true
        
        private constant real CELL = 32.
        private real MinX
        private real MinY
        private real MaxX
        private real MaxY
    endglobals
// +------------------------+
// |     END OF GLOBALS     |
// |     END OF GLOBALS     |
// |     END OF GLOBALS     |
// +------------------------+
    
//===========================================================
//==========          &quot;Useless&quot; Functions          ==========
//===========================================================
// +---------------------+
// |     True filter     |
// +---------------------+
    private function True takes nothing returns boolean
        return true
    endfunction
    
// +--------------------------------+
// |     UNIT Array declaration     |
// +--------------------------------+
    private function UnitSetActions takes nothing returns nothing
        set UNIT[0] = &#039;hpea&#039;
        set UNIT[1] = &#039;hfoo&#039;
        set UNIT[2] = &#039;hrif&#039;
        set UNIT[3] = &#039;hmpr&#039;
        set UNIT[4] = &#039;hsor&#039;
    endfunction
    
    
//==========================================================
//==========          &quot;Useful&quot; Functions          ==========
//==========================================================    
// +-----------------------------------------------+
// |     Filters units outside outside of rect     |
// +-----------------------------------------------+
    private function FilterOutsideRect takes nothing returns boolean
        local unit whichUnit = GetFilterUnit()
        local real x = GetUnitX(whichUnit)
        local real y = GetUnitY(whichUnit)
        set whichUnit = null
        if x &gt; MinX and x &lt; MaxX and y &gt; MinY and y &lt; MaxY then
            return true
        endif
        return false
    endfunction
    
// +-------------------------------------+
// |     Units in range? True it is!     |
// +-------------------------------------+
    private function Enum takes nothing returns boolean
        set IsOccupied = true
        return false
    endfunction
    
// +-----------------------------------------------------------------+
// |     Check to see if there&#039;s any units in specified location     |
// +-----------------------------------------------------------------+
    private function IsLocOccupied takes location loc returns boolean
        set IsOccupied = false
        call GroupEnumUnitsInRangeOfLoc(Group, loc, 2, Filter(function Enum))
        return IsOccupied
    endfunction
    
// +--------------------------------------------------------------+
// |     Check to see if there&#039;s any units in specified range     |
// +--------------------------------------------------------------+
    private function IsPointOccupied takes real x, real y returns boolean
        set IsOccupied = false
        call GroupEnumUnitsInRange(Group, x, y, 1, Filter(function Enum))
        return IsOccupied
    endfunction
    

    
//=========================================================================================================
//==========          The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=-          ==========
//==========          The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=-          ==========
//==========          The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=- The &quot;Real&quot; Code -=-=-          ==========
//=========================================================================================================

//======================================================
//==========          Spawn Function          ==========
//======================================================
    private function SpawnActions takes nothing returns nothing
        local unit u
        
        if(IsPointOccupied(X, Y) == false) then //Check if point is occupied
            set u = CreateUnit(Player(0), UNIT[GetRandomInt(0, 4)], X, Y, bj_UNIT_FACING) //Create random UNIT at point
            call ClearTextMessages()
            call BJDebugMsg(&quot;Unit created at (&quot; + R2S(X) + &quot;/&quot; + R2S(Y) + &quot;)!&quot;)
        else
            call ClearTextMessages()
            call BJDebugMsg(&quot;Point (&quot; + R2S(X) + &quot;/&quot; + R2S(Y) + &quot;) is occupied!&quot;)
        endif
        set u = null
    endfunction
    
    
//========================================================
//==========          Set X/Y Function          ==========
//========================================================    
    private function SetActions takes nothing returns nothing
        local ExpString setxy = ExplodeString(GetEventPlayerChatString(), &quot;/&quot;, 2) //Explode input string into x/y components
        
        if(SubString(setxy[0], 1, 2) == &quot;x&quot; and SubString(setxy[1], 0, 1) == &quot;y&quot;) then //Make sure &quot;x&quot; and &quot;y&quot; are the first letter in each result
            if(SubString(setxy[0], 2, 3) == &quot;&quot; or SubString(setxy[1], 1, 2) == &quot;&quot;) then //If there&#039;s no number input
                call ClearTextMessages()                                           //         Then
                call BJDebugMsg(&quot;Please enter a number for each coordinate!&quot;) //Tell user to enter a number
                return
            elseif(SubString(setxy[0], 2, 3) != &quot;&quot; and SubString(setxy[1], 1, 2) != &quot;&quot;) then //If there IS a number
                call ClearTextMessages()
                set X = S2R(SubString(setxy[0], 2, StringLength(setxy[0])))   //
                call BJDebugMsg(&quot;X set to &quot; + R2S(X) + &quot;!&quot;)                   //Set X/Y to input numbers
                set Y = S2R(SubString(setxy[1], 1, StringLength(setxy[1])))   //
                call BJDebugMsg(&quot;Y set to &quot; + R2S(Y) + &quot;!&quot;)
            endif
        elseif(SubString(setxy[1], 0, 1) != &quot;y&quot;) then //If &quot;y&quot; isn&#039;t the first letter in result 2
            call ClearTextMessages()                     //          Then
            call BJDebugMsg(&quot;Please enter a Y coordinate!&quot;) //Tell user to enter a y coordinate
        endif
        call setxy.destroy() //Destroy ExplodeString
    endfunction
    
    
//====================================================================
//==========          Set Just &#039;X&#039; Or &#039;Y&#039; Function          ==========
//====================================================================
    private function JustActions takes nothing returns nothing
        local string entered = GetEventPlayerChatString()
        local integer i = 0
        
        loop
        exitwhen i == StringLength(entered)
            if(SubString(entered, i, i + 1) == &quot;/&quot;) then //If there is a &quot;/&quot; anywhere in the string
                call ClearTextMessages()                             //          Then
                call BJDebugMsg(&quot;This command does not support multiple inputs!&quot;) //Tell user this doesn&#039;t support that
                set CONTINUE = false //Makes it so function doesn&#039;t keep going
                return
            else
                set i = i + 1
            endif
        endloop
        if(CONTINUE == true) then
            if(SubString(entered, 1, 2) == &quot;x&quot;) then //If you&#039;re setting just x
                if(SubString(entered, 2, 3) != &quot;&quot;) then //If the input isn&#039;t blank
                    call ClearTextMessages()                       //      Then
                    set X = S2R(SubString(entered, 2, StringLength(entered))) //Set X to input
                    call BJDebugMsg(&quot;X set to &quot; + R2S(X) + &quot;!&quot;)
                elseif(SubString(entered, 2, 3) == &quot;&quot;) then  //If input is blank
                    call ClearTextMessages()                    //      Then
                    call BJDebugMsg(&quot;Please enter an X coordinate!&quot;) //Tell user to enter input
                    return
                endif
            elseif(SubString(entered, 1, 2) == &quot;y&quot;) then //If you&#039;re setting just y
                if(SubString(entered, 2, 3) != &quot;&quot;) then //If the input isn&#039;t blank
                    call ClearTextMessages()                       //      Then
                    set Y = S2R(SubString(entered, 2, StringLength(entered))) //Set Y to input
                    call BJDebugMsg(&quot;Y set to &quot; + R2S(Y) + &quot;!&quot;)
                elseif(SubString(entered, 2, 3) == &quot;&quot;) then //If input is blank
                    call ClearTextMessages()                    //      Then
                    call BJDebugMsg(&quot;Please enter a Y coordinate!&quot;) //Tell user to enter input
                    return
                endif
            endif
        endif
        set CONTINUE = true
    endfunction
    

//===========================================================
//==========          Kill Point Function          ==========
//===========================================================   
    private function KillActions takes nothing returns nothing
        local ExpString kill = ExplodeString(GetEventPlayerChatString(), &quot;/&quot;, 2) //Explode string into x/y components
        local group KG = CreateGroup()
        local unit FoG
        local real x
        local real y
        
        if(SubString(kill[0], 4, 5) != &quot;&quot; and SubString(kill[1], 0, 1) != &quot;&quot;) then //Makes sure there&#039;s input
            call ClearTextMessages()
            set x = S2R(SubString(kill[0], 4, StringLength(kill[0]))) //Set x to x input
            set y = S2R(SubString(kill[1], 0, StringLength(kill[1]))) //Set y to y input
            call GroupEnumUnitsInRange(KG, x, y, 1, Filter(function True)) //Group units in that point
            if(CountUnitsInGroup(KG) == 0) then  //If there&#039;s no units at that point
                call BJDebugMsg(&quot;There&#039;s no unit to kill at (&quot; + R2S(x) + &quot;/&quot; + R2S(y) + &quot;)!&quot;) //Tell the user so
                return
            endif
            loop
            set FoG = FirstOfGroup(KG)                    //
            exitwhen FoG == null                          //Remove units from the game at that point
                call RemoveUnit(FoG)                      //
                call GroupRemoveUnit(KG, FoG)
            endloop
        elseif(SubString(kill[0], 4, 5) == &quot;&quot;) then //If there&#039;s no x input
            call ClearTextMessages()                    //     Then
            call BJDebugMsg(&quot;Please enter an X coordinate!&quot;) //Tell user to input x component
        elseif(SubString(kill[1], 0, 1) == &quot;&quot;) then //If there&#039;s no y input
            call ClearTextMessages()                    //     Then
            call BJDebugMsg(&quot;Please enter a Y coordinate!&quot;) //Tell user to input y component
        endif
        set FoG = null
        call DestroyGroup(KG)
        call kill.destroy() //Destroy ExplodeString
    endfunction
    

//==========================================================
//==========          Kill Rect Function          ==========
//==========================================================   
    private function KillRectActions takes nothing returns nothing
        local ExpString killr = ExplodeString(GetEventPlayerChatString(), &quot;/&quot;, 4) //Explode string into minx/miny/maxx/maxy components
        local group KGR = CreateGroup()
        local rect whichRect
        local unit FoG
        local real minx
        local real miny
        local real maxx
        local real maxy
        
        if(SubString(killr[0], 5, 6) != &quot;&quot; and SubString(killr[1], 1, 2) != &quot;&quot; and SubString(killr[2], 1, 2) != &quot;&quot; and SubString(killr[3], 1, 2) != &quot;&quot;) then
            call ClearTextMessages() //^--If all input isn&#039;t blank
            set minx = S2R(SubString(killr[0], 5, StringLength(killr[0]))) //
            set miny = S2R(SubString(killr[1], 0, StringLength(killr[1]))) //Set minx/miny/maxx/maxy
            set maxx = S2R(SubString(killr[2], 0, StringLength(killr[2]))) //To input from string
            set maxy = S2R(SubString(killr[3], 0, StringLength(killr[3]))) //
            call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl&quot;, minx, miny)) //Create effects at each corner
            call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl&quot;, minx, maxy)) //So user can easily see the
            call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl&quot;, maxx, miny)) //Rect (s)he specified
            call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl&quot;, maxx, maxy)) //
            set MinX = minx //
            set MinY = miny //Preparing for filtering of
            set MaxX = maxx //Units outside of specified rect
            set MaxY = maxy //
            set whichRect = Rect(minx - CELL, miny - CELL, maxx + CELL, maxy + CELL) //Rect leak prevention
            call GroupEnumUnitsInRect(KGR, whichRect, Filter(function FilterOutsideRect)) //Group units in rect and filter ones outside of specified rect
            call RemoveRect(whichRect) //Rect leak removal
            set whichRect = null
            if(CountUnitsInGroup(KGR) == 0) then //If there&#039;s no units in specified rect
                call BJDebugMsg(&quot;There&#039;s no unit to kill in that region!&quot;) //Tell user so
                return
            endif
            call BJDebugMsg(I2S(CountUnitsInGroup(KGR)) + &quot; unit(s) were killed!&quot;) //Tell user how many units were in rect
            loop
            set FoG = FirstOfGroup(KGR)
            exitwhen FoG == null                    //Kill units
                call RemoveUnit(FoG)                //In specified
                call GroupRemoveUnit(KGR, FoG)      //Rect
            endloop
        elseif(SubString(killr[0], 5, 6) == &quot;&quot;) then //If there&#039;s no minx entered
            call ClearTextMessages()                      //     Then
            call BJDebugMsg(&quot;Please enter a minX coordinate!&quot;) //Tell the user
        elseif(SubString(killr[1], 0, 1) == &quot;&quot;) then //If there&#039;s no miny entered
            call ClearTextMessages()                      //     Then
            call BJDebugMsg(&quot;Please enter a minY coordinate!&quot;) //Tell the user
        elseif(SubString(killr[2], 0, 1) == &quot;&quot;) then //If there&#039;s no maxx entered
            call ClearTextMessages()                      //     Then
            call BJDebugMsg(&quot;Please enter a maxX coordinate!&quot;) //Tell the user
        elseif(SubString(killr[3], 0, 1) == &quot;&quot;) then //If there&#039;s no maxy entered
            call ClearTextMessages()                      //     Then
            call BJDebugMsg(&quot;Please enter a maxY coordinate!&quot;) //Tell the user
        endif
        set FoG = null
        call DestroyGroup(KGR)
        call killr.destroy() //Destroy ExplodeString
    endfunction
    

//==========================================================================
//==========          Position Check/Kill Click Function          ==========
//==========================================================================  
    private function PositionActions takes nothing returns nothing
        local unit tu = GetTriggerUnit()
        local texttag tt
        
        if(GetUnitTypeId(tu) != &#039;Hpal&#039;) then //Check to make sure selected unit is not &#039;Spawn&#039; (The Paladin)
            if(CHECKING == true) then //If user is in &#039;Check&#039; mode
                call SelectUnit(tu, false) //Deselect selected unit
                set tt = CreateTextTagUnitBJ(&quot;Unit&#039;s position is: x&quot; + R2S(GetUnitX(tu)) + &quot;/y&quot; + R2S(GetUnitY(tu)) + &quot;!&quot;, tu, 0, 10, GetRandomReal(1, 100), GetRandomReal(1, 100), GetRandomReal(1, 100), 0)
                call SetTextTagPermanent(tt, false)   //Create a texttag
                call SetTextTagLifespan(tt, 3.00)     //To tell user
                call SetTextTagFadepoint(tt, 2.00)    //Location of unit
                call SetTextTagVelocityBJ(tt, 75.00, GetRandomReal(0, 360))
            else //If not in &#039;Check&#039; mode
                call RemoveUnit(tu) //Kill selected unit
            endif
        endif
        set tu = null
    endfunction
    
    
//===========================================================
//==========          Check Mode Function          ==========
//===========================================================  
    private function CheckingActions takes nothing returns nothing
        if(CHECKING == false) then
            set CHECKING = true
            call ClearTextMessages()
            call BJDebugMsg(&quot;You are now able to check positions!&quot;)
        else
            set CHECKING = false
            call ClearTextMessages()
            call BJDebugMsg(&quot;You are no longer checking positions!&quot;)
        endif
    endfunction

    
//=============================================================
//==========          Spawn Create Function          ==========
//=============================================================  
    private function CreateActions takes nothing returns nothing
        local location loc = GetSpellTargetLoc()
        local unit u
        
        if(IsLocOccupied(loc) == false) then //If location isn&#039;t occupied
            set u = CreateUnitAtLoc(Player(0), UNIT[GetRandomInt(0, 4)], loc, bj_UNIT_FACING) //Create a random UNIT at target location
            call ClearTextMessages()
            call BJDebugMsg(&quot;Unit created at (&quot; + R2S(GetUnitX(u)) + &quot;/&quot; + R2S(GetUnitY(u)) + &quot;)!&quot;)
        else
            call ClearTextMessages()
            call BJDebugMsg(&quot;That location is occupied!&quot;)
        endif
        call RemoveLocation(loc) //Location cleanup
        set loc = null
        set u = null
    endfunction
    
    
//=============================================================
//==========          Command List Function          ==========
//=============================================================  
    private function ComActions takes nothing returns nothing
        call ClearTextMessages()
        call BJDebugMsg(&quot;Commands for &quot; + ColorIt(&quot;cyan&quot;, &quot;Spawn Test&quot;) + &quot; by &quot; + ColorIt(&quot;gold&quot;, &quot;Wolfie[NoCT]&quot;) + &quot;!&quot;)
        call BJDebugMsg(&quot; &quot;)
        call BJDebugMsg(&quot;Press &quot; + ColorIt(&quot;red&quot;, &quot;ESC&quot;) + &quot; to spawn a unit at the current &quot; + ColorIt(&quot;gold&quot;, &quot;X&quot;) + &quot;/&quot; + ColorIt(&quot;gold&quot;, &quot;Y&quot;) + &quot;.&quot;)
        call BJDebugMsg(&quot;Type &quot; + ColorIt(&quot;red&quot;, &quot;sx&quot;) + &quot; to set the X/Y; &#039;sx100/y100&#039; for example would set each to 100.&quot;)
        call BJDebugMsg(&quot;Type &quot; + ColorIt(&quot;red&quot;, &quot;j&quot;) + &quot; to set just the X or Y; &#039;jx100&#039; would set just X to 100, for example.&quot;)
        call BJDebugMsg(&quot;Type &quot; + ColorIt(&quot;red&quot;, &quot;kill&quot;) + ColorIt(&quot;gold&quot;, &quot;X&quot;) + &quot;/&quot; + ColorIt(&quot;gold&quot;, &quot;Y&quot;) + &quot; to kill units at that point; &#039;kill100/100&#039; would kill units at X100/Y100.&quot;)
        call BJDebugMsg(&quot;Type &quot; + ColorIt(&quot;red&quot;, &quot;krect&quot;) + ColorIt(&quot;gold&quot;, &quot;minX&quot;) + &quot;/&quot; + ColorIt(&quot;gold&quot;, &quot;minY&quot;) + &quot;/&quot; + ColorIt(&quot;gold&quot;, &quot;maxX&quot;) + &quot;/&quot; + ColorIt(&quot;gold&quot;, &quot;maxY&quot;) + &quot; to kill units in that specified rect;&quot;)
        call BJDebugMsg(&quot;   &#039;krect10/10/100/100&#039; would kill units in Rect(10, 10, 100, 100), for example.&quot;)
        call BJDebugMsg(&quot;Type &quot; + ColorIt(&quot;red&quot;, &quot;com&quot;) + &quot; to show this list again.&quot;)
        call BJDebugMsg(&quot;Type &quot; + ColorIt(&quot;red&quot;, &quot;c&quot;) + &quot; to turn on/off &#039;Check&#039; mode.&quot;)
        call BJDebugMsg(&quot;Selecting unit(s) will:&quot;)
        call BJDebugMsg(&quot;   -Kill a unit if &#039;Check Mode&#039; is off.&quot;)
        call BJDebugMsg(&quot;   -Display a unit&#039;s position if &#039;Check Mode&#039; is on.&quot;)
    endfunction

    
//============================================================
//==========          Initializer Function          ==========
//============================================================
    private function SInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        
        call TriggerRegisterTimerEvent(t, 0.01, false)
        call TriggerAddAction(t, function UnitSetActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t, Player(0), EVENT_PLAYER_END_CINEMATIC)
        call TriggerAddAction(t, function SpawnActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;sx&quot;, false)
        call TriggerAddAction(t, function SetActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;j&quot;, false)
        call TriggerAddAction(t, function JustActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;kill&quot;, false)
        call TriggerAddAction(t, function KillActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;krect&quot;, false)
        call TriggerAddAction(t, function KillRectActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_SELECTED, null)
        call TriggerAddAction(t, function PositionActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;c&quot;, true)
        call TriggerAddAction(t, function CheckingActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent(t, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        call TriggerAddAction(t, function CreateActions)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), &quot;com&quot;, true)
        call TriggerAddAction(t, function ComActions)
    endfunction

endscope






Credits:
ExplodeString by Romek.


EDIT: Oh, here's the "ColorIt" library:
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |                -=-=- Library ColorIt -=-=-                 |
// |                -=-=- By Wolfie[NoCT] -=-=-                 |
// |                    Requires Jass NewGen                    |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   A library to easily color input text.                    |
// |                                                            |
// +------------------------------------------------------------+
// |   -=-=- Things To Fix -=-=-                                |
// |      -Add more colors                                      |
// +------------------------------------------------------------+
library ColorIt

    function ColorIt takes string Color, string Word returns string Colored
        if (Color == &quot;red&quot;) then
            return (&quot;|cffff0000&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;gold&quot;) then
            return (&quot;|cffffd700&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;cyan&quot;) then
            return (&quot;|cff99b4d1&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;blue&quot;) then
            return (&quot;|cff0000ff&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;brown&quot;) then
            return (&quot;|cffa52a2a&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;grey&quot; or Color == &quot;gray&quot;) then
            return (&quot;|cff808080&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;green&quot;) then
            return (&quot;|cff008000&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;orange&quot;) then
            return (&quot;|cffffa500&quot; + Word + &quot;|r&quot;)
        elseif (Color == &quot;pink&quot;) then
            return (&quot;|cffff0099&quot; + Word + &quot;|r&quot;)
        else
            return (Color + Word + &quot;|r&quot;)
        endif
    endfunction
    
endlibrary
 

Attachments

  • opt-Spawn_Testing_v10.w3x
    126.1 KB · Views: 231

BlackRose

Forum User
Reaction score
239
thousand different in-game customizable things
Like?

TSA thingy: I am confused, is it only meant to show how inaccurate TSA can be?

Spawn: I like it, (I like the floating text!) though I am not too sure either.... what can I do with it? How does it make fun?

I like your ColorIt thing, you should expand it so it covers every color possible!!
 

WolfieeifloW

WEHZ Helper
Reaction score
372
It was an exaggeration :p ;
Although there's still quite a lot of in-game customizables.

TSA thingy: I am confused, is it only meant to show how inaccurate TSA can be?
Originally, yes.
Then I added in all the other things to make it cool to play around with.

Spawn: I like it, (I like the floating text!) though I am not too sure either.... what can I do with it? How does it make fun?
The floating text is my favorite too :) .
These things are both essentially useless;
I just posted them for people to play around with.

I like your ColorIt thing, you should expand it so it covers every color possible!!
I might do that and submit it as it's own resource.
 

Kabalsin

New Member
Reaction score
2
I liked this thing, not saying that I'm going to use it, but I think it may come in hand someday.

By the way, i must be careful with my words...because i can say something "useless". Right WolfieNoCT?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top