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 

makecell / spacing output

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


Joined: 26 Apr 2006
Posts: 10

PostPosted: Sun Apr 30, 2006 11:35 pm    Post subject: makecell / spacing output Reply with quote

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
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Mon May 01, 2006 5:18 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
blinky
Voice


Joined: 26 Apr 2006
Posts: 10

PostPosted: Mon May 01, 2006 5:32 am    Post subject: Reply with quote

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
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Mon May 01, 2006 6:25 am    Post subject: Reply with quote

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 Very Happy. This will of course not work if the IRC server blocks/removes control characters Very Happy.

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
View user's profile Send private message MSN Messenger
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