System Chat System

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Everything is in the READ ME.

Code:
Well this a system to all of you that hate WarCraft's chat interface, where you have to keep 
pressing on F12 to change chat settings, this system is very simple, you write "Send destination:
Message" for example "Send all: Hi, this is an example". The list is:

All ("Send All: message" -- Will show to all players your message)
Allies  ("Send Allies: message" -- Will show to all allies your message)
Enemies  ("Send Enemies: message" -- Will show to all enemies your message)
Player's Number ("Send X: message" -- Will show to player X your message)
Player's Color  ("Send Color: message" -- Will show to player <color> your message)
Player's Name  ("Send Name: message" -- Will show to <name> player your message)

This was originally made to increase my skill with substrings, but I thought posting it wouldn't
hurt. ;) Thanks Tom Jones for spotting a bug in my code! In order to use this system simply copy
the trigger ChatSys and you are done.

If you are using this system I suggest you hide players' messages. Here is a tutorial on how to 
do that by shadow1500: http://www.wc3campaigns.net/showthread.php?t=80691

Side Notes: Works with RoC as well.

Enjoy

JASS:

function ChatSys_Actions takes nothing returns nothing
    local player sender = GetTriggerPlayer()

    local string sent = GetEventPlayerChatString()
    local string letter = &quot;&quot;
    local string message = &quot;&quot;
    local string safety = SubString(sent,0,5)

    local integer readers = 0
    local integer counter = 0
    local integer length = StringLength(sent)
    local integer limit = 0
    local integer Id = GetPlayerId(sender)

    local string array colors
    local string array colored
    
    if safety == &quot;Send &quot; then
        set colors[0] = &quot;Red&quot;
        set colors[1] = &quot;Blue&quot;
        set colors[2] = &quot;Teal&quot;
        set colors[3] = &quot;Purple&quot;
        set colors[4] = &quot;Yellow&quot;
        set colors[5] = &quot;Orange&quot;
        set colors[6] = &quot;Green&quot;
        set colors[7] = &quot;Pink&quot;
        set colors[8] = &quot;Grey&quot;
        set colors[9] = &quot;Light Blue&quot;
        set colors[10] = &quot;Dark Green&quot;
        set colors[11] = &quot;Brown&quot;
        
        set colored[0] = &quot;|CFFFF0303&quot;
        set colored[1] = &quot;|CFF0042FF&quot;
        set colored[2] = &quot;|CFF1CB619&quot;
        set colored[3] = &quot;|CFF540081&quot;
        set colored[4] = &quot;|CFFFFFF01&quot;
        set colored[5] = &quot;|CFFFE8A0E&quot;
        set colored[6] = &quot;|CFF20C000&quot;
        set colored[7] = &quot;|CFFE55BB0&quot;
        set colored[8] = &quot;|CFF959697&quot;
        set colored[9] = &quot;|CFF7EBFF1&quot;
        set colored[10] = &quot;|CFF106246&quot;
        set colored[11] = &quot;|CFF4E2A04&quot;
        
        loop
           set letter = SubString(sent,counter,counter+1)
           if letter == &quot;:&quot; then
              set limit = counter 
              exitwhen true
          elseif counter + 1 == length then
              call DisplayTextToPlayer(sender,0.,0.,&quot;Error sending Message&quot;)
              exitwhen true
          endif
           set counter = counter + 1
        endloop
        set counter = 0
        set message = &quot;From &quot; + colored[Id] + GetPlayerName(sender) + &quot;|r: &quot; + SubString(sent,limit + 1,length)
        loop
            exitwhen counter &gt; length
            if SubString(sent,5,limit) == colors[counter] then
                call DisplayTextToPlayer(Player(counter),0.,0.,message)
                exitwhen true
            elseif SubString(sent,5,limit) == I2S(counter + 1) then
                call DisplayTextToPlayer(Player(counter),0.,0.,message)
                exitwhen true
            elseif SubString(sent,5,limit) == GetPlayerName(Player(counter)) then
                call DisplayTextToPlayer(Player(counter),0.,0.,message)
                exitwhen true
            elseif SubString(sent,5,limit) == &quot;all&quot; then
                loop
                    exitwhen readers &gt; 11
                    call DisplayTextToPlayer(Player(readers),0.,0.,message)
                    set readers = readers + 1
                endloop
                exitwhen true
            elseif SubString(sent,5,limit) == &quot;allies&quot; then
                loop
                    exitwhen readers &gt; 11
                    if IsPlayerAlly(sender,Player(readers)) then
                        call DisplayTextToPlayer(Player(readers),0.,0.,message)
                    endif 
                    set readers = readers + 1
                endloop
                exitwhen true
            elseif SubString(sent,5,limit) == &quot;enemies&quot; then
                loop
                    exitwhen readers &gt; 11
                    if not(IsPlayerAlly(sender,Player(readers))) then
                        call DisplayTextToPlayer(Player(readers),0.,0.,message)
                    endif 
                    set readers = readers + 1
                endloop
                exitwhen true
            endif
            set counter = counter + 1
        endloop
    endif

    set sender = null
endfunction

//===========================================================================
function InitTrig_ChatSys takes nothing returns nothing
    local integer counter = 0 
    set gg_trg_ChatSys = CreateTrigger()
    loop
        exitwhen counter == 11
        call TriggerRegisterPlayerChatEvent(gg_trg_ChatSys, Player(counter),&quot;&quot;,false)
        set counter = counter + 1
    endloop
    call TriggerAddAction(gg_trg_ChatSys,function ChatSys_Actions)
endfunction
 

Attachments

  • Chat System.w3m
    14.1 KB · Views: 236

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Bump, I would love to hear comments regarding this system.
 

ArmedCitizen

Kisses Cats
Reaction score
198
I can't comment on the actual make up of the system (the coding) but I can comment on the usefulness.

The first two are pretty easy to do without any special system. Hold Shift + Enter for All. Hold Ctrl + Enter for Allies. The Enemies chat seems like it would be useful along with the talk to Player # and Player Color. The Player Name is also easy with Blizzard's chat system, /w Player Name. I'd use this but only if I was really looking to customize a map.


Much better system then I could ever make. :D
 

Sim

Forum Administrator
Staff member
Reaction score
534
Whoa.

I typed in "Send All: lol". nothing happened.

I typed in "Send Allies: lol" and the game closed suddenly, without any error message :p
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Are you sure? This is a tested, working system, maybe you changed somthing by accident?
 

Sim

Forum Administrator
Staff member
Reaction score
534
I just opened it really. Tested alone though, without any other player in the game.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
I checked few more times it.

All players alone worked (name, number, color).
All players worked as well.
Allies and Enemies worked only once out of few tests, I guess I got lucky when I tested them before posting the system, I'll see if there is anyway to fix the problem. I tryed local player instead of Player(readers), but no luck there as well.
 

emjlr3

Change can be a good thing
Reaction score
395
graveyarded until updated working
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top