egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Solved] color codes not interpreted but displayed

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon Sep 30, 2013 8:17 am    Post subject: [Solved] color codes not interpreted but displayed Reply with quote

Hello there,

I've a small tcl containing sentences with color code, as : "\0034Alert\003 : error in code"

These sentences are loaded in an array in my script, but when the line is used by my script, I get the color code in the channel.

Here is the way I load the sentences:
Code:
proc file:load {} {
    set jp [open $::filename "r"]
    set jdata [read -nonewline $jp]
    close $jp
    set ::j_list ""
    foreach templine [split $jdata "\n"] {
        set line [split $templine "="]
        set jkey [string tolower [lindex $line 0]]
        lappend ::j_list $jkey
        set ::key_gen($jkey) [lindex $line 1]
        bind pubm - "*:$jkey*" file:display
    }
}


Any idea about this "bug" ?

[EDIT]
Making a small test, error appears when getting datas from a file. Seems to be an escape of \ ?
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.


Last edited by CrazyCat on Tue Oct 01, 2013 3:24 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Sep 30, 2013 1:41 pm    Post subject: Reply with quote

Escape sequences are never substituted when reading a file. If you trust the contents of the file to be safe, you could use subst to do the substitutions...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Oct 01, 2013 3:24 am    Post subject: Reply with quote

MenzAgitat gaves me the solution on my forum: join the line. And it works fine.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber