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.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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