TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

#SUBSTITUTE not ignoring colors

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
Dunkelheit



Joined: 12 Dec 2016
Posts: 3

PostPosted: Mon Dec 12, 2016 11:42 am    Post subject: #SUBSTITUTE not ignoring colors Reply with quote

Hello all,

I'm having quite a headache trying to make #SUBSTITUTE ignore colors in a specific MUD. All in all, I see #SUBSTITUTE seems to work sometimes when I'm doing tests using #SHOWME, but it fails to recognize the actual text coming from the server.

When a player enters my room, a text is shown. And the name of the player is shown with certain color, depending on the race.

Example:

I don't care about the color; this whole text line is the one I want to substitute, but the color in the player name seems to mess everything up.

This is how I've implemented #SUBSTITUTE:

Code:

#SUBSTITUTE {^%* llega desde el %*.$} {WORKS!}


And this is how I've tested it with #SHOWME:

With no colors, works fine.
Code:

#SHOWME John llega desde el este.
WORKS!


All the line with one color, works fine.
Code:

#SHOWME <180>John llega desde el este.
WORKS!


Only the first word has color, doesn't work.
Code:

#SHOWME <180>John<099> llega desde el este.
John llega desde el este.



And this is what I actually receive from the MUD. Doesn't work either.
Code:

#SHOWME \e[33mJohn\e[0m\e[0m llega desde el este.\e[0m
John llega desde el este.


I've tried using the regular expression {.*} instead of %*, to no avail. I've also tried the following:
Code:

#SUBSTITUTE {^%1 llega desde el %2.$} {WORKS!}


Any idea what I'm doing wrong? My TinTin++ version is 2.01.0.

Many thanks in advance![/img]
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Mon Dec 12, 2016 2:36 pm    Post subject: Reply with quote

I have tt v.2.01.1

Using your first #SUBSTITUTE line I tried all your examples, and all worked.
The only difference between the results is that, when using colors, the word "WORKS!" is colored.

Or maybe you have some other commands that are running before that substitution

Code:

#SUBSTITUTE {^%* llega desde el %*.$} {WORKS!}
#OK. {^%* llega desde el %*.$} IS NOW SUBSTITUTED AS {WORKS!} @ {5}.
#SHOWME John llega desde el este.
WORKS!
#SHOWME <180>John llega desde el este.
WORKS!
#SHOWME <180>John<099> llega desde el este.
WORKS!
#SHOWME \e[33mJohn\e[0m\e[0m llega desde el este.\e[0m
WORKS!


EDIT:
maybe this is relevant, I've found this in the changelog for my version (that is newer that yours)
Code:

substitute.c   Added patch by Nya to properly handle colored substitutions.
Back to top
View user's profile Send private message
Dunkelheit



Joined: 12 Dec 2016
Posts: 3

PostPosted: Mon Dec 12, 2016 2:52 pm    Post subject: Reply with quote

PowerGod wrote:
I have tt v.2.01.1

Using your first #SUBSTITUTE line I tried all your examples, and all worked.
The only difference between the results is that, when using colors, the word "WORKS!" is colored.


Thanks for doing all those checks. Very interesting results.

I've started with a fresh new TinTin++ config, no other scripts loaded, and I've done the same tests as you. Still can't get it to work. Really strange.

Maybe something is wrong with the default #CONFIG? I've executed a #WRITE test.tin and got the following:
Code:

#CONFIG           {256 COLORS}  {ON}
#CONFIG           {AUTO TAB}  {5000}
#CONFIG           {BUFFER SIZE}  {20000}
#CONFIG           {CHARSET}  {ASCII}
#CONFIG           {COLOR PATCH}  {OFF}
#CONFIG           {COMMAND COLOR}  {<078>}
#CONFIG           {COMMAND ECHO}  {ON}
#CONFIG           {CONNECT RETRY}  {15}
#CONFIG           {HISTORY SIZE}  {1000}
#CONFIG           {LOG}  {RAW}
#CONFIG           {PACKET PATCH}  {0.00}
#CONFIG           {REPEAT CHAR}  {!}
#CONFIG           {REPEAT ENTER}  {OFF}
#CONFIG           {SCROLL LOCK}  {ON}
#CONFIG           {SPEEDWALK}  {OFF}
#CONFIG           {TINTIN CHAR}  {#}
#CONFIG           {VERBATIM}  {OFF}
#CONFIG           {VERBATIM CHAR}  {\}
#CONFIG           {VERBOSE}  {OFF}
#CONFIG           {WORDWRAP}  {ON}
#PATHDIR          {d}  {u}  {32}
#PATHDIR          {e}  {w}  {2}
#PATHDIR          {n}  {s}  {1}
#PATHDIR          {ne}  {sw}  {3}
#PATHDIR          {nw}  {se}  {9}
#PATHDIR          {s}  {n}  {4}
#PATHDIR          {se}  {nw}  {6}
#PATHDIR          {sw}  {ne}  {12}
#PATHDIR          {u}  {d}  {16}
#PATHDIR          {w}  {e}  {8}
#SUBSTITUTE       {^%* llega desde el %*.$}     {WORKS!}  {5}


I'm using 10.11.6. Normally I run iTerm2 3.0.12. I've also tried the default OSX Terminal 2.6.1.

After testing with other variations, I finally found one that works:
Code:

#SUBSTITUTE {~^%* se va hacia %*.%*$}


However, I'm quite curious to know why the original implementation doesn't work in my case.

Best regards,
Back to top
View user's profile Send private message
Dunkelheit



Joined: 12 Dec 2016
Posts: 3

PostPosted: Mon Dec 12, 2016 3:06 pm    Post subject: Reply with quote

PowerGod wrote:

EDIT:
maybe this is relevant, I've found this in the changelog for my version (that is newer that yours)
Code:

substitute.c   Added patch by Nya to properly handle colored substitutions.


BINGO! Ecstatic

The #SUBSITUTE works fine since I upgraded to that version.

Thanks a lot!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group