[TF] Colour preservation in arguments
Brought to you by:
kenkeys
|
From: wabasoft at yahoo.fr (Waba) - 2003-04-16 15:17:55
|
Hi list, I have encountered two problems about disappearing colours: The first one concerns ANSI escapes and the -p option in /echo and /substitute: the escape char (\033) is stripped off from the arguments passed to these commands if the -p option is specified. Example: let %line be a variable containing ANSI escapes (for example a line sent by the server), /echo %line will display it correctly in colours, while /echo -p %line will have no colour attributes, and [xxm sequences where the colour changes were. It is fixed here: http://mumetools.sf.net/tf/tf-colours.diff The second one concerns TF's internal colour format and argument passing: internally, all commands accept plain strings (char*) instead of "internally formatted" strings (aline*), while -a/-P colouring produces alines. Thus, all text formatting added with -P or -a options is lost when this text is passed as argument. For example, /echo $(/echo -aBCgreen foo) will echo a plain 'foo' in place of a bold, green 'foo'. (I hope I RTFSed it right, since my coding style is quite different from Ken Key's one). This causes me some problems to do the following: Let's say that Abc is a dangerous character killing his own side (team). I want to notice him so I do /def -Fp2 -mregexp -t"Abc" -P0BCred t1 Then I want to ease running after people so I replace movement messages: /def -mregexp -t" leaves east.$" -ag t2 = /echo - %PL leaves >> EAST >> Now if the server sends me "Abc leaves east.", Abc won't be in bold red anymore, since %PL will have lost the colouring made by t1. I'm not willing to replace all char* types by aline* in the TF sources (especially since the second one is a structure, handled in a completely different way). Is it any workaround that I could use ? I thought about adding raw ANSI escapes in t1, but it won't work in the case Abc appears in a line coloured by the server: ^[[33mInfortunatePlayer narrates 'Abc same-sided me'^[[0m would become after t1 ^[[33mInfortunatePlayer narrates '^[[31;1mAbc^[[0m same-sided me'^[[0m and remove the yellow (33) colouring of the "same-sided me'" part. Thank you much, Waba -- [www.ebb.org/ungeek] GCS/IT d-- a--- C++++ ULVB++++ P+++ L+++$>++++$ R+ E---(-) W+(-) N+(++) w---(--) PE(--) PGP+ tv-- b+(+++) D++ h* r-- y? |