Echo with color.

Share your scripts and packages with other Mudlet users.
User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Echo with color.

Post by Vadi »

Works as expected... thanks! Hope to include it in the next release of Mudlet.

Denarii
Posts: 111
Joined: Thu Dec 03, 2009 10:54 pm

Re: Echo with color.

Post by Denarii »

I'm working on merging the two functions for the next version of Mudlet so that you'll be able to use hex, decimal or name color tags.

Thylacine
Posts: 28
Joined: Sun May 10, 2009 5:04 am

Re: Echo with color.

Post by Thylacine »

Can we still optionally have the non-lrexlib dependent version available separately?

Lua already has pattern matching which is pretty similar to regular expressions anyway. That, and lrexlib wont work on my system and probably a couple of others ;)

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Echo with color.

Post by Vadi »

Good point... I still have yet to package lrexlib for ubuntu. This'll save a lot of work.

Denarii
Posts: 111
Joined: Thu Dec 03, 2009 10:54 pm

Re: Echo with color.

Post by Denarii »

After some discussion, instead of merging them I'm creating separate functions, cecho for named colors, decho for decimal RGB, etc. I'll probably include versions using Lua's pattern matching that it will fall back on if lrexlib isn't loaded.

hempa
Posts: 48
Joined: Sat Jan 02, 2010 1:07 pm

Re: Echo with color.

Post by hempa »

Looking at these functions, there's one I am really missing. A colorable prefix. I like to put prefixes before stuff and tend to add colors all over my system :D Is it at all possible to make a prefix and/or replace function for this as well?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Echo with color.

Post by Vadi »

It's possible. Prefix is defined in the LuaGlobal as

Code: Select all

-- Echo something before your line
function prefix(what)
    moveCursor("main",0,getLineNumber());
	insertText(what)
end
So we can either wait until denarii puts in the separately-named functions in luaglobal and make it work or overwrite in the client for now.

hempa
Posts: 48
Joined: Sat Jan 02, 2010 1:07 pm

Re: Echo with color.

Post by hempa »

Oh, I have already seen that one, but not with a simple coloring syntax. Of course, I could hack the cecho functions to do everything backwards, but that's a bit of a roundaway way of doing it :P Can I put in ansi codes directly into echo/prefix text somehow? If so, I can just put it in a Lua table..

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Echo with color.

Post by Vadi »

well, insertText = echo now afaik.

Denarii
Posts: 111
Joined: Thu Dec 03, 2009 10:54 pm

Re: Echo with color.

Post by Denarii »

Well I can change the color echo functions to be able to prefix.. right now there is an arg to make them use inserttext, but you still have to position the cursor. And my changes won't be available until the next release.

Post Reply