absstrlen
Function
$absstrlen()
Usage
$absstrlen(text)
Returns
the absolute length of text, which is how long it would be on your screen
Example
$absstrlen($cparse(%Fasdf)) returns 4, where $strlen($cparse(%Fasdf)) returns 12


addtabkey
Function
$addtabkey()
Usage
$addtabkey(nick array)
Returns
nothing; adds the given nick to the list cycled through when the tab key is pressed. If the array is given, the nick is added to the autoreply array and otherwise to the msglist array.


after
Function
$after()
Usage
$after(chats string of text)
Returns
the part of "string of text" that occurs after the first instance of any character in "chars"
Example
$after(! hop!jnelson@example.org) returns "jnelson@example.org"


afterw
Function
$afterw()
Usage
$afterw(number words)
Returns
the string after the word being matched


aliasctl
Function
$aliasctl()
Notes
This function allows low-level manipulation of aliases and assigns. The noun of the action is either "alias" or "assign". The verb is either "get", "set", or "match". The "lval" must a valid variable name. The "rval" is used only if the verb is "set", and is any sequence of octets.
Usage
$aliactl(alias|assign get|set|match <lval> [<rval>])


annoy
Function
$annoy()
Usage
$annoy(text)
Returns
"text" parsed through bX's "annoy" text parser
Example
$annoy(this is annoy text) returns random annoy text ;)


ascii
Note
the arguments of $ascii() are NOT whitespaced.
Function
$ascii()
Usage
$ascii(char [char2] ... [charN])
Returns
the ASCII value of the given chars
Example
$ascii(xyz) returns "120 121 122"


banonchannel
Function
$banonchannel()
Usage
$banonchannel(channel ban)
Returns
0 if the ban does not exist on the channel, 1 if it does
Example
$banonchannel(#bitchx *!*@*mirc*) returns 1 ;)


bcopy
Note
Binary copy a file. Takes two numbers. Both have to be open file descriptors from $open()
Function
$bcopy()
Usage
$bcopy(num num)
Returns
1 on error, 0 on success


before
Function
$before()
Usage
$before(chars string of text)
Returns
the part of "string of text" that occurs before the first instance of any character in "chars"
Example
$before(! hop!jnelson@iastate.edu) returns "hop"


beforew
Function
$beforew()
Usage
$beforew(pattern string of words)
Returns
the portion of "string of words" that occurs before the first word that is matched by "pattern"
Example
$beforew(three one two three o leary) returns "one two"


bitchx
Function
$bitchx()
Usage
$bitchx()
Returns
returns the BitchX builting "expando", which by default is [BX] in colour.
Actually I think it returns the number 1.



bmatch
Function
$bmatch()
Usage
$bmatch(pattern input)
Returns
takes a match (possibly containing * and % characters) and does a match on the rest of its arguments. This appears to be the same as gettmatch().



center
Function
$center()
Notes
The string is truncated from the right, so the returned length is NOT "width".
Usage
$center(width string)
Returns
Returns the string centered in "width" chars
Example
$center(30 BitchX) returns " BitchX"


cexist
Function
$cexist()
Usage
$cexist(command)
Returns
returns 0 or 1 depending on whether the argument exists as a BitchX builtin command (1 if it does, 0 if not).


chanmode
Function
$chanmode()
Usage
$chanmode()
Returns
The current channel mode, or the mode on the named channel.


channel
Function
$channel()
Usage
$channel(channelname)
Returns
returns a list of clients in the given (or current) channel, with *, &, !, @, + or a dot (.) before each name depending on whether the nick is an IRC oper (*), in your userlist or shitlist respectively, a channel op, has voice, or not.



channelmode
Returns
channel modes of the specified channels on the current window; can also be given a numeric argument after the channel which is 1 to list bans, 2 to get ban who time, 3 to get exceptions, with 0 being the default and just fetching the channel mode. You can give a list of channel, number pairs to get modes for multiple channels.
Function
$channelmode()
Usage
$channelmode(#chan1 #chan2 #chan3)


channelnicks
Function
$channelnicks()
Usage
$channelnicks(channel)
Returns
chops in a comma separated list.


channicks
Function
$channicks()
Usage
$channicks(channelname)
Returns
a list of nicks in the channel, separated by commas


chanusers
Function
$chanusers()
Usage
$chanusers(channelname)
Returns
A space-separated list of clients in the named (or current) channel.


chanwin
Function
$chanwin()
Usage
$chanwin(refnum)
Returns
The channel bound to the given window number, or if you give it a channel name it returns the corresponding window nuber.


checkbot
Function
$checkbot()
Usage
$checkbot(userhost channel)
Returns
if given a hostname matching one on your bot list, returns the pertinent info ...
Example
$checkbot(PimpBot!rush@nic.cerf.net #yyz) returns 3 3 *rush@nic.cerf.net #yyz


checkshit
Function
$checkshit()
Usage
$checkshit(userhost channel)
Returns
if given a hostmask matching your shitlist, returns the shitlist level and channels its active for
Example
$checkshit(*!*@* #mirc) returns "4 #mirc" ;)


checkuser
Function
$checkuser()
Usage
$checkuser(userhost channel)
Returns
if given a hostmask matching one on your userlist, returns the level, aop protect level, etc
Example
$checkuser(novalogic!nova@ra1.randomc.com #bitchx) returns 51 1 1 *nova@*.randomc.com #bitchx


chmod
Function
$chmod()
Usage
$chmod(file numeric-mode)
Returns
0 if a successful, -1 if not
Example
$chmod(.BitchX/BitchX.quits 666) returns 0 and sets the permissions of the file to "666" or "-rw-rw-rw-"


chngw
Function
$chngw()
Notes
the first word is numbered 0
Usage
$chngw(num word string of text)
Returns
"string of text" such that the "num"th word is removed and replaced by "word"
Example
$chngw(3 foo now is the time for) returns "now is the foo for"


chops
Function
$chops()
Usage
$chops(channel)
Returns
chops (i.e. channel operators, people currently mode +o in the named channel) in a space separated list.


chr
Function
$chr()
Usage
$chr(num [num2] ... [numN])
Returns
the ascii char(s) the given "num(s)"
Example
$chr(120 121 122) returns "xyz"


close
Function
$close()
Usage
$close(filenum)
Returns
0 or -1, if closing the file handler "filenum" was successful or unsuccessful, respectively.
Example
$close(99999999999999) returns -1 (hopefully)


closeserver
Function
$closeserver()
Usage
$closeserver(number_of_open_socket)
Returns
The socket number, after closing it.


closesocket
Function
$closesocket()
Usage
$closesocket(n)
Returns
an alias for closeserver


cluster
Function
$cluster()
Usage
$cluster(host)
Returns
proper string for a ban
Example
$cluster(power@example.org)


common
Function
$common()
Notes
returned in order found in first string.
Usage
$common (string of text / string of text)
Returns
Given two sets of words seperated by a forward-slash '/', returns all words that are found in both sets.
Example
$common(one two three / buckle my two shoe one) returns "one two"


connect
Function
$connect()
Usage
$connect(host port)
Returns
the socket number to use for read/write.


convert
Function
$convert()
Usage
$convert(IP or hostname)
Returns
either the reverse lookup of a given IP or the IP of a hostname
Example
$convert(127.0.0.1) returns localhost $convert(localhost) returns 127.0.0.1


cool
Function
$cool()
Usage
$cool(text)
Returns
"text" parsed through bX's "cool" text parser
Example
$cool(this is cool text) returns "ThIs iS CoOl tExT"


cool2
Function
$cool2()
Usage
$cool2(text)
Returns
"text" parsed through bX's "cool2" text parser
Example
$cool2(this is cool2 text) returns "THiS iS CooL2 TeXT"


copattern
Function
$copattern()
Usage
$copattern(pattern var_1 var_2)
Returns
Given a pattern and two variable names, it returns all words in the variable_2 corresponding to any words in variable_1 that are matched by the pattern
Example
@nicks = [hop IRSMan skip] @userh = [jnelson@iastate.edu irsman@iastate.edu sanders@rush.cc.edu] $copattern(*@iastate.edu userh nicks) returns "hop IRSMan"


count
Function
$count()
Usage
$count(s1 s2)
Returns
Given two strings, returns the number of times s2 occurs inside s1, with case insensitive matching.
Example
$count(aba abAbadaba) returns 3


countansi
Function
$countansi()
Usage
$countansi(text)
Returns
the number of ansi-color related chars in the string
Example
$countansi($cparse(%B)) returns 11


country
Function
$country()
Usage
$country(CA) or $country(hostname)
Returns
country of origin.
Example
/eval echo $country(ca)
produces Canada (pHEAR)
/eval echo $country(ppp713.iameleet.kw)
Note that the list is hard-wired and slightly out of date.


cparse
Function
$cparse()
Usage
$cparse(text)
Returns
"text" with the ANSI codes substituted for the ANSI parse vars.
Example
/do echo $cparse("%Rthis is bright red")


crypt
Function
$crypt()
Notes
Password truncated to 8 chars. Spaces allowed, but password must be inside "" quotes.
Usage
$crypt(password seed)
Returns
a 13-char encrypted string when given a seed and password. Returns zero (0) if one or both args missing. Additional args ignored.


curpos
Function
$curpos()
Usage
$curpos()
Returns
returns current position in window buffer


currchans
Function
$currchans()
Usage
$currchans()
Returns
A list of strings, each of which contains first a number, the number of the current server, and then the name of a channel that's currently visible in a window.


decode
Function
$decode()
Notes
$encode($decode(text)) returns "text" $decode($encode(text)) returns "text" too. Yes. $decode(plain-text) does compress the data by a factor of 2. But it ignores non-ascii text, so use this as compression at your own risk and peril.
Usage
$decode(text)
Returns
If <text> was generated with $encode(), it returns the string you originally encoded. If it wasnt, you will probably get nothing useful in particular.
Example
$decode(GGGFCAGGGJCAGGGPCAGGHFGN) returns "fe fi fo fum"


delarray
Function
$delarray()
Usage
$delarray(arrayname)
Returns
0 on sucess, -1 on failure; deletes the entire contents of the array.


delitem
Function
$delitem()
Usage
$delitem(arrayname item)
Returns
deletes an item of an array and moves the contents of the array that were stored "above" the item down by one. It returns 0 (zero) on success, -1 if unable to find the array, -2 if unable to find the item. Also, if the item is the last item in the array, it deletes the array. The item is a number between 0 (the first item) and one less than the array length to delete the last item.


deuhc
Function
$deuhc()
Usage
$deuhc(nick!user@host)
Returns
A string: *!user@host becomes user@host, *!*@*.host becomes *.host; in other words, if there is no ! or @ you get back an empty string; if there is no *! you get back the original string; if there's a *!*@ you get back everything after the @ and if there's *! followed by anything else, you get everything back that's after the ! itself.


diff
Function
$diff()
Usage
$diff(string of text / string of text)
Returns
given two sets of words, seperated by a forward-slash '/', returns all words that are not found in both sets
Example
$diff(one two three / buckle my three shoe) returns "one two buckle my shoe"


eleet
Function
$eleet()
Usage
$eleet(text)
Returns
"text" parsed through bX's "eleet" text parser
Example
$eleet(this is ereet text) returns "+h15 15 3r33+ +3x+"


encode
Function
$encode()
Notes
$encode($decode(text)) returns text (most of the time) $decode($encode(text)) also returns text.
Usage
$encode(text)
Returns
a string, uniquely identified with <text> such that the string can be used as a variable name.
Example
$encode(fe fi fo fum) returns "GGGFCAGGGJCAGGGPCAGGHFGN"


eof
Function
$eof()
Usage
$eof(filenum)
Returns
0 or 1 depending on if the next char in the file is an EOF
Note: Unix doesn't have an EOF char; presumably eof() will return 1 in that case if there is no more data to read.
Example
$open(pfft R) returns 10 $eof(10) returns 0


epic
Function
$epic()
Usage
$epic()
Returns
1 if it's an epic client, 0 if not
Example
$epic() returns 1


fexist
Function
$fexist()
Usage
$fexist(file)
Returns
returns 1 if file exists, -1 otherwise
Example
$fexist(/usr/local/bin/BitchX) returns 1


filter
Function
$filter()
Usage
$filter(pattern string of words)
Returns
given a pattern and a string of words, returns all words that are NOT matched by the pattern
Example
$filter(f* one two three four five) returns "one two three"


finditem
Function
$finditem()
Usage
$finditem(name, itemnumber)
Returns
Does a binary search and returns the item number of the string that exactly matches the string searched for, or it returns -1 if unable to find the array, or -2 if unable to find the item.


findw
Function
$findw()
Notes
the first word is index 0
Usage
$findw(word string of text)
Returns
the index of the first occurrence of "word" in the string of text
Example
$findw(word there is a word in here somewhere) returns 3


flash
Function
$flash()
Usage
$flash(num)
Returns
the "flash" string referenced by num
Example
$flash(3) returns "**XB00"
You may need to be on a PC console for this to work, or it might not work at all, I'm not sure. It doesn't exist in the version of BitchX I have (1.1).



fnexist
Function
$fnexist()
Usage
$fnexist(strlen)
Returns
1 if the named function exists, 0 otherwise.


fparse
Function
$fparse()
Usage
$fparse(f)
Returns
If f is the name of an fset variable (with or without the leading FORMAT_) the corresponding value is returned. Additional arguments are used as parameters for the format string, so that if (say) FORMAT_WIDELIST has the value "[$1-]" then $parsef(widelist boy socks ankles) will return [socks ankles], the $1 in the format skipping the 0th argument, boy.



fromw
Function
$fromw()
Usage
$fromw(pattern word1 ?word2? ... ?wordN?)
Returns
the string starting with the word being matched
Example
$fromw(asf asdf asf asdf) returns "asf asdf"


fsize
Function
$fsize()
Usage
$fsize(file)
Returns
the size of "file" or -1 if it doesnt exist
Example
$fsize(/usr/local/bin/BitchX-72) returns 786628


ftime
Function
$ftime()
Usage
$ftime(filename)
Returns
the modification time of the given file.


geom
Function
$geom()
Usage
$geom()
Returns
the geometry of the current window
Example
$geom() returns "79 24" on my box


getarrays
Function
$getarrays()
Usage
$getarrays()
Returns
returns a string containg the names of all currently existing arrays separated by spaces.


getcdcc
Function
$getcdcc()
Usage
$getcdcc(n)
Returns
If given a non-numeric argument, returns the number of cdcc packs. If given a numeric argument, returns more information about that particular pack.


getcset
Function
$getcset()
Usage
$getcset(channel variable)
Returns
Supposedly can return the value of a cset variable.


getenv
Function
$getenv()
Notes
do NOT use a $
Usage
$getenv(var)
Returns
the environment variable "var"
Example
$getenv(HOME) returns "/home/by-tor"


getflags
Function
$getflags()
Usage
$getflags(user@host channame)
Returns
the user's flags


getfsets
Function
$getfsets()
Usage
$getfsets()
Returns
Takes a list of words and returns a list of words that are also the names of fset formats.


getgid
Function
$getgid()
Usage
$getgid()
Returns
The current group identifier (POSIX getgid() system call for example)


gethost
Function
$gethost(nick)
Notes
NOT case sensitive
Usage
$gethost(nick)
Returns
the user@host of the given nick
Example
$gethost(piker) returns loser@efnet.opers.org :)


getinfo
Function
$getinfo()
Usage
$getinfo(nick)
Returns
the info set by $setinfo() for a valid nick on your userlist
Example
$getinfo(panasync) returns "the coder for bitchx!"


getitem
Function
$getitem()
Usage
$getitem()
Returns
returns the value of the specified item of an array, or returns an empty string on failure to find the item or array.


getkey
Function
$getkey()
Usage
$getkey(channel)
Returns
the channel key if there is one.
Example
$getkey(#BitchX) should return nothing ;)


getlogin
Function
$getlogin()
Usage
$getlogin()
Returns
Your username, or LOGNAME from the environment if this is not available.


getmatches
Function
$getmatches()
Usage
$getmatches()
Returns
Attempts to match a pattern to the contents of an array and returns a list of item_numbers of all items that match the pattern, or it returns an empty string if no items match or if the array was not found.


getpgrp
Function
$getpgrp()
Usage
$getpgrp()
Returns
The current POSIX process group, an integer.


getreason
Function
$getreason()
Notes
you MUST use some argument for this, or it returns nothing.
Usage
$getreason(text)
Returns
a random reason from BitchX.reasons
Example
$getreason(asdf) returned "When faith is lost, when honor dies, The man is dead!"


getrmatches
Function
$getrmatches()
Usage
$getrmatches()
Returns
function_getrmatches() attempts to match the input text with an array of patterns, and returns a list of item_numbers of all patterns that match the given text, or it returns a null string if no matches occur or if the array was not found.


getsets
Function
$getsets()
Usage
$getsets()
Returns
Takes a list of words and returns those words that are the name of SET variables.


gettabkey
Function
$gettabkey()
Usage
$gettabkey(direction array)
Returns
The tabkey list
Example
/eval echo $gettabkey(1)


gettmatch
gettmatch(users % user@host *) would match the userhost mask in the second word of the array In other words, given an array name with various strings in it, we wild_match() against the elements within the array. This allows parsing using % and * for wildcards. We return only the best match from the array, unlike getmatch() which returns ALL the matching items.



getuid
Function
$getuid()
Usage
$getuid()
Returns
Current user ID, a number, as per POSIX.


getvar
Function
$getvar()
Usage
$getvar(alias)
Returns
The given alias
Example
/eval echo $getvar(kb)


glob
Function
$glob()
Usage
$glob(path/mask)
Returns
the list of files in path which match "mask" using glob type matching
Example
$glob(/*lin*) should return vmlinuz if you are ereet and run linux


help
Function
$help()
Usage
$help(help)
Returns
the bX /bhelp for "help"
Example
$help(help) returns: "[ì] Help on Topic: help" " Usage: /BHelp <Topic|Index>" " Topic - This gives help on <Topic>" " Index - This shows the list of commands supplied in BitchX"


idle
Function
$idle()
Usage
$idle()
Returns
the idle time.


ifindfirst
Function
$ifindfirst()
Usage
$ifindfirst(arrayname item)
Returns
returns the first index of an exact match with the search string, or returns -2 if unable to find the array, or -1 if unable to find any matches.


ifinditem
Function
$ifinditem()
Usage
$ifinditem(arrayname string)
Returns
ifinditem does a binary search and returns the index number of the string that exactly matches the string searched for, or it returns -1 if unable to find the array, or -2 if unable to find the item.


igetitem
Function
$igetitem()
Usage
$igetitem(arrayname n)
Returns
returns the item referred to by the passed-in index (n), i.e. the nth item, with the first being numbered zero; It returns an empty string if unable to find the array or if the index was invalid.


igetmatches
Function
$igetmatches()
Usage
$igetmatches(arrayname, pattern)
Returns
A space-separated list of items matching the pattern; the pattern can contain * and % as per wild_match.


index
Function
$index()
Usage
$index(characters text)
Returns
The number of leading characters in <text> that do not occur anywhere in the <characters> argument.
Example
$index(f three fine frogs) returns 6 (the 'f' in 'fine') $index(frg three fine frogs) returns 2 (the 'r' in 'three')


indextoitem
Function
$indextoitem()
Usage
$indextoitem(arrayname n)
Returns
function_indextoitem() converts an index number to an item number for the specified array. It returns a valid item number, or -1 if unable to find the array, or -2 if the index was invalid.


info
Function
$info()
Usage
$info()
Returns
some information about BitchX: the version and the compile-time options.
Example
$info() returns BitchX+adegikltz in bX72+tcl1.0 (tcl 8.0b2)


insertw
Function
$insertw()
Notes
the first word is numbered 0.
Usage
$insertw(num word string of text)
Returns
"string of text" such that "word" is the "num"th word in the string.
Example
$insertw(3 foo now is the time for) returns "now is the foo time for"


iplong
Function
$iplong()
Usage
$iplong(ip4addr)
Returns
A 32-bit integer representing the IP address. This is the equivalent of, in C, htonl() after inet_aton().
Example
/do echo $iplong(192.168.0.1) produces 3232235521


iptoname
Function
$iptoname()
Usage
$iptoname(quad.dotted.ip)
Returns
the hostname for the given IP
Example
$iptoname(127.0.0.1) returns localhost


irclib
Function
$irclib()
Usage
$irclib()
Returns
The path to the ircII library; this can be orverridden by the IRCLIB environment variable, and it's used as a default for the LOAD_PATH variable for where scripts are loaded from..


isalpha
Function
$isalpha()
Usage
$isalpha(char)
Returns
1 or 0 if char alpha or not
Example
$isalpha(6) returns 0


isban
Function
$isban()
Usage
$isban(channel ban)
Returns
1 if the ban matches a shitlist ban entry (3 or 4), 0 if not
Example
$isban(#bitchx *!*@*mirc*) returns 1 ;)


ischannel
Function
$ischannel()
Notes
Contrary to popular belief, this function does NOT determine whether a given channel name is in use!
Usage
$ischannel(text)
Returns
If <text> could be a valid channel name, 1 is returned. If <text> is an illegal channel name, 0 is returned.
Example
$ischannel(i_am_not_on_this_channel) returns 0 $ischannel(#i_am_not_on_this_channel) returns 1


ischanop
Boo Hiss
This should be $ischanop(channel nick <nick...nick>) and return a list (1 1 ... 0), which would allow us to call is_chanop() without ripping off the nick, and allow us to abstract is_chanop() to take a list. oh well... Too late to change it now. :/
Function
$ischanop()
Notes
Contrary to popular belief, this function can only tell you who the channel operators are for channels you are already on!
Usage
$ischanop(nick channel)
Returns
1 if <nick> is a channel operator on <channel> 0 if <nick> is not a channel operator on <channel> * O R * if you are not on <channel>


isconnected
Function
$isconnected()
Usage
$isconnected(n)
Returns
If n is supplied, tells you if the numbered server is currently connected; otherwise, tells you if we're connected to the current IRC server.


iscurchan
Function
$iscurchan()
Usage
$iscurchan(channelname)
Returns
1 if the channel specified is the current channel on any window for the current server, otherwise 0.


isdigit
Function
$isdigit()
Usage
$isdigit(digit)
Returns
1 or 0 if digit is a digit or not
Example
$isdigit(4) returns 1


isignored
Function
$isignored()
Usage
$isignored(nick)
Returns
t1 if the given nick is in the currently list being ignored by BitchX, and 0 otherwise.


isnum
Function
$isnum()
Usage
$isnum(num)
Returns
1 or 0 if num is a number or not
Example
$isnum(44) returns 1


isnumber
Function
$isnumber()
Usage
$isnumber(number base)
Returns
returns the empty value if nothing is passed to it; returns 0 if the value passed is not a number; returns 1 if the value passed is a number.
The "base" number is optional and should be prefixed by the character 'b'. ala, $isnumber(0x0F b16) for hexadecimal. The special base zero (b0) means to 'auto-detect'. Base must be between 0 and 36, inclusive. If not, it defaults to 0.


isop
Function
$isop()
Usage
$isop(channel nick)
Returns
1 if the nick is an op in both your userlist for the channel AND an op on the channel, 0 otherwise.
Example
$isop(#bitchx panasync) returns 1


isuser
Function
$isuser(nick userhost)
Usage
$isuser(nick userhost)
Returns
given a nick (or *) and a user@host (any wildcard form), the corresponding userlist information if a match is found.
Example
$isuser(* edwards@*.sympatico.ca) returns "USER 100 1 1 *edwards@*.sympatico.ca #bitchx" on my machine


isvoice
Function
$isvoice()
Usage
$isvoice(channel nick)
Returns
1 if the nick is +v, 0 if not.
Example
$isvoice(#bitchx panasync) returns 0


itemtoindex
Function
$itemtoindex()
Usage
$itemtoindex(arrayname n)
Returns
itemtoindex() takes an item number and searches for the index that refers to the item. It returns the index number, or -1 if unable to find the array, or -2 if the item was invalid.


jot
Function
$jot()
Usage
$jot(val1 val2 ?step?)
Returns
list of #'s from val1 to val2 by options ?step?, decreasing OR increasing
Example
$jot(9 5 2) returns "9 7 5"


key
Function
$key()
Usage
$key(channel)
Returns
channel key or "*" if none.


lastmessage
Function
$lastmessage()
Usage
$lastmessage(refnum)
Returns
the last message recieved or nothing if none
Example
$lastmessage(10) returns 10:19pm |By-Tor| ~by-tor@by-tor.com |By-tor| yo


lastnotice
Function
$lastnotice()
Usage
$lastnotice(refnum)
Returns
the last notice recieved or nothing if none
Example
$lastnotice(10) returns "10:19pm |By-Tor| ~by-tor@by-tor.com |By-tor| yo"


lastserver
Function
$lastserver()
Usage
$lastserver()
Returns
the server reference number of the last (and/or current) server you connected to
Example
$lastserver() returns 0 on my box


left
Function
$left()
Usage
$left(number text)
Returns
the <number> leftmost characters in <text>.
Example
$left(5 the quick brown frog) returns "the q"


leftpc
Function
$leftpc()
Usage
$leftpc(count text)
Returns
the longest initial part of TEXT that includes COUNT printable characters.


leftw
Function
$leftw()
Usage
$leftw(num string of text)
Returns
the left "num" words in "string of text"
Example
$leftw(3 now is the time for) returns "now is the"


line
Function
$line()
Usage
$line(linenumber [windownumber])
Returns
the text of logical line linenumber from the lastlog of window windownumber. If no window number is supplied, the current window will be used. If the window number is invalid, the function will return false.
Lines are numbered from 1, starting at the most recent line in the buffer.


listarray
Function
$listarray()
Usage
$listarray(arrayname)
Returns
A space-separated list of the contents of the named array, or the empty string if it can't find the array.


listen
Function
$listen()
Usage
$listen(port)
Returns
the port allocated for the RAW_LISTEN


longip
Function
$longip()
Usage
$longip(longip)
Returns
the "long" form of the given IP
Example
$longip(2130706433) returns 1.0.0.127


mask
Function
$mask()
Usage
$mask(type addres)
or, $mask(address type)
Returns
an address with a mask specified by the given type. Use this function to generate a ban mask for example, with wildcards in places so that the ban will be more effective.
Available types are:
The available types are:
0: *!user@host.domain
1: *!*user@host.domain
2: *!*@host.domain
3: *!*user@*.domain
4: *!*@*.domain
5: nick!user@host.domain
6: nick!*user@host.domain
7: nick!*@host.domain
8: nick!*user@*.domain
9: nick!*@*.domain
10: *!*@.domain
11: *!*user@.domain
12: nick!*@.domain
13: nick!*user@.domain



match
Function
$match()
Notes
it is possible to embed spaces inside of a word or pattern by including the entire word or pattern in quotation marks. (")
Usage
$match(pattern list of words)
Returns
if no words in the list match the pattern, it returns 0. Otherwise, it returns the number of the word that most exactly matches the pattern (first word is numbered one)
Example
$match(f*bar foofum barfoo foobar) returns 3 $match(g*ant foofum barfoo foobar) returns 0


matchitem
Function
$matchitem()
Usage
$matchitem(arrayname pattern)
Returns
matchitem() attempts to match a pattern (using wild_match) to each element of an array in turn and returns the index (starting at zero) of the best match. Returns -1 if it cannot find the array, or -2 if no matches occur


mid
Function
$mid()
Notes
the first character is numbered zero.
Usage
$mid(start number text)
Returns
the <start>th through <start>+<number>th characters in <text>.
Example
$mid(3 4 the quick brown frog) returns " qui"


midw
Function
$midw()
Notes
The first word is word #0.
Usage
$midw(start num string of text)
Returns
"num" words starting at word "start" in the string "string of text"
Example
$midw(2 2 now is the time for) returns "the time"


mircansi
Function
$mircansi()
Usage
$mircansi(text with lame mirc color codes)
Returns
the given text with ANSI color substituted for mirc color
Example
$mircansi(3asdf) returns the same color as $cparse(%gasdf)


mkdir
Function
$mkdir()
Usage
$mkdir(dir)
Returns
0 if the mkdir was successful, 1 if not
Example
$mkdir(/usr) returns 1 (unsuccessful)


msar
Function
$msar()
Usage
$msar(c/search/replace/data)
Returns
the result of changing the search string to replace in the given data.
The command character c can be any combination of:
i to make the replacement case-insensitive;
r to treat data as the name of a variable and to operate on its value, storing the result back in the variable;
g to do all matches in the given data (global) and not just the first.

The delimiter can be / but can be any other character that is not a command letter (i r or g); obviously you must use the same delimiter in all three places.
Returns the empty string on error.



mychannels
Function
$mychannels()
Usage
$channels()
Returns
the channels you are currently in


myservers
Function
$myservers()
Usage
$myservers()
Returns
The actual IRC servers to which you're currently connected.


nametoip
Function
$nametoip()
Usage
$nametoip(hostname)
Returns
the dotted quad IP address for hostname
Example
$nametoip(localhost) returns 127.0.0.1


nochops
Function
$nochops()
Usage
$nochops(channel)
Returns
nops (people in the current channel, or the given channel, who are not currently channel operators) in a space separated list.


notify
Function
$notify()
Usage
$notify(on/off/serv #)
Returns
various info about NOTIFY list
Example
$notify() returns current notify list $notify(on serv 0) returns who is currently ON server #5


notw
Function
$notw()
Notes
The first word is numbered 0.
Usage
$notw(num string of text)
Returns
"string of text" with word number "num" removed.
Example
$notw(3 now is the time for) returns "now is the for"


numarrays
Function
$numarrays()
Usage
$numarrays()
Returns
the number of currently existing arrays.


numdiff
Function
$numdiff()
Usage
$numdiff(num1 num2)
Returns
the difference of num1 and num2
Example
$numdiff(5 4) returns "1"


numitems
Function
$numitems()
Usage
$numitems(arrayname)
Returns
the number of items in the named array, or -1 if the array was not found.


numlines
Function
$numlines()
Usage
$numlines("string")
Returns
One fewer than the number of lines "string" might take up if displayed in the current window.


numonchannel
Function
$numonchannel()
Usage
$numonchannel(channel)
Returns
the number of users on a channel. if channel is omitted then the current channel is used.


numsort
Function
$numsort()
Usage
$numsort(words and/or numbers)
Returns
sorts stuff first alphabetically the numerically
Example
$numsort(asdf abdr c d 1 2 3 e) returns "abdr asdf c d e 1 2 3"


numwords
Function
$numwords()
Usage
$numwords(string of words)
Returns
the number of words in the arguments
Example
$numwords(count these words) returns 3


onchannel
Function
$onchannel()
Usage
$onchannel(channel) * OR * $onchannel(nick)
Returns
sorted list of nicks (channel) or if the nick is on channel If no args, sorted list of nicks for current channel is returned. Current channel is also used for (nick) test.


open
Function
$open()
Notes
Usage
$open(filename mode)
Returns
File handle (a number) for the opened file, if successful. Nothing if unsuccessful.
The mode argument can be R (or r), for a read-only file, or W (or w) to be able to write the file. Put a B (or b) after the mode for binary I/O.
Example
$open($ctoolz_dir/BitchX.quits R) returns a number (should, if it exists.


openserver
Function
$openserver()
Usage
$openserver(servername port [notify])
Usage
Supply a server name and a port (e.g. www.example.org and 80) to open a TCP/IP connection to the named server on the named port. You can supply an optional third argument to open the socket in Notify mode, and in this case the SOCKET_NOTIFY_LIST hook will be called when data is available. This does not connect to an IRC server necessarily; any I/O over the connection is up to your script..
Returns
File descriptor or -1


opensocket
Function
$opensocket()
Usage
$opensocket(servername port notify)
Returns
same as $openserver()


pad
Function
$pad()
Notes
if N is negative, it'll pad to the right if N is positive, it'll pad to the left
Usage
$pad(N string of text goes here)
Returns
a padded string of text, either left or right. Final length is N chars.
Example
$pad(20 letters) returns " letters"


pass
Function
$pass()
Usage
$pass(word1 word2)
Returns
does a char by char comparison of word2 to word1 and returns every char of word2 that appears in word1
Example
$pass(green yellow) returns "e" $pass(yellow green) returns "ee"


pattern
Function
$pattern()
Usage
$pattern(pattern string of words)
Returns
given a pattern and a string of words, returns all words that are matched by the pattern
Example
$pattern(f* one two three four five) returns "four five"


pid
Function
$pid()
Usage
$pid()
Returns
the pid of the process


pop
Function
$pop()
Notes
This function removes the LAST "word" in $varname
Usage
$pop(varname)
Returns
The value removed from varname.


ppid
Function
$ppid()
Usage
$ppid()
Returns
the parent pid of the process.


printlen
Function
$printlen()
Usage
$printlen()
Returns
same as $countansi();


push
Function
$push()
Usage
$push(var word1 word2 ... wordN)
Returns
The value of $var with the given words appended to it (the var need not previously exist)
Example
$push(newvar this is a new variable) returns "this is a new variable", provided $newvar does not exist.


querywin
Function
$querywin()
Usage
$querywin(nick)
Returns
The reference number of the window whose target is currently a private conversation with the given nick, or -1 if there is no such window.


rand
Function
$rand()
Usage
$rand(max)
Returns
A random number from zero to max-1.
Example
$rand(10) might return any number from 0 to 9.


randomnick
Function
$randomnick()
Usage
$randomnick()
Returns
a random nick
Example
$randomnick() returned "tqfftjg" one time


read
Function
$read()
Usage
$read(filenum bytes)
Returns
text read from the file opened by file handler "filenum"
Example
(none)


readserver
Function
$readserver()
Usage
$readserver(socket_num)
Returns
-1 if socket returns an error or it doesn't exist or the passed socket number plus any info read from the socket


readsocket
Function
$readsocket()
Usage
$readsocket(socketnumber)
Returns
same as $readserver().


regcomp
Function
$regcomp()
Usage
$regcomp(pattern)
Returns
An encoded string (in the form of $encode()) that you can store in a variable. You must pass this value to $regfree() when you are done with it. In the meantime, you can use it with $regexec to do matches.
The pattern here is actually a POSIX regular expression.


regerror
Function
$regerror()
Usage
$regerror(compiledpattern)
Returns
Returns a string explaining why the most recent call to $regmatch() or $regexec() failed.


regexec
Function
$regexec()
Usage
$regexec(compiledpattern string)
Returns
0 or 1 depending on whether the given string was matched by the regular expression, which must have been compiled using $regcomp().


regfree
Function
$regfree()
Usage
$regfree(compiledstring)
Returns
Use this when you have finished with a regular expression. If you don't do this, your BitchX process will grow (possibly by a few kilobytes) each time you compile a pattern, and will never shrink, so you can run out of memory and crash.


remw
Function
$remw()
Usage
$remw(word string of text)
Returns
"string of text" with the word "word" removed
Example
$remw(the now is the time for) returns "now is time for"


remws
Function
$remws()
Usage
$remws(word word word / word word word)
Returns
Returns the right hand side unchanged, except that any word on the right hand side that is also found on the left hand side will be removed. Space is not retained.


rename
Function
$rename()
Usage
$rename(oldname newname)
Returns
Renames a file; returns 0 or -1 depending upon the success of the rename


repeat
Function
$repeat()
Usage
$repeat(num text)
Returns
the "text" repeated "num" times
Example
$repeat(10 a) returns "aaaaaaaaaa"


rest
Function
$rest()
Usage
$rest(n string)
Returns
the given string starting at the nth chracter, in the same way that $restw() does for words. The first character is numbered zero.
Example
$rest(2 unhappy youth) returns "happy youth".


restw
Function
$restw()
Notes
the first word is numbered 0.
Usage
$restw(num string of text)
Returns
"string of text" that occurs starting with and including word number "num"
Example
$restw(3 now is the time for) returns "time for"
See also $rest().


reverse
Function
$reverse()
Usage
$reverse(words)
Returns
reverses the chars in the words.
Example
$reverse(this rules) returns "selur siht"


revw
Function
$revw
Usage
$revw(words)
Returns
reverses the words.
Example
$revw(this rules) returns "rules this"


rfilter
Function
$rfilter()
Usage
$rfilter(word list of patterns)
Returns
given a word and a list of patterns, return all patterns that do NOT match the word
Example
$rfilter(jnelson@example.org *@* jnelson@* f*@*.org) returns "f*@*.org"


right
Function
$right()
Usage
$right(number text)
Returns
the <number> rightmost characters in <text>.
Example
$right(5 the quick brown frog) returns " frog"


rightw
Function
$rightw()
Usage
$rightw(num string of text)
Returns
the right num words in "string of text"
Example
$rightw(3 now is the time for) returns "the time for"


rindex
Function
$rindex()
Usage
$rindex(characters text)
Returns
The number of leading characters in <text> that occur before the *last* occurance of any of the characters in the <characters> argument.
Example
$rindex(f three fine frogs) returns 12 (the 'f' in 'frogs') $rindex(frg three fine frogs) returns 15 (the 'g' in 'frogs')


rmatch
Function
$rmatch()
Notes
It is possible to embed spaces into a word or pattern simply by including the entire word or pattern within quotation marks (")
Usage
$rmatch(word list of patterns)
Returns
if no pattern in the list matches the word, it returns 0. Otherwise, it returns the number of the pattern that most exactly matches the word (first word is numbered one)
Example
$rmatch(foobar f*bar foo*ar g*ant) returns 2 $rmatch(booya f*bar foo*ar g*ant) returns 0


rmatchitem
Function
$rmatchitem()
Usage
$rmatchitem(arrayname input)
Returns
$rmatchitem() attempts to match the input text with an array of patterns, much like $rmatch(). Returns -1 if it cannot find the array, or -2 if no matches occur, or the integer index of the pattern which matched.


rmdir
Function
$rmdir()
Usage
$rmdir(dir)
Returns
1 if unsuccessful, 0 if successful (dont ask me why ;)
Example
$rmdir(.BitchX) returns 1
Note: on Unix-based systems $rmdir() will not remove a directory unless it is empty.


rot13
Function
$rot13()
Usage
$rot13(text)
Returns
the "text" encoded with ROT13 coding
Example
$rot13(asdf) returns "nfqs"


rpattern
Function
$rpattern()
Usage
$rpattern(word list of patterns)
Returns
Given a word and a list of patterns, return all patterns that match the word.
Example
$rpattern(jnelson@example.org *@* jnelson@* f*@*.org) returns "*@* jnelson@*"


rstrstr
Function
$rstrstr()
Usage
$rstrstr(search input)
Returns
The rightmost occurence of the string "search" within the input, and the rest of the input. The matching is case insensitive.
Example
$rstrstr(boy a boy with a boy's feet) returns "boy's feet".


rword
Function
$rword()
Usage
$rword(call this with a space-separated list of words)
Returns
A single rowd chosen at random from the list.


sar
Technical
This function searches for the given search string in the given text, and replaces if with the replacement text, if a match is found. The field delimiter may be any character; the first character found that is not a 'g' or 'r' is used.
Function
$sar()
Practical
This is the general purpose search-and-replace function. It allows you to look for any arbitrary text substring in any text string, and replace it with another arbitrary substring. Any of the strings may consist of variables to expand at runtime.
Usage
$sar([g][r]/<search>/<replace>/<text>)
Options
g replace all matches, not just the first r assume text is a variable name; assign return value to variable
Examples
@ foo = [foobarblah]
$sar(/oo/ee/booyamon) returns "beeyamon"
$sar(/oo/ee/foofoo) returns "feefoo"
$sar(g/oo/ee/foofoo) returns "feefee"
$sar(r/oo/ee/foo) returns and sets $foo to "feebarblah"
See also $regexec() and $msar().


sendcdcc
Function
$sendcdcc()
Usage
$sendcdcc(nick stuff)
Returns
0 I think. Sends cdcc stuff to the given nick.


server_version
Function
$server_version()
Usage
$server_version(open_server_number)
Returns
Server version, or "Unknown"; there is a builtin and rather short list of ircd versions that is not very reliable.


servername
Function
$servername()
Usage
$servername(num)
Returns
the name of the server "num" in your servers list
Example
$servername(0) returns "irc.emory.edu" on my machine


servernick
Function
$servernick()
Usage
$servernick(refnum)
Returns
Your nick on the given server.


servernum
Function
$servernum()
Usage
$servernum(servername)
Returns
Takes a server name and returns the associated refnum.


servers
Function
$servers()
Usage
$servers()
Returns
the list of servers.


setinfo
Function
$setinfo()
Notes
"nick" must be on your userlist
Usage
$setinfo(nick info)
Returns
0 or 1 depending on the success of the command
Example
$setinfo(panasync the coder for bitchx!) returns 1


setitem
Function
$setitem()
Usage
$setitem()
Usage
$setitem() sets an item of an array to a value, or creates a new array if the array doesn not already exist and the item number is zero, or it adds a new item to an existing array if the item number is one more than the prevously largest item number in the array.
Returns
0 on success;
1 on success if a new item was added to an existing array;
2 on success if a new array was created and item zero was set;
-1 if it is unable to find the array (and item number was not zero);
-2 if it was unable to find the item (item < 0 or item was greater than 1 + the prevous maximum item number.


shift
Function
$shift()
Notes
removes the first word from $var
Usage
$shift(var)
Returns
the word removed from $var
Compare with $push() and $pop()


sort
Function
$sort()
Usage
$sort(words and/or numbers)
Returns
sorts stuff alphabetically
Example
$sort(9 4 10 6 g n r f) returns "10 4 6 9 f g n r"
Compare with $numsort() wich would return "f g n r 4 6 9 10"


splice
Function
$splice()
Usage
$splice(variable start length)
Returns
removes length words fron the given variable, starting at the startth (the first is numbered zero) and returns the removed words
Example
/do assign boy.data.1 My name is Simon and my feet are bare /do $splice(boy.data.1 3 4) returns "simon and my feet"
/do echo $boy.data.1 now shows "My name is are bare".


split
Function
$split()
Usage
$split(splitstring stringtosplit)
Returns
a list composed of "stringtosplit" split using "splitstring"
Example
$split(a abacadaeaf) returns " b c d e f"


srand
Side effect
seeds the random number generater.
Function
$srand()
Notes
the argument is ignored.
Usage
$srand(seed)
Returns
Nothing.


statsparse
Function
$statsparse()
Usage
$statsparse(status vars)
Returns
the status vars expanded, formatted and everything :)
Example
$statsparse(%M) returns "mail: 7" when i ran it


status
Function
$status()
Usage
$status(winref# statusline#)
Returns
The Status line # of the window
Example
/eval echo $status(0 1)


stime
Function
$stime()
Notes
$stime() is really useful when you give it the argument $time(), ala $stime($time()) is the human readable form for now.
Usage
$stime(time)
Returns
The human-readable form of the date based on the <time> argument.
Example
$stime(1000) returns what time it was 1000 seconds from the epoch.


strftime
Function
$strftime()
Usage
$strftime(time format)
Returns
the formatted time str for time. if time is omitted then current time is used. man strftime for the format specs.


strip
Function
$strip()
Usage
$strip(characters text)
Returns
<text> with all instances of any characters in the <characters> argument removed.
Example
$strip(f free fine frogs) returns "ree ine rogs"
Notes
it can be difficult (actually, not possible) to remove spaces from a string using this function. To remove spaces, simply use this: $tr(/ //$text)
An alternative is $tr(/characters//$text)


stripansi
Function
$stripansi()
Usage
$stripansi(text)
Returns
"text" stripped ansi codes (the ^[)
Example
$stripansi(^[[0,10mfdsa) returns "[[0,10mfdsa"


stripansicodes
Function
$stripansicodes()
Usage
$stripansicodes()
Returns
"text" stripped of ALL ansi codes, including the #s and format codes
Example
$stripansicodes(^[[0,10mfdsa) returns "fdsa"


stripc
Function
$stripc()
Usage
$stripc("string that may contain spaces")
Returns
the input string with mIRC control-C-based colour sequencess removed. This is just a more cryptic name for $stripmirc().


stripmirc
Function
$stripmirc()
Usage
$stripmirc(text)
Returns
"text" stripped of mirc color codes
Example
$stripmirc(10ddf4asdf) returns "ddfasdf"


strlen
Function
$strlen()
Usage
$strlen(string)
Returns
the length of the string given
Example
$strlen(this is a string) returns 16


strstr
Function
$strstr()
Usage
$strstr(needle haystack)
Returns
a list of words from the first "needle" in "haystack" to the end of "haystack"
Example
$strstr(needle there is a needle in this haystack) returns "needle in this haystack"


tdiff
Function
$tdiff()
Usage
$tdiff(seconds)
Returns
The time that has elapsed represented in days/hours/minutes/seconds corresponding to the number of seconds passed as the argument.
Example
$tdiff(3663) returns "1 hour 1 minute 3 seconds"


tdiff2
Function
$tdiff2()
Usage
$tdiff2(timestr)
Returns
like tdiff but with d, h, m, s
Example
$tdiff(1234) returns 20m 34s


time
Function
$time()
Usage
$time()
Returns
The number of seconds that has elapsed since Jan 1, 1970, GMT.
Example
$time() returned something around 802835348 at the time I wrote this comment.


tolower
Function
$tolower()
Usage
$tolower(string)
Returns
the lower case string.


toupper
Function
$toupper()
Usage
$toupper(string)
Returns
the upper case string.


tow
Function
$tow()
Usage
$tow(pattern string of words)
Returns
the portion of "string of words" that occurs up to and including the first word that is matched by "pattern"
Example
$tow(panasync BitchX by panasync is cool) returns "BitchX by panasync"


tr
Function
$tr()
Usage
$tr(/abc/def/input)
Returns
input with a turned to d, b to e and c to f everywhere.
This is an alias for $translate(), which is really a transliteration function.


translate
Note
translates characters in a str See $tr() also.
Function
$translate()
Usage
$translate()
Example
$translate(/ //text)


trunc
Function
$trunc()
Usage
$trunc(num_of_digits number)
Returns
number truncated to num_of_digits
Example
/do echo $trunc(5 7819263864) returns 7819263864.00000
Note however that $trunc(3.123456 3) returns 3.000 and not 3.123


twiddle
Function
$twiddle()
Usage
$twiddle(arg)
Returns
the expanded variable "arg"
Example
$twiddle(~) returns "/home/by-tor" $twiddle($HOME) returns "/home/by-tor"
In other words, the current user's login directory.


uhc
Function
$uhc()
Usage
$uhc(mask)
Returns
If passed the empty string, returns the empty string. Otherwise, you can pass in a partial nick-user-host mask, and any missing parts are filled in with *, so if you pass Ankh!boy you get back Ankh!boy**.*, and if yuo pass just Ankh you get Ankh!*@*.*, and lee@example.org returns *!lee@example.org, and so on.


uhost
Function
$uhost()
Notes
it is CASE SENSITIVE
Usage
$uhost(nick)
Returns
the user@host of nick
Example
$uhost(mr_bill) returns fat@greased.up.pig.org =]


umask
Function
$umask()
Usage
$umask()
Returns
Sets the default umask for file creation, as per POSIX; see the Unix man page for umask(2).


umode
Function
$umode()
Usage
$umode(server_number)
Returns
returns the umode on that server or current server if no number given
Appears ot be a more cryptic alise for $usermode().


uname
Function
$uname()
Usage
$uname(format)
Returns
The operating environment information; without arguments on Linux-based systems this is often the Kernel version, e.g. Linux 2.12.4-0.mm.7mdv-i686-up-64GB.
The input string, if given, is used as a format and can contain the following codes:
%a all information (same as %s %n %r %v %m)
%s kernel name
%r kernel release
%v kernel version
%m machine name
%n network node hostname
%% (a literal percent sign).
The default is "%s %r".


uniq
Function
$uniq()
Usage
$uniq (string of text)
Returns
Given a set of words, returns a new set of words with duplicates removed.
Example
$uniq(one two one two) returns "one two"


unlink
Function
$unlink()
Usage
$unlink(filenames)
Returns
attempts to remove each filename given, and returns 0 on success, or the number of failures. The unlink function does not do anything (always returns zero) if BitchX was compiled with PUBLIC_ACCESS defined.
Example
$unlink(~/foo)


unshift
Function
$unshift()
Usage
$unshift(var <arg1> [arg2 arg3 ... argN])
Returns
the value of the var after the unshift
Example
assign cres.data.1 nuttin' but a smooth 100% /dev/zero $unshift(cres.data.1 Cres... ) returns "Cres... nuttin' but a smooth 100% /dev/zero"


uptime
Function
$uptime()
Usage
$uptime()
Returns
the current uptime for bX


userhost
Function
$userhost()
Notes
$userhost() changes with every single line that appears on your screen, so if you want to save it, you will need to assign it to a variable.
Usage
$userhost()
Returns
the userhost (if any) of the most previously recieved message.


usermode
Function
$usermode()
Usage
$usermode(servernum)
Returns
Your current user modes on the given server, or the current server if none is given.


utime
Function
$utime()
Usage
$utime()
Returns
the current uptime in the UNIXTIME format (seconds since 1970) plus 100,000'ths of a second
Example
$uptime() returned "869015766 424919" when i write this


version
Function
$version()
Usage
$version(servernumber)
Returns
Same as $server_version().


which
Function
$which()
Usage
$which(filename)
Returns
the absolute path of any file in ~/.BitchX
Example
$which(BitchX.help) returns (on my box) "/home/by-tor/.BitchX/BitchX.help"


winbound
Function
$winbound()
Usage
$winbound(channel|window)
Returns
Given a channel, tells you what window its bound to.
Given a window, tells you what channel its bound to.
With no arguments, seems to crach BitchX.


winchan
Function
$winchan()
Usage
$winchan(#channel <server refnum|server name>)
Returns
The refnum of the window where the channel is the current channel on the server refnum or server name. returns -1 on error


winlen
Function
$winlen()
Usage
$winlen(refnum)
Returns
The display size (number of lines) of the given window, or of the current window if no refnum is given.


winlevel
Function
$winlevel()
Usage
$winlevel(refnum)
Returns
The lastlog level of the given windoe


winnam
Function
$winnam()
Usage
$winnam()
Returns
the current window name if any.


winnicklist
Function
$winnicklist()
Usage
$winnicklist(refnum)
Returns
the list of nicks associated with the given window (e.g. people you've msg'd)


winnum
Function
$winnum()
Usage
$winnum()
Returns
the index number for the current window
Notes
returns -1 if there are no windows open (ie, in dumb mode)


winquery
Function
$winquery()
Usage
$winquery(querynick)
Returns
the window refnum with a query matching the querynick, or -1 if none.
Example
$winquery(panasync) returns -1


winrefs
Function
$winrefs()
Usage
$winrefs()
Returns
the window numbers in the order they were last active, from current to last
Example
$winrefs() returned "3 2 1" when i used it


winserv
Function
$winserv()
Usage
$winserv(refnum)
Returns
the server reference number of the server for the window referenced by refnum, or the current window if not specified. If "refnum" does not exist, it returns -1.
Example
$winserv() returns 0 (referencing irc.emory.edu)


winsize
Function
$winsize()
Usage
$winsize(refnum)
Returns
the window size of the window referenced by refnum
Example
$winsize(1) returns 22


winvisible
Function
$winvisible()
Usage
$winvisible(winnum)
Returns
1 of the window is visible, 0 if not and -1 if it does not exist
Example
$winvisible(1) returns 1 $winvisible(0) returns 1 $winvisible(11111111111111111111) returns -1


word
Function
$word()
Usage
$word(number text)
Returns
the <number>th word in <text>. The first word is numbered zero.
Example
$word(3 one two three four five) returns "four" (think about it)


write
Function
$write()
Usage
$write(fd words)
Returns
-1 on failure; writes the given words to the file you opened with $open(). Returns the number of characters written. The buffer is also flushed, so the data should appear in the file immediately.


writeb
Function
$writeb()
Usage
$writeb(filenum text)
Returns
The number of chars written to filenum
Example
$open(pfft W) returns 10 $writeb(10 pfft) returns 4


writeserver
Note
"\n" is appended to the end.
Function
$writeserver()
Usage
$writeserver(socket_num text)
Returns
Length written or -1, Never returns 0


writesocket
Function
$writesocket()
Usage
$writesocket(socketnum text)
Returns
number of bytes written, or -1; it's the same as $writeserver().