This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Bytes Script

Old posts that have not been replied to for several years.
Locked
t
tclsh

Post by tclsh »

Is there a script that converts bytes into kb then into mb if its > 999kb and so on like mIRC's $bytes()?

also if the line is already been sent to the server a line with the same words in the same proc will not show up

as if you had

putserv "PRIVMSG $chan :goat"
putserv "PRIVMSG $chan :goat"

it will only show one

<font size=-1>[ This Message was edited by: tclsh on 2002-01-07 18:29 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The problems with only one line being sent to the server is a feature of eggdrop. It is designed, so that the same message doesn't need to be sent twice.

You can disable this, by correctly reading your config files.

As for the conversion script.

This is an example. Send it a intiger, and it will spit out a string.

Code: Select all

proc getbytes {int} {
  set bit [list "bytes" "KB" "MB" "GB"]
  set i 0
  set int [expr $int + 0.0]
  while {$int >= 1024} {
    incr i
    set int [expr $int / 1024]
  }
  set ret "${int} [lindex $bit $i][expr ${int}>1?"'s":""]"
}
EG
% getbytes 1025
1.0009765625 KB's
% getbytes 1024
1 KB
% getbytes 1048576
1.0 MB
% getbytes 1263425
1.2048959732 MB's
Locked