Author Topic: Chat Colors?  (Read 8743 times)

0 Members and 1 Guest are viewing this topic.

Offline Jaden Zepeda

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Chat Colors?
« on: December 21, 2014, 06:23:37 PM »
I know some servers where they can type [color]Text and the text in chat is that color, how do they do this? They can even type [rainbow]Text and its flashing rainbows.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Chat Colors?
« Reply #1 on: December 21, 2014, 07:56:18 PM »
PlayerSay is your friend (and can be a pain, as you can break ALL OTHER CHAT based mods if not done correctly)
You'll also need to use a substring and find in text to look for the "[" and ending "]" in the beginning, then read the word in-between them.
As for how to do the output text in color, I forget exactly, but I'd look over the releases section for the Player Chat Tags release. It will show you basic methods for just about all of your needs of color and chat output.

We'd much rather you learn on your own pace than give you direct code.
Keep it simple.
A recommendation - Don't go full functions inside of hooks or functions like you did on the last SteamGroup challenge.
Where you did
hook.add (blah, blah, function ()
....
end) , though perfectly 'legal' in lua, can make it more complex to understand when trying to troubleshoot/read it later.
I'd recommend using hook.Add ( blah, blah, function_name ) below the actual function.
Easier readability. Easier to learn I think, can see where variables are being passed to function easier.

Just my .02. Some devs are likely to disagree.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Jaden Zepeda

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Re: Chat Colors?
« Reply #2 on: December 22, 2014, 06:47:35 AM »
Alright ill give it a shot.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Chat Colors?
« Reply #3 on: December 22, 2014, 07:53:09 AM »
I would send you to the link on coderhire because its called HatsChat2 and its awesome i would put the file in but i think that illegal i don't know...

Offline Jaden Zepeda

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Re: Chat Colors?
« Reply #4 on: December 22, 2014, 11:04:01 AM »
Exactly what I was looking for, thanks.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Chat Colors?
« Reply #5 on: December 23, 2014, 06:42:05 AM »
The greatest thing about HatsChat2 is it also comes with chat tags!