| View previous topic :: View next topic |
| Author |
Message |
blinky Voice
Joined: 26 Apr 2006 Posts: 10
|
Posted: Sun Apr 30, 2006 11:35 pm Post subject: makecell / spacing output |
|
|
im very new to tcl and i was wondering what this i see in a script i have.
putquick "PRIVMSG $chan : \002[makecell "Found $total_results in [string trim $query_time]" 25 left][makecell "\".db help\" for info http://edited.com" 61 right] "
it seems like its some sort of way to space it out. this isnt the only place i see 'makecell' in this script. i couldnt find any documentation on that in the tcl wiki. any ideas what it is?
i also do want to space things by # of characters. |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon May 01, 2006 5:18 am Post subject: |
|
|
There is no predefined function by that name. The function must be in the script itself or in a script which is needed to run that script. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
blinky Voice
Joined: 26 Apr 2006 Posts: 10
|
Posted: Mon May 01, 2006 5:32 am Post subject: |
|
|
haha i feel so stupid. i found it.
| Code: | proc makecell {text width align} {
set text [noentities $text]
set length [string length [noirc $text]]
if {$length >= $width} {
set padding $width
set text [string range $text 0 [incr padding -2]]
set length [incr padding 1]
}
if {$align == "left"} {
set temp $text
for {set i 0} {$i < $width - $length} {incr i} {
append temp " "
}
} else {
set temp ""
for {set i 0} {$i < $width - $length} {incr i} {
append temp " "
}
append temp $text
}
return $temp
}
|
it still doesnt space is right. i think multiple empty spaces are cut down to 1. is there a way to add definate spaces? |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon May 01, 2006 6:25 am Post subject: |
|
|
spaces are truncated by some clients (mostly mIRC), you can prevent this by using a control charcter every even character like " \002 \002 " will display 3 spaces, even with mIRC space truncating. remember to keep an even number of these characters, to not write bold after the spaces . This will of course not work if the IRC server blocks/removes control characters .
Alternately you can try using tabs (\t), but you never know how many whitespaces the client will actually write. usually 1, 3 or 5 (X-Chat writes only 1). _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
|