mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 204
K
keeker Offline OP
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
Hi, i have been messing around with whois raw replies, and i have figgured out how to change them....now i need to know how do i make it look decent? Like the background ends where the text does. Heres what i mean:
Code:
######################################
#############
#######################
#############################
#########
#######


i want it to look like:
Code:
######################################
######################################
######################################
######################################
######################################
######################################

with the background color ending at the same spot. is there a way to do this?


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
Joined: Feb 2003
Posts: 79
A
Babel fish
Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
This is gonna require you to tell us what font your using, since spacing is defined by the font, we'll need to know what font your using.

Joined: Dec 2002
Posts: 204
K
keeker Offline OP
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
am using the default font, fixedsys i think


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
Joined: Feb 2003
Posts: 79
A
Babel fish
Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
Ok, now, your gonna want to make something to count how many chars are in each line, subtract that from the total number (probably like 100-200 or so) and then out put something (a space could be used, i recomend something else such as % & or #) that many times before the output you want (Ctrl+K)1,1 or whatever bg color you want, I'm not quite sure on how you would go about doing this, but you might know.

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
You will have to save all of the raw whois lines in whatever form you want to format them in (such as in a hidden window), then find the longest line. That's your limit (though you'll have to decide how you'll deal with line wrapping!). You might consider making sure that you don't go over a certain length in any of your formatted lines.

For instance, someone who is on a lot of channels with really long names could easily wrap (319) a couple of times, unformatted. The same can happen (frequently) for an extended away message (301). The rest of the lines probably won't wrap at all.

Once you get the formatted lines in this hidden window (I'm calling this one @WhoIs), you can find the longest line with this simple loop:
Code:

  var %max = 0, %i = 1
  while ($line(@WhoIs,%i)) {
    if ($len($ifmatch) < %max) %max = $ifmatch
    inc %i
  }

Now, assuming you want to left align the text and fill out the rest of the line with just the background color, you would right-pad each line by appending $str($chr(160), %max) and then taking the $left(string, %max) to chop off the unnecessary bits and then add your color code (^k04,08) to the beginning of each line.
Code:

  var %i = 1, %rightpad = $str($chr(160), %max)
  while ($line(@WhoIs,%i)) {
    echo -s 04,07 $+ $left($+($ifmatch,%rightpad),%max)
    inc %i
  }
  window -c @WhoIs

In FixedSys 9, $chr(160) shows as a non-breaking space (  in HTML) or "fake space." That means that you don't have to re-set your foreground/background color to the same color. Just remember that if the window gets resized, it will definitely wrap oddly.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard