wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > - Submit a resource -
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-30-2014, 07:14 AM   #1
.....
User
 
Join Date: Feb 2014
Posts: 8

..... has little to show at this moment (0)

Default Ultimate Chat System

This is only for advertising purpose.. Get real updates only at thw



A smooth, full-featured, light-weight chat system that would improves any game performance. Supports various fascinating features. The goal of this system is replacing default warcraft III chat since it has many shortcomings. All features of this system will be mentioned below.


  • Colorized chats: Gives any color to your message
  • Gradient chats: Gives any rainbow color effect to your message
  • Supports 5 kinds of message: All/Public, Team, Private/Whisper, System/Debug, Announcement
  • Anti-flood: Restricts player to send messages too often
  • Word restrictions: Keep players from cursing/swearing in your game
  • Chat history: Able to save more than 100 million messages, but it's uneededly practical
  • Scroll up & down: You are able to browse chat history from the beginning of the game. Except you have cleared them or saved message has reached the max amount
  • Time tag: Add time tag on each message
  • Reject messages: Reject any message from rejected player
  • Chat window outfit: You are able to add outfit/background for chat window





v1.0


v1.9


v2.3




1. How to import
- Copy UltimateChat folder into your map
- You are able to change chat font size and hide default wc3 chat by importing this file or better follow this instructions
2. How to create your own outfit
- Download this psd file
- Edit it using photoshop
- Black layer is the chat window
- If you are not a pro, just don't resize it
- After you are done with editing, save as .tga file, select 32 bits/pixel
- Convert it to .blp file using this tool
3. How to add special commands

4. How to send whisper/private message

5. How to add a player to a reject list

6. How to solve bugs
a. Title disappeared
- Try to reduce WINDOW_SIZE - Go to option, make sure SHOW_TITLE = true
7. How to appreciate the hardwork
Honestly, I always wanted to have some ratings for all of my resources, so any rating will be highly appreciated. And any suggestion is welcome



Collapse JASS:
library UltimateChat initializer ini uses Table optional GradientText

    /***************************************************************************************************
    *                                                                                                  *
    *                               'Ultimate Chat System v2.4'                                        *
    *                                                   *****                                          *
    *                                               by Dalvengyr                                       *
    *                                                                                                  *
    ****************************************************************************************************
    *                                                                                                  *
    * A smooth, full-featured, light-weight chat system that would improves your game performance and  *
    * make it more elegant. Supports various fascinating features, they are all explained in the main  *
    * forum. Now, what else do you want from a chat system?                                            *
    *                                                                                                  *
    * Requirements:                                                                                    *
    *      - JNGP                                                                                      *
    *           hiveworkshop.com/forums/tools-560/jassnewgenpack-5d-227445/                            *
    *                                                                                                  *
    *      - Table by Bribe                                                                            *
    *           hiveworkshop.com/forums/jass-resources-412/snippet-new-table-188084/                   *
    *                                                                                                  *
    * Optional:                                                                                        *
    *      - GradientText by Dalvengyr                                                                 *
    *           hiveworkshop.com/forums/submissions-414/snippet-gradienttext-249151/                   *
    *                                                                                                  *
    * How to install:                                                                                  *
    *      - Copy UltimateChat folder at trigger editor into your map                                  *
    *      - Follow further instructions at:                                                           *
    *           hiveworkshop.com/forums/2499069-post2.html]                                            *
    *                                                                                                  *
    * Link:                                                                                            *
    *           hiveworkshop.com/forums/spells-569/ultimate-chat-system-v1-4-a-249369/                 *
    *                                                                                                  *
    ****************************************************************************************************
    
    ****************************************************************************************************
    *                                                                                                  *
    * APIs:                                                                                            *
    *                                                                                                  *
    ****************************************************************************************************
    *                                                                                                  *
    * 1. Add a restricted word any time                                                                *
    * function AddRestrictedWord takes string s returns nothing                                        *
    *                                                                                                  *
    * 2. Change chat window title                                                                      *
    * function SetUCSTitle takes string s returns nothing                                              *
    *                                                                                                  *
    * 3. Set game host which is able to announce                                                       *
    * function SetUCSHost takes player p returns nothing                                               *
    *                                                                                                  *
    * 4. Force a player to open chat window                                                            *
    * function OpenUCSChatWindow takes integer pn returns nothing                                      *
    *                                                                                                  *
    * 5. Force a player to close chat window                                                           *
    * function CloseUCSChatWindow takes integer pn returns nothing                                     *
    *                                                                                                  *
    * 6. Get elapsed game time                                                                         *
    * function GetUCSElapsedGameTime takes nothing returns string                                      *
    *                                                                                                  *
    * 7. Get a players nickname                                                                        *
    * function GetUCSNickname takes integer pn returns string                                          *
    *                                                                                                  *
    * 8. Set a players nickname                                                                        *
    * function SetUCSNickname takes integer pn, string s returns nothing                               *
    *                                                                                                  *
    * 9. Send ALL message from a player                                                                *
    * function SendUCSChatAll takes integer sender, string msg returns nothing                         *
    *                                                                                                  *
    * 10. Send TEAM message from a player                                                              *
    * function SendUCSChatTeam takes integer sender, string msg returns nothing                        *
    *                                                                                                  *
    * 11. Send SYSTEM (debug) message to a player                                                      *
    * function SendUCSChatSystem takes integer reciever, string msg returns nothing                    *
    *                                                                                                  *
    * 12. Send PRIVATE message from & to a player                                                      *
    * function SendUCSChatPrivate takes integer sender, integer reciever, string msg returns nothing   *
    *                                                                                                  *
    * 13. Register event which fires when a player recieves a message                                  *
    * function TriggerRegisterUCSChatEvent takes trigger t, chatevent whichEvent returns nothing       *
    *                                                                                                  *
    * 14. Get sender of that message                                                                   *
    * function GetUCSSender takes nothing returns player                                               *
    *                                                                                                  *
    * 15. Get recipient of that message                                                                *
    * function GetUCSReciever takes nothing returns player                                             *
    *                                                                                                  *
    * 16. Get sent message string                                                                      *
    * function GetUCSMessage takes nothing returns string                                              *
    *                                                                                                  *
    ***************************************************************************************************/
    
    globals
        private                 string array    PLAYER_COLOR
        private                 string array    PLAYER_NAME
    
    /***************************************************************************************************
    *                                                                                                  *
    *          CONFIGURATIONS                                                                          *
    *                                                                                                  *
    ****************************************************************************************************
    * 1. Interfaces                                                                                    *
    *                                                                                                  */
        // Title will be shown at the top of chat window
        private                 string          TITLE               = "UltimateChatSystem v2.4"
        // Prefix for private messages
        private     constant    string          PM_PREFIX           = "|cffaaaaaa[|cff343434Private|cffaaaaaa]|r"
        // Prefix for system messages
        private     constant    string          SM_PREFIX           = "|cffaaaaaa[|cff343434System|cffaaaaaa]|r"
        // Prefix for team messages
        private     constant    string          TM_PREFIX           = "|cffaaaaaa[|cff343434Team|cffaaaaaa]|r"
        // Prefix for all messages
        private     constant    string          AM_PREFIX           = "|cffaaaaaa[|cff343434All|cffaaaaaa]|r"
        // Will be added when host announce something
        private     constant    string          ANNOUNCEMENT        = "|cffffff00Announcement|r"
        // Time tag format: TIME_BRACKET1 + MINUTE + TIME_DEVIDER + SECOND + TIME_BRACKET2
        private     constant    string          TIME_BRACKET1       = "|cffaaaaaa[|cff343434"
        private     constant    string          TIME_DEVIDER        = "|cffaaaaaa:|cff343434"
        private     constant    string          TIME_BRACKET2       = "|cffaaaaaa]|r"
        // Symbol after chat sender name
        private     constant    string          EQUAL_SYMBOL        = "|cffaaaaaa:|r"
        // Filepath of outfit
        private     constant    string          OUTFIT_PATH         = "war3mapImported\\outfit.blp"
        // Blending mode of the outfit
        private     constant    blendmode       OUTFIT_BLENDING     = BLEND_MODE_ADDITIVE
   /*                                                                                                  *
    ****************************************************************************************************
    * 2. Commands                                                                                      *
    *                                                                                                  */
        // Prefix to identity a command. Ex: -reject2
        private     constant    string          CMD_PREFIX          = "-"
        // Command to open chat window
        private     constant    string          CMD_OPEN            = "open"
        // Command to close chat window
        private     constant    string          CMD_CLOSE           = "close"
        // Command to clear saved history
        private     constant    string          CMD_CLEAR           = "clear"
        // Command to add a player to reject list. The command must be followed by target player's number
        private     constant    string          CMD_BAN             = "reject"
        // Command to remove a player from reject list
        private     constant    string          CMD_UNBAN           = "unreject"
        // Another command for your personal needs. Ex: ^thetime
        private     constant    string          CMD_SPECIAL         = "^"
   /*                                                                                                  *
    ****************************************************************************************************
    * 3. Messagings                                                                                    *
    *                                                                                                  */
        // Prefix to identity a message target. Ex: *pm2
        private     constant    string          MSG_PREFIX          = "*"
        // To send a message to all players
        private     constant    string          MSG_ALL             = "all"
        // To send a message to all allies
        private     constant    string          MSG_TEAM            = "team"
        // To send a message to specific player. Must be followed by target player's number
        private     constant    string          MSG_PRIVATE         = "pm"
        // To announce something. Only host has this authority
        private     constant    string          MSG_ANNOUNCEMENT    = "announce"
   /*                                                                                                  *
    ****************************************************************************************************
    * 4. Options                                                                                       *
    *                                                                                                  */
        // Max messages that will be shown at screen
        private     constant    integer         WINDOW_SIZE         = 21
        // X position of the chat window
        private     constant    real            WINDOW_X            = 0.0
        // Y position of the chat window
        private     constant    real            WINDOW_Y            = 0.0
        // Max messages that will be saved
        private     constant    integer         MAX_SAVED           = 250
        // Maximum length of entered message
        private     constant    integer         MAX_LENGTH          = 128
        // True to initialy open chat window for all players
        private     constant    boolean         INITIALY_OPEN       = true
        // True to attach time tag on each message
        private     constant    boolean         SHOW_TIME_TAG       = true
        // True to show title at the top of chat window
        private     constant    boolean         SHOW_TITLE          = true
        // True to show background behind texts
        private     constant    boolean         SHOW_OUTFIT         = true
        // True to allow player to scroll up/down
        private     constant    boolean         SCROLL_ENABLED      = true
        // Lock the camera when scrolling
        private     constant    boolean         SCROLL_LOCK_CAMERA  = true
        // Set the scroll rate
        private     constant    real            SCROLL_RATE         = .1
        // Delay before auto-scrolling started
        private     constant    real            SCROLL_DELAY        = .4
        // Delay for host to announce something
        private     constant    integer         ANNOUNCE_DELAY      = 15
        // Timer to check flooding. 0 to disable anti-flood
        private     constant    integer         FLOOD_CHECK_TIMER   = 5
        // Max message every FLOOD_CHECK_TIMER seconds
        private     constant    integer         FLOOD_CHAT_MAX      = 5
   /*                                                                                                  *
    ****************************************************************************************************
    * 5. Notifications                                                                                 *
    *       (You may disable these notifications by setting them to null)                              *
    *                                                                                                  */
        // Will be shown when player enters invalid command
        private     constant    string          NOTIFICATION_1      = "|CFFFF0000INVALID COMMAND|r"
        // Will be shown when player enters too long message
        private     constant    string          NOTIFICATION_2      = "|CFFFF0000MESSAGE OVERSIZED|r"
        // Will be shown when pm target is unidentified
        private     constant    string          NOTIFICATION_3      = "|CFFFF0000INVALID RECIPIENT|r"
        // Will be shown when pm target is unavailable
        private     constant    string          NOTIFICATION_4      = "|CFFFF0000RECIPIENT IS UNAVAILABLE|r"
        // Will be shown when not host player tries to announce something
        private     constant    string          NOTIFICATION_5      = "|CFFFF0000YOU DONT HAVE THE AUTHORITY|r"
        // Will be shown when player floods
        private     constant    string          NOTIFICATION_6      = "|CFFFF0000DON'T FLOOD!|r"
        // Will be shown when host trying to announce something too often/before delay timer expired
        private     constant    string          NOTIFICATION_7      = "|CFFFF0000YOU CAN'T SEND ANNOUNCEMENT TOO OFTEN|r"
        // Will be shown when player sends pm successfuly. Ex: "|CFF00FF00PRIVATE MESSAGE HAS BEEN SENT|r"
        private     constant    string          NOTIFICATION_8      = null
        // Will be shown if message contains one of restricted words
        private     constant    string          NOTIFICATION_9      = "|CFFFF0000MESSAGE CONTAINS RESTRICTED WORD(S)|r"
        // Will be shown if reject/unreject target is invalid
        private     constant    string          NOTIFICATION_10     = "|CFFFF0000UNABLE TO REJECT/UNREJECT TARGET|r"
        // Will be shown when target successfuly added/removed to reject list
        private     constant    string          NOTIFICATION_11     = "|CFF00FF00TARGET HAS BEEN ADDED/REMOVED TO/FROM REJECT LIST|r"
        
    endglobals
    
    private function setName takes nothing returns nothing
   /*                                                                                                  *
    ****************************************************************************************************
    * 6. Nickname colors                                                                               *
    *                                                                                                  */
        set PLAYER_COLOR[0] = "|CFFFF0303"  // Player 1
        set PLAYER_COLOR[1] = "|CFF0042FF"
        set PLAYER_COLOR[2] = "|CFF00FFFF"
        set PLAYER_COLOR[3] = "|CFF540081"
        set PLAYER_COLOR[4] = "|CFFFFFF01"
        set PLAYER_COLOR[5] = "|CFFFE8A0E"
        set PLAYER_COLOR[6] = "|CFF20C000"
        set PLAYER_COLOR[7] = "|CFFE55BB0"
        set PLAYER_COLOR[8] = "|CFF959697"
        set PLAYER_COLOR[9] = "|CFF7EBFF1"
        set PLAYER_COLOR[10] = "|CFF106246"
        set PLAYER_COLOR[11] = "|CFF4E2A04" // Player 12
   /*                                                                                                  *
    *                                                                                                  *
    ****************************************************************************************************
    *                                                                                                  *
    *          END OF CONFIGURATIONS                                                                   *
    *                                                                                                  *
    ***************************************************************************************************/
    
    endfunction
    
    private keyword chatevent
    
    globals
        private                 boolean array   Open
        private                 force array     RejectList
        private                 integer         AnnounceTimer           = 0
        private                 integer         GameTime                = 0
        private                 integer array   ScrollInt
        private                 integer array   ScrollDirection
        private                 integer array   LastChatCtgry
        private                 integer array   LastPMTarget
        private                 integer array   FloodCounter
        private                 integer array   FloodTimer
        private                 integer array   MessageTotal
        public                  player          Host                    = Player(PLAYER_NEUTRAL_PASSIVE)
        public                  player          EVT_Reciever            = null
        public                  player          EVT_Sender              = null
        public                  real            EVT_Trigger             = -1
        public                  real array      ScrollDelay
        public                  string          EVT_Message             = ""
        private                 string          GameTimes               = "00" + TIME_DEVIDER + "00"
        private                 timer           SwearTimer              = CreateTimer()
        private                 trigger         ScrollTrigger           = CreateTrigger()
                                trigger         ChatTrigger             = CreateTrigger()
        private                 unit array      CameraLocker
        private                 Table array     MessageBox[11]
                                chatevent       EVENT_CHAT_ANY          = 0
                                chatevent       EVENT_CHAT_ALL          = 1
                                chatevent       EVENT_CHAT_TEAM         = 2
                                chatevent       EVENT_CHAT_PRIVATE      = 3
                                chatevent       EVENT_CHAT_SYSTEM       = 4
                                chatevent       EVENT_CHAT_ANNOUNCE     = 5
    endglobals
    
    private struct chatevent
    endstruct
    
    private function showOutfit takes nothing returns nothing
        call SetCineFilterTexture(OUTFIT_PATH)
        call SetCineFilterBlendMode(OUTFIT_BLENDING)
        call SetCineFilterStartUV(0, 0, 1, 1)
        call SetCineFilterStartColor(255, 255, 255, 255)
        call SetCineFilterDuration(86400)
        call DisplayCineFilter(true)
    endfunction
        
    private function recycle takes integer i returns nothing
        local integer i2 = 0
        local integer ext = MAX_SAVED - 1
        
        loop
            set i2 = i2 + 1
            set MessageBox[i].string[i2] = MessageBox[i].string[i2 + 1]
            exitwhen i2 >= ext
        endloop
    endfunction
    
    private function update takes integer i returns nothing
        local integer i2
        local integer ext
        local player p = Player(i)
        
        if GetLocalPlayer() == p then
            call ClearTextMessages()
        endif
        static if SHOW_TITLE then
            call DisplayTimedTextToPlayer(p, WINDOW_X, WINDOW_Y, 0.0, TITLE)
        endif
        if MessageTotal[i] < WINDOW_SIZE + ScrollInt[i] then
            // Adding spaces between the first shown message and the title
            set i2 = 0
            set ext = WINDOW_SIZE - MessageTotal[i] + ScrollInt[i]
            loop
                exitwhen i2 >= ext
                call DisplayTimedTextToPlayer(p, WINDOW_X, WINDOW_Y, 0.0, " ")
                set i2 = i2 + 1
            endloop
        endif
        // Show messages
        set i2 = MessageTotal[i] - WINDOW_SIZE + 1 - ScrollInt[i]
        set ext = MessageTotal[i] - ScrollInt[i]
        loop
            exitwhen i2 > ext
            if MessageBox[i].string[i2] != null then
                call DisplayTimedTextToPlayer(p, WINDOW_X, WINDOW_Y, 0.0, MessageBox[i].string[i2])
            endif
            set i2 = i2 + 1
        endloop
    endfunction
    
    private function updateWindow takes integer i returns nothing
        if Open[i] then
            call update(i)
        endif
    endfunction
    
    private function showDebug takes integer pn, string msg returns nothing
        local player reciever_backup
        local string message_backup
        
        if GetPlayerController(Player(pn)) == MAP_CONTROL_USER  then
            if MessageTotal[pn] >= MAX_SAVED then
                call recycle(pn)
            else
                set MessageTotal[pn] = MessageTotal[pn] + 1
            endif
            static if SHOW_TIME_TAG then
                set MessageBox[pn].string[MessageTotal[pn]] = SM_PREFIX + " " + TIME_BRACKET1 + GameTimes + TIME_BRACKET2 + " " + msg
            else
                set MessageBox[pn].string[MessageTotal[pn]] = SM_PREFIX + " " + msg
            endif
            call updateWindow(pn)
            set reciever_backup = EVT_Reciever
            set message_backup = EVT_Message
            set EVT_Reciever = Player(pn)
            set EVT_Message = msg
            set EVT_Trigger = EVENT_CHAT_SYSTEM
            set EVT_Trigger = EVENT_CHAT_ANY
            set EVT_Trigger = -1
            set EVT_Reciever = reciever_backup
            set EVT_Message = message_backup
        endif
    endfunction
    
    private function save takes integer ctgry, integer i, string msg returns nothing
        local player reciever_backup = EVT_Reciever
        
        set EVT_Reciever = Player(i)
        if GetPlayerController(EVT_Reciever) == MAP_CONTROL_USER  then
            if MessageTotal[i] >= MAX_SAVED then
                call recycle(i)
            else
                set MessageTotal[i] = MessageTotal[i] + 1
            endif
            set MessageBox[i].string[MessageTotal[i]] = msg
            call updateWindow(i)
        endif
        set EVT_Trigger = ctgry
        set EVT_Trigger = EVENT_CHAT_ANY
        set EVT_Trigger = -1
        set EVT_Reciever = reciever_backup
    endfunction
    
    private function process takes integer ctgry, integer pn, string msg returns nothing
        local integer i = 0
        local integer i2
        local player sender_backup = EVT_Sender
        local string message_backup = EVT_Message
        
        set EVT_Sender = Player(pn)
        set EVT_Message = msg
        // If chat ALL
        if ctgry == EVENT_CHAT_ALL then
            static if SHOW_TIME_TAG then
                set msg = AM_PREFIX + " " + TIME_BRACKET1 + GameTimes + TIME_BRACKET2 + " " + PLAYER_NAME[pn] + EQUAL_SYMBOL + " " + msg
            else
                set msg = AM_PREFIX + " " + PLAYER_NAME[pn] + EQUAL_SYMBOL + " " + msg
            endif
            loop
                exitwhen i > 11
                if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                    if not IsPlayerInForce(EVT_Sender, RejectList[i]) then
                        call save(ctgry, i, msg)
                    endif
                endif
                set i = i + 1
            endloop
        // If chat PRIVATE
        elseif ctgry == EVENT_CHAT_PRIVATE then
            static if SHOW_TIME_TAG then
                set msg = PM_PREFIX + " " + TIME_BRACKET1 + GameTimes + TIME_BRACKET2 + " " + PLAYER_NAME[pn] + EQUAL_SYMBOL + " " + msg
            else
                set msg = PM_PREFIX + " " + PLAYER_NAME[pn] + EQUAL_SYMBOL + " " + msg
            endif
            if LastPMTarget[pn] != pn and LastPMTarget[pn] >= 0 and LastPMTarget[pn] <= 11 then
                if GetPlayerSlotState(Player(LastPMTarget[pn])) == PLAYER_SLOT_STATE_PLAYING then
                    if not IsPlayerInForce(EVT_Sender, RejectList[LastPMTarget[pn]]) then
                        if NOTIFICATION_8 != null then
                            call showDebug(pn, NOTIFICATION_8)
                        endif
                        call save(ctgry, LastPMTarget[pn], msg)
                    endif
                elseif NOTIFICATION_4 != null then
                    call showDebug(pn, NOTIFICATION_4)
                endif
            elseif NOTIFICATION_3 != null then
                call showDebug(pn, NOTIFICATION_3)
            endif
        // If chat TEAM
        elseif ctgry == EVENT_CHAT_TEAM then
            static if SHOW_TIME_TAG then
                set msg = TM_PREFIX + " " + TIME_BRACKET1 + GameTimes + TIME_BRACKET2 + " " + PLAYER_NAME[pn] + EQUAL_SYMBOL + " " + msg
            else
                set msg = TM_PREFIX + " " + PLAYER_NAME[pn] + EQUAL_SYMBOL + " " + msg
            endif
            loop
                exitwhen i > 11
                if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                    if not IsPlayerInForce(EVT_Sender, RejectList[i]) then
                        if IsPlayerAlly(EVT_Sender, Player(i)) then
                            call save(ctgry, i, msg)
                        endif
                    endif
                endif
                set i = i + 1
            endloop
        endif
        set EVT_Message = message_backup
        set EVT_Sender = sender_backup
    endfunction
    
    private function chatEvent takes nothing returns boolean
        local integer i
        local integer i2
        local integer len
        local integer len2
        local integer pn = GetPlayerId(GetTriggerPlayer())
        local integer t
        local player reciever_backup
        local player sender_backup
        local string msg
        local string cmd
        local string message_backup
        
        if GetEventPlayerChatStringMatched() != "" and TimerGetRemaining(SwearTimer) == 0 then
            if NOTIFICATION_9 != null then
                call showDebug(pn, NOTIFICATION_9)
            endif
            call TimerStart(SwearTimer, 0.01, false, null)
        endif
        // If there is no restricted word
        if TimerGetRemaining(SwearTimer) == 0  then
            set msg = GetEventPlayerChatString()
            set cmd = SubString(msg, 0, 1)
            // If entered message is a command
            if cmd == CMD_PREFIX then
                set len = StringLength(CMD_PREFIX)
                // If open command
                if SubString(msg, len, len + StringLength(CMD_OPEN)) == CMD_OPEN then
                    set Open[pn] = true
                    static if SHOW_OUTFIT then
                        if GetLocalPlayer() == GetTriggerPlayer() then
                            call showOutfit()
                        endif
                    endif
                    call update(pn)
                // If close command
                elseif SubString(msg, len, len + StringLength(CMD_CLOSE)) == CMD_CLOSE then
                    set Open[pn] = false
                    static if SHOW_OUTFIT then
                        if GetLocalPlayer() == GetTriggerPlayer() then
                            call ClearTextMessages()
                            static if SHOW_OUTFIT then
                                call DisplayCineFilter(false)
                            endif
                        endif
                    endif
                // If clear command
                elseif SubString(msg, len, len + StringLength(CMD_CLEAR)) == CMD_CLEAR then
                    set MessageTotal[pn] = 0
                    set ScrollInt[pn] = 0
                    call updateWindow(pn)
                // If reject command
                elseif SubString(msg, len, len + StringLength(CMD_BAN)) == CMD_BAN then
                    set t = S2I(SubString(msg, len + StringLength(CMD_BAN), len + StringLength(CMD_BAN) + 2)) - 1
                    if t != pn and t >= 0 then
                        if NOTIFICATION_11 != null then
                            call showDebug(pn, NOTIFICATION_11)
                        endif
                        call ForceAddPlayer(RejectList[pn], Player(t))
                    elseif NOTIFICATION_10 != null then
                        call showDebug(pn, NOTIFICATION_10)
                    endif
                // If unreject command
                elseif SubString(msg, len, len + StringLength(CMD_UNBAN)) == CMD_UNBAN then
                    set t = S2I(SubString(msg, len + StringLength(CMD_UNBAN), len + StringLength(CMD_UNBAN) + 2)) - 1
                    if t != pn and t >= 0 then
                        if NOTIFICATION_11 != null then
                            call showDebug(pn, NOTIFICATION_11)
                        endif
                        call ForceRemovePlayer(RejectList[pn], Player(t))
                    elseif NOTIFICATION_10 != null then
                        call showDebug(pn, NOTIFICATION_10)
                    endif
                // If command string is invalid or doesn't match any command
                elseif NOTIFICATION_1 != null then
                    call showDebug(pn, NOTIFICATION_1)
                endif
            // If entered message is a messaging prefix
            elseif cmd == MSG_PREFIX then
                set len = StringLength(MSG_PREFIX)
                if StringLength(msg) - len <= MAX_LENGTH then
                    // If chat ALL
                    if SubString(msg, len, len + StringLength(MSG_ALL)) == MSG_ALL then
                        set FloodTimer[pn] = FLOOD_CHECK_TIMER
                        set FloodCounter[pn] = FloodCounter[pn] + 1
                        set LastChatCtgry[pn] = EVENT_CHAT_ALL
                        if FloodCounter[pn] <= FLOOD_CHAT_MAX then
                            // If GradientText exists, process the message first
                            static if LIBRARY_GradientText then
                                set msg = GradientText(msg)
                            endif
                            call process(EVENT_CHAT_ALL, pn, SubString(msg, len + StringLength(MSG_ALL) + 1, StringLength(msg)))
                        elseif NOTIFICATION_6 != null then
                            call showDebug(pn, NOTIFICATION_6)
                        endif
                    // If chat PRIVATE
                    elseif SubString(msg, len, len + StringLength(MSG_PRIVATE)) == MSG_PRIVATE then
                        set FloodTimer[pn] = FLOOD_CHECK_TIMER
                        set FloodCounter[pn] = FloodCounter[pn] + 1
                        set LastChatCtgry[pn] = EVENT_CHAT_PRIVATE
                        if FloodCounter[pn] <= FLOOD_CHAT_MAX then
                            set len2 = StringLength(MSG_PRIVATE)
                            set LastPMTarget[pn] = S2I(SubString(msg, len + len2, len + len2 + 2)) - 1
                            // If GradientText exists, process the message first
                            static if LIBRARY_GradientText then
                                set msg = GradientText(msg)
                            endif
                            call process(EVENT_CHAT_PRIVATE, pn, SubString(msg, len + len2 + StringLength(I2S(LastPMTarget[pn] + 1)) + 1, StringLength(msg)))
                        elseif NOTIFICATION_6 != null then
                            call showDebug(pn, NOTIFICATION_6)
                        endif
                    // If chat TEAM
                    elseif SubString(msg, len, len + StringLength(MSG_TEAM)) == MSG_TEAM then
                        set FloodTimer[pn] = FLOOD_CHECK_TIMER
                        set FloodCounter[pn] = FloodCounter[pn] + 1
                        set LastChatCtgry[pn] = EVENT_CHAT_TEAM
                        if FloodCounter[pn] <= FLOOD_CHAT_MAX then
                            // If GradientText exists, process the message first
                            static if LIBRARY_GradientText then
                                set msg = GradientText(msg)
                            endif
                            call process(EVENT_CHAT_TEAM, pn, SubString(msg, len + StringLength(MSG_TEAM) + 1, StringLength(msg)))
                        elseif NOTIFICATION_6 != null then
                            call showDebug(pn, NOTIFICATION_6)
                        endif
                    // If chat ANNOUNCEMENT
                    elseif SubString(msg, len, len + StringLength(MSG_ANNOUNCEMENT)) == MSG_ANNOUNCEMENT then
                        if GetTriggerPlayer() == Host then
                            if AnnounceTimer == 0 then
                                set AnnounceTimer = ANNOUNCE_DELAY
                                // If GradientText exists, process it first
                                static if LIBRARY_GradientText then
                                    set msg = GradientText(SubString(msg, len + StringLength(MSG_ANNOUNCEMENT) + 1, StringLength(msg)))
                                else
                                    set msg = SubString(msg, len + StringLength(MSG_ANNOUNCEMENT) + 1, StringLength(msg))
                                endif
                                set sender_backup = EVT_Sender
                                set message_backup = EVT_Message
                                set EVT_Sender = GetTriggerPlayer()
                                set EVT_Message = msg
                                static if SHOW_TIME_TAG then
                                    set msg = SM_PREFIX + " " + TIME_BRACKET1 + GameTimes + TIME_BRACKET2 + " " + ANNOUNCEMENT + EQUAL_SYMBOL + " " + msg
                                else
                                    set msg = SM_PREFIX + " " + ANNOUNCEMENT + EQUAL_SYMBOL + " " + msg
                                endif
                                set i = 0
                                loop
                                    exitwhen i > 11
                                    if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                                        if not IsPlayerInForce(EVT_Sender, RejectList[i]) then
                                            if MessageTotal[i] >= MAX_SAVED then
                                                call recycle(i)
                                            endif
                                            set MessageTotal[i] = MessageTotal[i] + 1
                                            set MessageBox[i].string[MessageTotal[i]] = msg
                                            call updateWindow(i)
                                            set reciever_backup = EVT_Reciever
                                            set EVT_Reciever = Player(i)
                                            set EVT_Trigger = EVENT_CHAT_ANNOUNCE
                                            set EVT_Trigger = EVENT_CHAT_ANY
                                            set EVT_Trigger = -1
                                            set EVT_Reciever = reciever_backup
                                        endif
                                    endif
                                    set i = i + 1
                                endloop
                                set EVT_Sender = sender_backup
                                set EVT_Message = message_backup
                            // If still in announce delay
                            elseif NOTIFICATION_7 != null then
                                call showDebug(pn, NOTIFICATION_7)
                            endif
                        // If don't have authority
                        elseif NOTIFICATION_5 != null then
                            call showDebug(pn, NOTIFICATION_5)
                        endif
                    // If messaging command is invalid
                    elseif NOTIFICATION_1 != null then
                        call showDebug(pn, NOTIFICATION_1)
                    endif
                // If message outsized the limit
                elseif NOTIFICATION_2 != null then
                    call showDebug(pn, NOTIFICATION_2)
                endif
            // If message contains no command or messaging prefix
            elseif SubString(msg, 0, StringLength(CMD_SPECIAL)) != CMD_SPECIAL then
                if StringLength(msg) <= MAX_LENGTH then
                    set FloodCounter[pn] = FloodCounter[pn] + 1
                    set FloodTimer[pn] = FLOOD_CHECK_TIMER
                    if FloodCounter[pn] <= FLOOD_CHAT_MAX then
                        static if LIBRARY_GradientText then
                            call process(LastChatCtgry[pn], pn, GradientText(msg))
                        else
                            call process(LastChatCtgry[pn], pn, msg)
                        endif
                    elseif NOTIFICATION_6 != null then
                        call showDebug(pn, NOTIFICATION_6)
                    endif
                elseif NOTIFICATION_2 != null then
                    call showDebug(pn, NOTIFICATION_2)
                endif
            endif
        endif
        return false
    endfunction
    
    private function time takes nothing returns nothing
        local string s1
        local string s2
        local integer i
        
        if AnnounceTimer > 0 then
            set AnnounceTimer = AnnounceTimer - 1
        endif
        set i = 0
        loop
            exitwhen i > 11
            if FloodTimer[i] == 0 then
                set FloodCounter[i] = 0
            else
                set FloodTimer[i] = FloodTimer[i] - 1
            endif
            set i = i + 1
        endloop
        set GameTime = GameTime + 1
        set s1 = I2S(GameTime / 60)
        set s2 = I2S(GameTime - GameTime / 60 * 60)
        if StringLength(s1) == 1 then
            set s1 = "0" + s1
        endif
        if StringLength(s2) == 1 then
            set s2 = "0" + s2
        endif
        set GameTimes = s1 + TIME_DEVIDER + s2
    endfunction
    
    private function scrollLoop takes nothing returns boolean
        local integer i = 0
        local integer c = 0
        
        loop
            exitwhen i > 11
            if ScrollDirection[i] > 0 then
                set c = c + ScrollDirection[i]
                if ScrollDelay[i] <= 0 then
                    if ScrollDirection[i] == 1 then
                        if ScrollInt[i] < MessageTotal[i] - 1 then
                            set ScrollInt[i] = ScrollInt[i] + 1
                        endif
                    elseif ScrollDirection[i] == 2 then
                        if ScrollInt[i] > 0 then
                            set ScrollInt[i] = ScrollInt[i] - 1
                        endif
                    endif
                    if Open[i] then
                        call update(i)
                    endif
                else
                    set ScrollDelay[i] = ScrollDelay[i] - SCROLL_RATE
                endif
            endif
            set i = i + 1
        endloop
        // If there is no player is currently scrolling
        if c == 0 then
            call DisableTrigger(ScrollTrigger)
        endif
        return false
    endfunction
    
    private function scrollOn takes integer i returns nothing
        call updateWindow(i)
        static if SCROLL_LOCK_CAMERA then
            call SetUnitX(CameraLocker[i], GetCameraTargetPositionX())
            call SetUnitY(CameraLocker[i], GetCameraTargetPositionY())
            if GetLocalPlayer() == GetTriggerPlayer() then
                call SetCameraTargetController(CameraLocker[i], 0.0, 0.0, false)
            endif
        endif
    endfunction
    
    private function scrollOff takes nothing returns boolean
        set ScrollDirection[GetPlayerId(GetTriggerPlayer())] = 0
        if GetLocalPlayer() == GetTriggerPlayer() then
            call ResetToGameCamera(0.0)
        endif
        return false
    endfunction
    
    private function scrollUp takes nothing returns boolean
        local integer i = GetPlayerId(GetTriggerPlayer())
        
        if ScrollDirection[i] == 0 and Open[i] then
            set ScrollDirection[i] = 1
            set ScrollDelay[i] = SCROLL_DELAY
            if SCROLL_DELAY > 0 then
                if ScrollInt[i] < MessageTotal[i] - 1 then
                    set ScrollInt[i] = ScrollInt[i] + 1
                endif
            endif
            call scrollOn(i)
        endif
        if not IsTriggerEnabled(ScrollTrigger) then
            call EnableTrigger(ScrollTrigger)
        endif
        return false
    endfunction
    
    private function scrollDown takes nothing returns boolean
        local integer i = GetPlayerId(GetTriggerPlayer())
        
        if ScrollDirection[i] == 0 and Open[i] then
            set ScrollDirection[i] = 2
            set ScrollDelay[i] = SCROLL_DELAY
            if SCROLL_DELAY > 0 then
                if ScrollInt[i] > 0 then
                    set ScrollInt[i] = ScrollInt[i] - 1
                endif
            endif
            call scrollOn(i)
        endif
        if not IsTriggerEnabled(ScrollTrigger) then
            call EnableTrigger(ScrollTrigger)
        endif
        return false
    endfunction
    
    private function ini takes nothing returns nothing
        local trigger t1 = CreateTrigger()
        local trigger t2 = CreateTrigger()
        local trigger t3 = CreateTrigger()
        local integer i = 0
        local player p
        
        call setName()
        loop
            exitwhen i > 11
            set p = Player(i)
            if GetPlayerController(p) == MAP_CONTROL_USER and GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then
                static if SCROLL_ENABLED then
                    call TriggerRegisterPlayerEvent(t1, p, EVENT_PLAYER_ARROW_UP_DOWN)
                    call TriggerRegisterPlayerEvent(t2, p, EVENT_PLAYER_ARROW_DOWN_DOWN)
                    call TriggerRegisterPlayerEvent(t3, p, EVENT_PLAYER_ARROW_UP_UP)
                    call TriggerRegisterPlayerEvent(t3, p, EVENT_PLAYER_ARROW_DOWN_UP)
                    static if SCROLL_LOCK_CAMERA then
                        set CameraLocker[i] = CreateUnit(Player(bj_PLAYER_NEUTRAL_EXTRA), 'ewsp', 0.0, 0.0, 0.0)
                        call ShowUnit(CameraLocker[i], false)
                    endif
                endif
                static if not LIBRARY_UCSRestrictWord then
                    call TriggerRegisterPlayerChatEvent(ChatTrigger, p, "", false)
                endif
                set FloodTimer[i] = 0
                set FloodCounter[i] = 0
                set LastChatCtgry[i] = EVENT_CHAT_ALL
                set MessageBox[i] = Table.create()
                set MessageTotal[i] = 0
                set RejectList[i] = CreateForce()
                set ScrollDirection[i] = 0
                set ScrollInt[i] = 0
                static if INITIALY_OPEN then
                    set Open[i] = true
                    static if SHOW_OUTFIT then
                        if GetLocalPlayer() == Player(i) then
                            call showOutfit()
                        endif
                    endif
                    call update(i)
                else
                    set Open[i] = false
                endif
            else
                set Open[i] = false
            endif
            set PLAYER_NAME[i] = PLAYER_COLOR[i] + GetPlayerName(p) + "|r"
            set i = i + 1
        endloop
        static if SCROLL_ENABLED then
            call TriggerRegisterTimerEvent(ScrollTrigger, SCROLL_RATE, true)
            call TriggerAddCondition(ScrollTrigger, Condition(function scrollLoop))
            call TriggerAddCondition(t1, Condition(function scrollUp))
            call TriggerAddCondition(t2, Condition(function scrollDown))
            call TriggerAddCondition(t3, Condition(function scrollOff))
            call DisableTrigger(ScrollTrigger)
        else
            call DestroyTrigger(t1)
            call DestroyTrigger(t2)
            call DestroyTrigger(t3)
            set t1 = null
            set t2 = null
            set t3 = null
        endif
        call TriggerAddCondition(ChatTrigger, Condition(function chatEvent))
        call TimerStart(CreateTimer(), 1, true, function time)
    endfunction
    
    function AddRestrictedWord takes string s returns nothing
        local integer i = 0
        
        loop
            exitwhen i > 11
            call TriggerRegisterPlayerChatEvent(ChatTrigger, Player(i), s, false)
            set i = i + 1
        endloop
    endfunction
    
    function SetUCSTitle takes string s returns nothing
        local integer i = 0
        
        set TITLE = s
        loop
            exitwhen i > 11
            call updateWindow(i)
            set i = i + 1
        endloop
    endfunction
    
    function SetUCSHost takes player p returns nothing
        set Host = p
    endfunction
    
    function OpenUCSChatWindow takes integer pn returns nothing
        set Open[pn] = true
        static if SHOW_OUTFIT then
            if GetLocalPlayer() == Player(pn) then
                call showOutfit()
            endif
        endif
        call update(pn)
    endfunction
    
    function CloseUCSChatWindow takes integer pn returns nothing
        set Open[pn] = false
        if GetLocalPlayer() == Player(pn) then
            call ClearTextMessages()
            static if SHOW_OUTFIT then
                call DisplayCineFilter(false)
            endif
        endif
    endfunction
    
    function GetUCSElapsedGameTime takes nothing returns string
        return GameTimes
    endfunction
    
    function GetUCSNickname takes integer pn returns string
        return PLAYER_NAME[pn]
    endfunction
    
    function SetUCSNickname takes integer pn, string s returns nothing
        local integer i = 0
        
        set PLAYER_NAME[pn - 1] = PLAYER_COLOR[pn - 1] + s + "|r"
        loop
            exitwhen i > 11
            call updateWindow(i)
            set i = i + 1
        endloop
    endfunction
    
    function SendUCSChatAll takes integer sender, string msg returns nothing
        call process(EVENT_CHAT_ALL, sender, msg)
    endfunction
    
    function SendUCSChatPrivate takes integer sender, integer reciever, string msg returns nothing
        set LastPMTarget[sender] = reciever
        call process(EVENT_CHAT_PRIVATE, sender, msg)
    endfunction
    
    function SendUCSChatTeam takes integer sender, string msg returns nothing
        call process(EVENT_CHAT_TEAM, sender, msg)
    endfunction
    
    function SendUCSChatSystem takes integer reciever, string msg returns nothing
        call showDebug(reciever, msg)
    endfunction
    
    function TriggerRegisterUCSChatEvent takes trigger t, chatevent whichEvent returns nothing
        call TriggerRegisterVariableEvent(t, "UltimateChat_EVT_Trigger", EQUAL, whichEvent)
    endfunction
    
    function GetUCSSender takes nothing returns player
        return EVT_Sender
    endfunction
    
    function GetUCSReciever takes nothing returns player
        return EVT_Reciever
    endfunction
    
    function GetUCSMessage takes nothing returns string
        return EVT_Message
    endfunction
    
endlibrary


Changelog
Attached Files
File Type: w3x UCS v2.4.w3x (317.1 KB, 1 views)
..... is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-01-2014, 10:50 AM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,080

Submissions (19)

Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by .....
This is only for advertising purpose.. Get real updates only at thw
If you are not going to maintain the system here, then you should not post it here.
__________________
Anitarf is offline   Reply With Quote
Old 04-01-2014, 02:42 PM   #3
.....
User
 
Join Date: Feb 2014
Posts: 8

..... has little to show at this moment (0)

Default

if only this site is still alive, I will maintain it ofcourse :) but it's not
..... is offline   Reply With Quote
Old 04-01-2014, 03:29 PM   #4
Rao Dao Zao
www.raodaozao.net
 
Rao Dao Zao's Avatar


MDL & Resource Moderator
 
Join Date: Aug 2003
Posts: 2,441

Submissions (27)

Rao Dao Zao has a brilliant future (817)Rao Dao Zao has a brilliant future (817)Rao Dao Zao has a brilliant future (817)Rao Dao Zao has a brilliant future (817)Rao Dao Zao has a brilliant future (817)Rao Dao Zao has a brilliant future (817)

Approved Map: When the Freedom Slips Away

Send a message via MSN to Rao Dao Zao
Default

Quote:
Originally Posted by .....
if only this site is still alive, I will maintain it ofcourse :) but it's not
if the site isn't alive, why post here at all?????
__________________
Rao Dao Zao is offline   Reply With Quote
Old 04-01-2014, 06:21 PM   #5
Kyrbi0
~There we go~
 
Kyrbi0's Avatar
 
Join Date: May 2008
Posts: 2,901

Submissions (1)

Kyrbi0 is a jewel in the rough (152)Kyrbi0 is a jewel in the rough (152)

Send a message via MSN to Kyrbi0
Default

To be fair, this is kind of what I plan to do, but in reverse ("real" post/upload here, "advertisement" post on THW).

Looks interesting. Why would I use this instead of the built-in chatting? Or does it fully replace it?
__________________
My Projects, Resources, + Tutorials: ~Just got back from my mission. Glad to be back. Woot! :P~
=It was brought to my attention recently that the ":P" icon stands for "tongue-sticking out", and not the "smirky half-smile" I was using it for all these years. = Thusly I apologize for any unintentional juvenilization of my messages to anyone so afflicted.=
Kyrbi0 is offline   Reply With Quote
Old 04-01-2014, 09:21 PM   #6
.....
User
 
Join Date: Feb 2014
Posts: 8

..... has little to show at this moment (0)

Default

Quote:
if the site isn't alive, why post here at all?????
let me repeat, for advertising purpose :>

Quote:
To be fair, this is kind of what I plan to do, but in reverse ("real" post/upload here, "advertisement" post on THW).
why not stay at thw?

Quote:
Looks interesting. Why would I use this instead of the built-in chatting? Or does it fully replace it?
everything is easier using this system, ugh.. I have explained about this so many times, so just try to understand the description or try the demo map, I won't repeat it again D:
thnks for comment..
..... is offline   Reply With Quote
Old 04-02-2014, 01:19 PM   #7
Kyrbi0
~There we go~
 
Kyrbi0's Avatar
 
Join Date: May 2008
Posts: 2,901

Submissions (1)

Kyrbi0 is a jewel in the rough (152)Kyrbi0 is a jewel in the rough (152)

Send a message via MSN to Kyrbi0
Default

Quote:
Originally Posted by .....
let me repeat, for advertising purpose :>
I think the issue is, this site has such a long & storied history, it is a bit of a "slap-to-the-face" to think someone would use it merely for advertising. Some might consider it disrespectful.

Quote:
Originally Posted by .....
why not stay at thw?
Because I prefer this site. Granted, I may spend much of my time over there, and Wc3C may be (effectively, in terms of activity) deceased, but this site is my home, and I long ago determined that everything I do will come through here. It's enough of a oath-bending to consider putting it up on THW at all.

But that's just me personally. Not everyone feels as strongly as I do (and some feel more so).


Quote:
Originally Posted by .....
everything is easier using this system, ugh.. I have explained about this so many times, so just try to understand the description or try the demo map, I won't repeat it again D:
thnks for comment..
Point taken; I did not really read the description. However, your exasperation is unappealing.
__________________
My Projects, Resources, + Tutorials: ~Just got back from my mission. Glad to be back. Woot! :P~
=It was brought to my attention recently that the ":P" icon stands for "tongue-sticking out", and not the "smirky half-smile" I was using it for all these years. = Thusly I apologize for any unintentional juvenilization of my messages to anyone so afflicted.=
Kyrbi0 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:34 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services