Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
July 16, 2019, 10:40:04 pm

Author Topic: UTChat - Chat Replacement  (Read 9833 times)

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
UTChat - Chat Replacement
« on: January 03, 2014, 10:35:17 pm »

The Unified-Text Chat
Current Version: 1.0.0-alpha.4
Download   |   Source   |   Dev Wiki




What does UTChat do?

UTChat does a lot of things... here are a few of them.


UTChat uses UText, a robust text library that allows for all kinds of neat tricks with text, it is why this whole thing is possible.

UTChat can use Formats and Chat Handlers:
  • Formats are UText addons that apply fancy effects to text, such as Color, Shadow, and animated effects like Motion and Fade.
  • Chat Handlers are UTChat addons that "filter" UText objects -- You could make a word filter, apply formats to certain keywords, colorize certain players' text, or use advanced Lua to accomplish things such as in-text tags (like Color Tags).

Currently, UTChat comes with:
  • All of UText's formats: Color, Shadow, Motion, and Fade
  • Color Tags



How do I install UTChat to my server?

Yes, you need to read this. Grab some toast.


UTChat comes with an "Automatic Installation" for Integration (which allows it to grab chat prints from other modules)
It isn't fully automatic, but you can install UTChat from your server console.
Optionally, you can install the file manually.

Automatic Installation:

  • Auto Install is for People Who Know What They're Doing. If you can't follow this step, don't bother asking how to install it this way.
  • Enter "utc mode install" to go to Install mode
  • Enter "utc install" to install UTChat "Integration"

Manual Installation for the insane:
  • Locate utcIntegration.lua in scripts/utchat/shared/
  • Copy this file into the shared folder for each module whose chat messages you want UTChat to display (if the folder does not exist, create it)
  • UTChat may give you an error on load telling you to enable IKnowWhatImDoing, ignore this and enter "utc ok" as prompted.
    If it does not display an error and goes to the Pre-Configuration menu (IKnowWhatImDoing is enabled) or the command for some reason does not work, open utchat.conf in scripts/utchat/ and edit/add "Installed=Yes"



Questions and Answers

How can they be frequently asked if nobody has asked them yet?


How do I use the built-in addons?
As a server owner or player, you don't need to worry too much about the internal workings. The only practical Addon that UTChat comes with is Color Tags.


How do I use Color Tags?
Quite simple!
Quote
SonicXVe: I am a (pink)pretty princess
shows to players as:
Quote
SonicXVe: I am a pretty princess


How do I install this? I keep getting a big message on my server!
That's because you didn't read the instructions.


(...) does not work/causes errors/crashes game
Feel free to post the problem in this thread or on the Issue Tracker at our GitHub page.


I'm a developer and I want to ...
See our Developer Reference, it explains interfacing with UTChat and how to use UText. If you want to use UText in another module (not through chat) then copy utext.lua to your module. You are free to use it.


UTChat is installed but other modules are printing chat messages on top of it/using the old chat box
Make sure utcIntegrator.lua is installed in that module's shared folder. If the problem persists, post an issue "Conflict with (module name)" or similar. It would be most helpful if you could provide a link to the source of the module (source repo page or pastebin link).


I want to help!
Fantastic, any help is appreciated. You can fork the project at GitHub and submit a Pull Request when you have something you want to contribute to UTChat. I will consider features or bug fixes.



Change Log

I could use a little fuel myself

  • 1.0.0-alpha.4
    • Fixed errors toggling chat caused by a reference to an uninitialized variable
    • Fixed infinite loop when using an invalid color in a color tag
    • Fixed signature of Integration methods
    • Updated to use the new Chat:GetUserEnabled function
    • Fixed chat locking up when pressing F3 too many times
    • Fixed chat toggle being inverted
    • Fixed messages showing after chat has been disabled
    • Added Copy()s to prevent passing unwanted Color constant references
    • Fixed issue removing text from a UText object that didn't have any formats
    • Updated integration with more consistent functions
    • Replace integration's table.function assignments with class function declarations (actually fix chat methods)
    • Fix weird alpha issues when disabling/enabling chat
    • misterff1: Added check for Chat:GetEnabled

  • v1-alpha3
    • Removed Basic Tags
    • Added Color Tags (use Color Constants)
    • Added UText:InsertText(string, position)
    • Added UText:RemoveText(string, position)
    • Added UText:RemoveText(start, end)
    • Added Color copies to rectify some color reference problems
    • Removed UTLib
    • Removed dependency from Formats
    • Made loading of scripts independent
    • Added UText:ReplaceText(string, string)
    • Escaped text in RemoveText that could be problematic
    • Added Format class
    • Modified Formats to use the class template
    • UText.RegisterFormat now takes (Format object, string, string, ...) where Format object is the uninitialized format and string is the name, or multiple alternative names, of the format.
    • Added In-Console Installation process
    • Refactored utlEventMan into NetworkedEvent
    • Changed utlIntegrator into utcIntegration

  • v1-alpha2
    • Added Fade format
    • Added Motion format
    • Added Easing library
    • Add external API
    • Fixed numerous infinite loops and exploits
    • Fixed glitches with Fade and Motion animation
    • Fixed glitches with Shadow alpha
    • Fixed positioning on different resolutions
    • Fixed standard chat box not clearing

  • v1-alpha (initial release)
    • UTLibrary to manage the scripts
    • UText with Color and Shadow
    • UTChat with Basic Tags
    • utlIntegrator to hook modules
« Last Edit: June 04, 2015, 06:02:52 am by SonicXVe »

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #1 on: January 04, 2014, 04:20:36 am »
So how would you get other addons to use this? Also, ZED has it's own chatbox with colors, however, unlike yours, it does not allow players to type in colors for their messages. ZED has ZEDTunnel which makes other addons use the ZED chatbox, what I want to know is, if I have this, and have ZEDTunnel installed in it, will it interfere with the users ability to create colored text?

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #2 on: January 04, 2014, 04:25:50 am »
I haven't tested it, but despite both this and ZED using different methods, in the end they have the same mechanism of making other addons use it and they will conflict. I'm trying to think up with a way for both to co-exist, but unfortunately it's a matter of using one or the other right now.

What you'll see isn't a matter of colors not working, but whichever one loads last will force the modules to use their chat system. Even if UTChat loads last and has chat control, ZED will probably still try to write to it's own chat and cause an overlap.

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #3 on: January 04, 2014, 04:28:07 am »
I'll try and see if I can get them to work with some fiddling, though I doubt I'll figure it out before someone more experienced will.

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #4 on: January 04, 2014, 04:40:28 am »
I could write a part of utlIntegrator to specifically hook into ZED's functions and allow taking control that way, but I'm not sure IZED would like that very much. I'll see what I can do, anyways.

I've updated the OP with a link to a more server operator friendly wiki page with installation instructions. It also has a section explaining what I just posted about the incompatability.

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #5 on: January 04, 2014, 04:42:07 am »
alright, thanks for the quick replies man!

wait i just thought of something. What if server ops deleted ZED tunnel from everything, and then let UTchat integrate itself. Then put ZED tunnel in just UTchat, so that UTchat will collect from other scripts, and ZED will take the finished product.
« Last Edit: January 04, 2014, 04:45:17 am by ROODAY »

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #6 on: January 04, 2014, 04:54:24 am »
No, UTChat doesn't use the default chat functions that ZEDTunnel hooks into. Even if it did, ZED doesn't know how to handle the UText object and all of it's formatting.
The same is why UTChat can't take the finished product from ZED, ZED doesn't use default chat functions. UTChat does, however, support any range of formats, so taking ZED's text is feasible. The issue is a matter of permission for me to hook into ZED's specific functions.

CamJGaming

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #7 on: January 04, 2014, 03:52:05 pm »
ZED is open source :)

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #8 on: January 04, 2014, 04:29:54 pm »
I'd ask IZED just to be sure, but from my expereience, as long as you don't change and re upload his core zed files you're fine.

EDIT: Also, until you make this compatible with ZED, would you mind if I posted an edited version of your integrator bat for ZEDTunnel on the ZED thread? I won't do so unless I get your permission.
« Last Edit: January 04, 2014, 06:52:41 pm by ROODAY »

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #9 on: January 04, 2014, 09:15:57 pm »
That's perfectly fine
You may want to check back with the latest branch, the installation scripts were technically under MIT but are now public domain so that you don't have to distribute a license with it if you don't want to.

CamJGaming

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #10 on: January 04, 2014, 09:46:25 pm »
LOL

I talked to ZED about this thread, he said its open source and you could even send him things through github on the zed repo.

Also Rooday, you were wrong about zed having multiple color support, because it does

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #11 on: January 04, 2014, 10:06:38 pm »
never said it didnt. I said it doesn't allow players to type in chat with colors. Like ZED won't recognize "I'm [color=200,0,200]pretty[/color] as "I'm pretty"

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #12 on: January 04, 2014, 10:26:07 pm »
I'm not going to pursue ZED hooking until I've finished documenting the alpha release. Despite ZED being open source, it explicitly states in the files that they may not be modified, and the only license only states a copyright. I'm not going to do anything with ZED until I get express permission, or the license is clarified. Like I said before, I'm not doing that until after documentation.

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #13 on: January 04, 2014, 10:48:39 pm »
okee doke. will the documentation show how to add stuff to UTChat? I could work on it, and then show you what I've done so far when you want to do it, and then after IZED gives the greenlight you can release it.

SonicXVe

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unified Text Library (UText, UTLib, and UTChat -- Chat Replacement)
« Reply #14 on: January 04, 2014, 10:53:44 pm »
Right now it shows how to write to UText, it's basic but it would work for that purpose.