Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/doc/functions.txt
1069 views
1
BitchX function doc.
2
Last updated: 9/10/98 by power <[email protected]>
3
4
This is not a complete function manual. For all functions
5
please look in ../bitchx-docs/6_Functions/
6
7
8
9
Function: $left()
10
Usage: $left(number text)
11
Returns: the <number> leftmost characters in <text>.
12
Example: $left(5 the quick brown frog) returns "the q"
13
14
Function: $getkey()
15
Usage: $getkey(channel)
16
Returns: the channel key if there is one.
17
Example: $getkey(#BitchX) should return nothing ;)
18
19
Function: $right()
20
Usage: $right(number text)
21
Returns: the <number> rightmost characters in <text>.
22
Example: $right(5 the quick brown frog) returns " frog"
23
24
Function: $mid()
25
Usage: $mid(start number text)
26
Returns: the <start>th through <start>+<number>th characters in <text>.
27
Example: $mid(3 4 the quick brown frog) returns " qui"
28
Notes: the first character is numbered zero.
29
30
Function: $rand()
31
Usage: $rand(max)
32
Returns: A random number from zero to max-1.
33
Example: $rand(10) might return any number from 0 to 9.
34
35
Function: $srand()
36
Usage: $srand(seed)
37
Returns: Nothing.
38
Side effect: seeds the random number generater.
39
Notes: the argument is ignored.
40
41
Function: $time()
42
Usage: $time()
43
Returns: The number of seconds that has elapsed since Jan 1, 1970, GMT.
44
Example: $time() returned something around 802835348 at the time I wrote
45
this comment.
46
47
Function: $stime()
48
Usage: $stime(time)
49
Returns: The human-readable form of the date based on the <time> argument.
50
Example: $stime(1000) returns what time it was 1000 seconds from the epoch.
51
Notes: $stime() is really useful when you give it the argument $time(),
52
ala $stime($time()) is the human readable form for now.
53
54
Function: $tdiff()
55
Usage: $tdiff(seconds)
56
Returns: The time that has elapsed represented in days/hours/minutes/seconds
57
corresponding to the number of seconds passed as the argument.
58
Example: $tdiff(3663) returns "1 hour 1 minute 3 seconds"
59
60
Function: $index()
61
Usage: $index(characters text)
62
Returns: The number of leading characters in <text> that do not occur
63
anywhere in the <characters> argument.
64
Example: $index(f three fine frogs) returns 6 (the 'f' in 'fine')
65
$index(frg three fine frogs) returns 2 (the 'r' in 'three')
66
67
Function: $rindex()
68
Usage: $rindex(characters text)
69
Returns: The number of leading characters in <text> that occur before the
70
*last* occurance of any of the characters in the <characters>
71
argument.
72
Example: $rindex(f three fine frogs) returns 12 (the 'f' in 'frogs')
73
$rindex(frg three fine frogs) returns 15 (the 'g' in 'frogs')
74
75
Function: $match()
76
Usage: $match(pattern list of words)
77
Returns: if no words in the list match the pattern, it returns 0.
78
Otherwise, it returns the number of the word that most
79
exactly matches the pattern (first word is numbered one)
80
Example: $match(f*bar foofum barfoo foobar) returns 3
81
$match(g*ant foofum barfoo foobar) returns 0
82
Notes: it is possible to embed spaces inside of a word or pattern simply
83
by including the entire word or pattern in quotation marks. (")
84
85
Function: $rmatch()
86
Usage: $rmatch(word list of patterns)
87
Returns: if no pattern in the list matches the word, it returns 0.
88
Otherwise, it returns the number of the pattern that most
89
exactly matches the word (first word is numbered one)
90
Example: $rmatch(foobar f*bar foo*ar g*ant) returns 2
91
$rmatch(booya f*bar foo*ar g*ant) returns 0
92
Notes: It is possible to embed spaces into a word or pattern simply by
93
including the entire word or pattern within quotation marks (")
94
95
Function: $userhost()
96
Usage: $userhost()
97
Returns: the userhost (if any) of the most previously recieved message.
98
Notes: $userhost() changes with every single line that appears on your
99
screen, so if you want to save it, you will need to assign it to
100
a variable.
101
102
Function: $strip()
103
Usage: $strip(characters text)
104
Returns: <text> with all instances of any characters in the <characters>
105
argument removed.
106
Example: $strip(f free fine frogs) returns "ree ine rogs"
107
Notes: it can be difficult (actually, not possible) to remove spaces from
108
a string using this function. To remove spaces, simply use this:
109
$tr(/ //$text)
110
Actually, i recommend not using $strip() at all and just using
111
$tr(/characters//$text)
112
(but then again, im biased. >;-)
113
114
Function: $encode()
115
Usage: $encode(text)
116
Returns: a string, uniquely identified with <text> such that the string
117
can be used as a variable name.
118
Example: $encode(fe fi fo fum) returns "GGGFCAGGGJCAGGGPCAGGHFGN"
119
Notes: $encode($decode(text)) returns text (most of the time)
120
$decode($encode(text)) also returns text.
121
122
Function: $decode()
123
Usage: $decode(text)
124
Returns: If <text> was generated with $encode(), it returns the string
125
you originally encoded. If it wasnt, you will probably get
126
nothing useful in particular.
127
Example: $decode(GGGFCAGGGJCAGGGPCAGGHFGN) returns "fe fi fo fum"
128
Notes: $encode($decode(text)) returns "text"
129
$decode($encode(text)) returns "text" too.
130
Yes. $decode(plain-text) does compress the data by a factor of 2.
131
But it ignores non-ascii text, so use this as compression at your
132
own risk and peril.
133
134
Function: $ischannel()
135
Usage: $ischannel(text)
136
Returns: If <text> could be a valid channel name, 1 is returned.
137
If <text> is an illegal channel name, 0 is returned.
138
Example: $ischannel(i_am_not_on_this_channel) returns 0
139
$ischannel(#i_am_not_on_this_channel) returns 1
140
Notes: Contrary to popular belief, this function does NOT determine
141
whether a given channel name is in use!
142
143
Function: $ischanop()
144
Usage: $ischanop(nick channel)
145
Returns: 1 if <nick> is a channel operator on <channel>
146
0 if <nick> is not a channel operator on <channel>
147
* O R *
148
if you are not on <channel>
149
Notes: Contrary to popular belief, this function can only tell you
150
who the channel operators are for channels you are already on!
151
Boo Hiss: This should be $ischanop(channel nick <nick...nick>)
152
and return a list (1 1 ... 0), which would allow us to
153
call is_chanop() without ripping off the nick, and allow
154
us to abstract is_chanop() to take a list. oh well...
155
Too late to change it now. :/
156
157
Function: $word()
158
Usage: $word(number text)
159
Returns: the <number>th word in <text>. The first word is numbered zero.
160
Example: $word(3 one two three four five) returns "four" (think about it)
161
162
Function: $winnum()
163
Usage: $winnum()
164
Returns: the index number for the current window
165
Notes: returns -1 if there are no windows open (ie, in dumb mode)
166
167
Function: $winnam()
168
Usage: $winnam()
169
Returns: the current window name if any.
170
171
Function: $connect()
172
Usage: $connect(host port)
173
Returns: the socket number to use for read/write.
174
175
Function: $listen()
176
Usage: $listen(port)
177
Returns: the port allocated for the RAW_LISTEN
178
179
Function: $toupper()
180
Usage: $toupper(string)
181
Returns: the upper case string.
182
183
Function: $tolower()
184
Usage: $tolower(string)
185
Returns: the lower case string.
186
187
Function: $curpos()
188
Usage: $curpos()
189
Returns: returns current position in window buffer
190
191
Function: $mychannels()
192
Usage: $channels()
193
Returns: the channels you are currently in
194
195
Function: $servers()
196
Usage: $servers()
197
Returns: the list of servers.
198
199
Function: $pid()
200
Usage: $pid()
201
Returns: the pid of the process
202
203
Function: $ppid()
204
Usage: $ppid()
205
Returns: the parent pid of the process.
206
207
Function: $strftime()
208
Usage: $strftime(time format)
209
Returns: the formatted time str for time. if time is omitted then current
210
time is used. man strftime for the format specs.
211
212
Function: $idle()
213
Usage: $idle()
214
Returns: the idle time.
215
216
Function: $before()
217
Usage: $before(chars string of text)
218
Returns: the part of "string of text" that occurs before the
219
first instance of any character in "chars"
220
Example: $before(! [email protected]) returns "hop"
221
222
Function: $after()
223
Usage: $after(chats string of text)
224
Returns: the part of "string of text" that occurs after the
225
first instance of any character in "chars"
226
Example: $after(! [email protected]) returns "[email protected]"
227
228
Function: $leftw()
229
Usage: $leftw(num string of text)
230
Returns: the left "num" words in "string of text"
231
Example: $leftw(3 now is the time for) returns "now is the"
232
233
Function: $rightw()
234
Usage: $rightw(num string of text)
235
Returns: the right num words in "string of text"
236
Example: $rightw(3 now is the time for) returns "the time for"
237
238
Function: $midw()
239
Usage: $midw(start num string of text)
240
Returns: "num" words starting at word "start" in the string "string of text"
241
Example: $midw(2 2 now is the time for) returns "the time"
242
Notes: The first word is word #0.
243
244
Function: $notw()
245
Usage: $notw(num string of text)
246
Returns: "string of text" with word number "num" removed.
247
Example: $notw(3 now is the time for) returns "now is the for"
248
Notes: The first word is numbered 0.
249
250
Function: $restw()
251
Usage: $restw(num string of text)
252
Returns: "string of text" that occurs starting with and including
253
word number "num"
254
Example: $restw(3 now is the time for) returns "time for"
255
Notes: the first word is numbered 0.
256
257
Function: $remw()
258
Usage: $remw(word string of text)
259
Returns: "string of text" with the word "word" removed
260
Example: $remw(the now is the time for) returns "now is time for"
261
262
Function: $insertw()
263
Usage: $insertw(num word string of text)
264
Returns: "string of text" such that "word" is the "num"th word
265
in the string.
266
Example: $insertw(3 foo now is the time for) returns "now is the foo time for"
267
Notes: the first word is numbered 0.
268
269
Function: $chngw()
270
Usage: $chngw(num word string of text)
271
Returns: "string of text" such that the "num"th word is removed
272
and replaced by "word"
273
Example: $chngw(3 foo now is the time for) returns "now is the foo for"
274
Notes: the first word is numbered 0
275
276
Function: $common()
277
Usage: $common (string of text / string of text)
278
Returns: Given two sets of words seperated by a forward-slash '/', returns
279
all words that are found in both sets.
280
Example: $common(one two three / buckle my two shoe one) returns "one two"
281
Notes: returned in order found in first string.
282
283
Function: $diff()
284
Usage: $diff(string of text / string of text)
285
Returns: given two sets of words, seperated by a forward-slash '/', returns
286
all words that are not found in both sets
287
Example: $diff(one two three / buckle my three shoe)
288
returns "one two buckle my shoe"
289
290
Function: $pattern()
291
Usage: $pattern(pattern string of words)
292
Returns: given a pattern and a string of words, returns all words that
293
are matched by the pattern
294
Example: $pattern(f* one two three four five) returns "four five"
295
296
Function: $filter()
297
Usage: $filter(pattern string of words)
298
Returns: given a pattern and a string of words, returns all words that are
299
NOT matched by the pattern
300
Example: $filter(f* one two three four five) returns "one two three"
301
302
Function: $rpattern()
303
Usage: $rpattern(word list of patterns)
304
Returns: Given a word and a list of patterns, return all patterns that
305
match the word.
306
Example: $rpattern([email protected] *@* jnelson@* f*@*.edu)
307
returns "*@* jnelson@*"
308
309
Function: $rfilter()
310
Usage: $rfilter(word list of patterns)
311
Returns: given a word and a list of patterns, return all patterns that
312
do NOT match the word
313
Example: $rfilter([email protected] *@* jnelson@* f*@*.edu)
314
returns "f*@*.edu"
315
316
Function: $copattern()
317
Usage: $copattern(pattern var_1 var_2)
318
Returns: Given a pattern and two variable names, it returns all words
319
in the variable_2 corresponding to any words in variable_1 that
320
are matched by the pattern
321
Example: @nicks = [hop IRSMan skip]
322
@userh = [[email protected] [email protected] [email protected]]
323
$copattern(*@iastate.edu userh nicks)
324
returns "hop IRSMan"
325
326
Function: $beforew()
327
Usage: $beforew(pattern string of words)
328
Returns: the portion of "string of words" that occurs before the
329
first word that is matched by "pattern"
330
Example: $beforew(three one two three o leary) returns "one two"
331
332
Function: $tow()
333
Usage: $tow(pattern string of words)
334
Returns: the portion of "string of words" that occurs up to and including
335
the first word that is matched by "pattern"
336
Example: $tow(panasync BitchX by panasync is cool)
337
returns "BitchX by panasync"
338
339
Function: $afterw()
340
Usage: $afterw(number words)
341
Returns: the string after the word being matched
342
343
Function: $fromw()
344
Usage: $fromw(pattern word1 ?word2? ... ?wordN?)
345
Returns: the string starting with the word being matched
346
Example: $fromw(asf asdf asf asdf) returns "asf asdf"
347
348
Function: $splice()
349
Usage: $splice(variable start length)
350
Returns: APPEARS to return a list of words starting with word "start"
351
of the variable, of length "length"
352
Example: assign cres.data.1 Cres... nuttin' but a smooth 100% /dev/zero
353
$splice(cres.data.1 4 3) returns "smooth 100% /dev/zero"
354
Notes: Not sure, but I think the first word is zero (thats pretty
355
standard)
356
357
Function: $numonchannel()
358
Usage: $numonchannel(channel)
359
Returns: the number of users on a channel. if channel is omitted then the
360
current channel is used.
361
362
Function: $onchannel()
363
Usage: $onchannel(channel) * OR * $onchannel(nick)
364
Returns: sorted list of nicks (channel) or if the nick is on channel
365
If no args, sorted list of nicks for current channel is returned.
366
Current channel is also used for (nick) test.
367
368
Function: $channelnicks()
369
Usage: $channelnicks(channel)
370
Returns: chops in a comma separated list.
371
372
Function: $chops()
373
Usage: $chops(channel)
374
Returns: chops in a space separated list.
375
376
Function: $nochops()
377
Usage: $nochops(channel)
378
Returns: nops in a space separated list.
379
380
Function: $key()
381
Usage: $key(channel)
382
Returns: channel key or "*" if none.
383
384
Function: $revw
385
Usage: $revw(words)
386
Returns: reverses the words.
387
Example: $revw(this rules) returns "rules this"
388
389
Function: $reverse()
390
Usage: $reverse(words)
391
Returns: reverses the chars in the words.
392
Example: $reverse(this rules) returns "selur siht"
393
394
Function: $strstr()
395
Usage: $strstr(needle haystack)
396
Returns: a list of words from the first "needle" in "haystack" to the end
397
of "haystack"
398
Example: $strstr(needle there is a needle in this haystack)
399
returns "needle in this haystack"
400
401
Function: $jot()
402
Usage: $jot(val1 val2 ?step?)
403
Returns: list of #'s from val1 to val2 by options ?step?, decreasing OR
404
increasing
405
Example: $jot(9 5 2) returns "9 7 5"
406
407
Function: $shift()
408
Usage: $shift(var)
409
Notes: removes the first word from $var
410
Returns: the word removed from $var
411
412
Function: $unshift()
413
Usage: $unshift(var <arg1> [arg2 arg3 ... argN])
414
Returns: the value of the var after the unshift
415
Example: assign cres.data.1 nuttin' but a smooth 100% /dev/zero
416
$unshift(cres.data.1 Cres... ) returns
417
"Cres... nuttin' but a smooth 100% /dev/zero"
418
419
Function: $tdiff2()
420
Usage: $tdiff2(timestr)
421
Returns: like tdiff but with d, h, m, s
422
Example: $tdiff(1234) returns 20m 34s
423
424
Function: $winchan()
425
Usage: $winchan(#channel <server refnum|server name>)
426
Returns: The refnum of the window where the channel is the current channel
427
on the server refnum or server name.
428
returns -1 on error
429
430
Function: $crypt()
431
Usage: $crypt(password seed)
432
Returns: a 13-char encrypted string when given a seed and password.
433
Returns zero (0) if one or both args missing. Additional
434
args ignored.
435
Notes: Password truncated to 8 chars. Spaces allowed, but password
436
must be inside "" quotes.
437
438
Function: $pad()
439
Usage: $pad(N string of text goes here)
440
Returns: a padded string of text, either left or right. Final length is
441
N chars.
442
Notes: if N is negative, it'll pad to the right
443
if N is positive, it'll pad to the left
444
Example: $pad(20 letters) returns " letters"
445
446
Function: $uniq()
447
Usage: $uniq (string of text)
448
Returns: Given a set of words, returns a new set of words with duplicates
449
removed.
450
Example: $uniq(one two one two) returns "one two"
451
452
Function: $sar()
453
Usage: $sar([g][r]/<search>/<replace>/<text>)
454
Technical:
455
This function searches for the given search string in the given
456
text, and replaces if with the replacement text, if a match is
457
found. The field delimiter may be any character; the first
458
character found that is not a 'g' or 'r' is used.
459
Practical:
460
This is the general purpose search-and-replace function. It allows
461
you to look for any arbitrary text substring in any text string, and
462
replace it with another arbitrary substring. Any of the strings may
463
consist of variables to expand at runtime.
464
Options:
465
g replace all matches, not just the first
466
r assume text is a variable name; assign return value to variable
467
Examples:
468
@ foo = [foobarblah]
469
$sar(/oo/ee/booyamon) returns "beeyamon"
470
$sar(/oo/ee/foofoo) returns "feefoo"
471
$sar(g/oo/ee/foofoo) returns "feefee"
472
$sar(r/oo/ee/foo) returns and sets $foo to
473
"feebarblah"
474
475
Function: $push()
476
Usage: $push(var word1 word2 ... wordN)
477
Returns: The value of $var with the given words appended to it (the var
478
need not previously exist)
479
Example: $push(newvar this is a new variable) returns "this is a new
480
variable", provided $newvar does not exist.
481
482
Function: $pop()
483
Usage: $pop(varname)
484
Returns: The value removed from varname.
485
Notes: This function removes the LAST "word" in $varname
486
487
Function: $center()
488
Usage: $center(width string)
489
Returns: Returns the string centered in "width" chars
490
Notes: The string is truncated from the right, so the returned length
491
is NOT "width".
492
Example: $center(30 BitchX) returns " BitchX"
493
494
Function: $split()
495
Usage: $split(splitstring stringtosplit)
496
Returns: a list composed of "stringtosplit" split using "splitstring"
497
Example: $split(a abacadaeaf) returns " b c d e f"
498
499
Function: $chr()
500
Usage: $chr(num [num2] ... [numN])
501
Returns: the ascii char(s) the given "num(s)"
502
Example: $chr(120 121 122) returns "xyz"
503
504
Function: $ascii()
505
Usage: $ascii(char [char2] ... [charN])
506
Returns: the ASCII value of the given chars
507
Note: the arguments of $ascii() are NOT whitespaced.
508
Example: $ascii(xyz) returns "120 121 122"
509
510
Function: $which()
511
Usage: $which(filename)
512
Returns: the absolute path of any file in ~/.BitchX
513
Example: $which(BitchX.help) returns (on my box)
514
"/home/by-tor/.BitchX/BitchX.help"
515
516
Function: $isalpha()
517
Usage: $isalpha(char)
518
Returns: 1 or 0 if char alpha or not
519
Example: $isalpha(6) returns 0
520
521
Function: $isdigit()
522
Usage: $isdigit(digit)
523
Returns: 1 or 0 if digit is a digit or not
524
Example: $isdigit(4) returns 1
525
526
Function: $isnum()
527
Usage: $isnum(num)
528
Returns: 1 or 0 if num is a number or not
529
Example: $isnum(44) returns 1
530
531
Function: $open()
532
Usage: $open(filename mode)
533
Returns: File handler # for the opened file, if successful. Nothing if
534
unsuccessful.
535
Example: $open($ctoolz_dir/BitchX.quits R) returns a # (should, if it
536
exists.
537
Notes: Possible flags are R and W from what I know...
538
539
Function: $close()
540
Usage: $close(filenum)
541
Returns: 0 or -1, if closing the file handler "filenum" was successful or
542
unsuccessful, respectively.
543
Example: $close(99999999999999) returns -1 (hopefully)
544
545
Function: $writeb()
546
Usage: $writeb(filenum text)
547
Returns: The number of chars written to filenum
548
Example: $open(pfft W) returns 10
549
$writeb(10 pfft) returns 4
550
551
Function: $read()
552
Usage: $read(filenum bytes)
553
Returns: text read from the file opened by file handler "filenum"
554
Example: (none)
555
556
Function: $eof()
557
Usage: $eof(filenum)
558
Returns: 0 or 1 depending on if the next char in the file is an EOF
559
Example: $open(pfft R) returns 10
560
$eof(10) returns 0
561
562
Function: $iptoname()
563
Usage: $iptoname(quad.dotted.ip)
564
Returns: the hostname for the given IP
565
Example: $iptoname(127.0.0.1) returns localhost
566
567
Function: $nametoip()
568
Usage: $nametoip(hostname)
569
Returns: the dotted quad IP address for hostname
570
Example: $nametoip(localhost) returns 127.0.0.1
571
572
Function: $convert()
573
Usage: $convert(IP or hostname)
574
Returns: either the reverse lookup of a given IP or the IP of a hostname
575
Example: $convert(127.0.0.1) returns localhost
576
$convert(localhost) returns 127.0.0.1
577
578
Function: $unlink()
579
Usage: $unlink(words)
580
Returns: appears to return the # of words
581
Example: $unlink(1 2 3) return 3
582
583
Function: $rename()
584
Usage: $rename(oldname newname)
585
Returns: 0 or -1 depending upon the success of the rename
586
Example: $rename(/etc/passwd /etc/mypasswd) returns 0 if you are root ;)
587
588
Function: $rmdir()
589
Usage: $rmdir(dir)
590
Returns: 1 if unsuccessful, 0 if successful (dont ask me why ;)
591
Example: $rmdir(.BitchX) returns 1
592
593
Function: $utime()
594
Usage: $utime()
595
Returns: the current uptime in the UNIXTIME format (seconds since 1970)
596
plus 100,000'ths of a second
597
Example: $uptime() returned "869015766 424919" when i write this
598
599
Function: $stripansi()
600
Usage: $stripansi(text)
601
Returns: "text" stripped ansi codes (the ^[)
602
Example: $stripansi([0,10mfdsa) returns "[[0,10mfdsa"
603
604
Function: $stripansicodes()
605
Usage: $stripansicodes()
606
Returns: "text" stripped of ALL ansi codes, including the #s and format codes
607
Example: $stripansicodes([0,10mfdsa) returns "fdsa"
608
609
Function: $stripmirc()
610
Usage: $stripmirc(text)
611
Returns: "text" stripped of mirc color codes
612
Example: $stripmirc(10ddf4asdf) returns "ddfasdf"
613
614
Function: $servername()
615
Usage: $servername(num)
616
Returns: the name of the server "num" in your servers list
617
Example: $servername(0) returns "irc.emory.edu" on my machine
618
619
Function: $lastserver()
620
Usage: $lastserver()
621
Returns: the server reference number of the last (and/or current) server
622
you connected to
623
Example: $lastserver() returns 0 on my box
624
625
Function: $winquery()
626
Usage: $winquery(querynick)
627
Returns: the window refnum with a query matching the querynick, or -1 if none.
628
Example: $winquery(panasync) returns -1
629
630
Function: $winserv()
631
Usage: $winserv(refnum)
632
Returns: the server reference number of the server for the window referenced
633
by refnum, or the current window if not specified. If "refnum" does
634
not exist, it returns -1.
635
Example: $winserv() returns 0 (referencing irc.emory.edu)
636
637
Function: $numwords()
638
Usage: $numwords(string of words)
639
Returns: the number of words in the arguments
640
Example: $numwords(count these words) returns 3
641
642
Function: $strlen()
643
Usage: $strlen(string)
644
Returns: the length of the string given
645
Example: $strlen(this is a string) returns 16
646
647
Function: $fexist()
648
Usage: $fexist(file)
649
Returns: returns 1 if file exists, -1 otherwise
650
Example: $fexist(/usr/local/bin/BitchX) returns 1
651
652
Function: $fsize()
653
Usage: $fsize(file)
654
Returns: the size of "file" or -1 if it doesnt exist
655
Example: $fsize(/usr/local/bin/BitchX-72) returns 786628
656
657
Function: $info()
658
Usage: $info()
659
Returns: some crap about BitchX i have no idea what it means
660
Example: $info() returns BitchX+adegikltz in bX72+tcl1.0 (tcl 8.0b2)
661
662
Function: $geom()
663
Usage: $geom()
664
Returns: the geometry of the current window
665
Example: $geom() returns "79 24" on my box
666
667
Function: $pass()
668
Usage: $pass(word1 word2)
669
Returns: does a char by char comparison of word2 to word1 and returns every
670
char of word2 that appears in word1
671
Example: $pass(green yellow) returns "e"
672
$pass(yellow green) returns "ee"
673
674
Function: $uptime()
675
Usage: $uptime()
676
Returns: the current uptime for bX
677
Example: $uptime() returns "0d 0h 31m 6s" when i made this
678
679
Function: $eleet()
680
Usage: $eleet(text)
681
Returns: "text" parsed through bX's "eleet" text parser
682
Example: $eleet(this is ereet text) returns "+h15 15 3r33+ +3x+"
683
684
Function: $cool()
685
Usage: $cool(text)
686
Returns: "text" parsed through bX's "cool" text parser
687
Example: $cool(this is cool text) returns "ThIs iS CoOl tExT"
688
689
Function: $cool2()
690
Usage: $cool2(text)
691
Returns: "text" parsed through bX's "cool2" text parser
692
Example: $cool2(this is cool2 text) returns "THiS iS CooL2 TeXT"
693
694
Function: $annoy()
695
Usage: $annoy(text)
696
Returns: "text" parsed through bX's "annoy" text parser
697
Example: $annoy(this is annoy text) returns random annoy text ;)
698
699
Function: $checkshit()
700
Usage: $checkshit(userhost channel)
701
Returns: if given a hostmask matching your shitlist, returns the shitlist
702
level and channels its active for
703
Example: $checkshit(*!*@* #mirc) returns "4 #mirc" ;)
704
705
Function: $checkuser()
706
Usage: $checkuser(userhost channel)
707
Returns: if given a hostmask matching one on your userlist, returns the
708
level, aop protect level, etc
709
Example: $checkuser([email protected] #bitchx) returns
710
51 1 1 *nova@*.randomc.com #bitchx
711
712
Function: $checkbot()
713
Usage: $checkbot(userhost channel)
714
Returns: if given a hostname matching one on your bot list, returns the
715
pertinent info ...
716
Example: $checkbot([email protected] #yyz) returns
717
3 3 *[email protected] #yyz
718
719
Function: $getinfo()
720
Usage: $getinfo(nick)
721
Returns: the info set by $setinfo() for a valid nick on your userlist
722
Example: $getinfo(panasync) returns "the coder for bitchx!"
723
724
Function: $setinfo()
725
Usage: $setinfo(nick info)
726
Returns: 0 or 1 depending on the success of the command
727
Notes: "nick" must be on your userlist
728
Example: $setinfo(panasync the coder for bitchx!) returns 1
729
730
Function: $rot13()
731
Usage: $rot13(text)
732
Returns: the "text" encoded with ROT13 coding
733
Example: $rot13(asdf) returns "nfqs"
734
735
Function: $flash()
736
Usage: $flash(num)
737
Returns: the "flash" string referenced by num
738
Example: $flash(3) returns "**XB00"
739
740
Function: $repeat()
741
Usage: $repeat(num text)
742
Returns: the "text" repeated "num" times
743
Example: $repeat(10 a) returns "aaaaaaaaaa"
744
745
Function: $epic()
746
Usage: $epic()
747
Returns: 1 if its an epic client, 0 if not
748
Example: $epic() returns 1
749
750
Function: $winsize()
751
Usage: $winsize(refnum)
752
Returns: the window size of the window referenced by refnum
753
Example: $winsize(1) returns 22
754
755
Function: $lastnotice()
756
Usage: $lastnotice(refnum)
757
Returns: the last notice recieved or nothing if none
758
Example: $lastnotice(10) returns
759
"10:19pm |By-Tor| [email protected] |By-tor| yo"
760
761
Function: $lastmessage()
762
Usage: $lastmessage(refnum)
763
Returns: the last message recieved or nothing if none
764
Example: $lastmessage(10) returns
765
10:19pm |By-Tor| [email protected] |By-tor| yo
766
767
Function: $sort()
768
Usage: $sort(words and/or numbers)
769
Returns: sorts stuff first numerically then alphabetically
770
Example: $sort(9 4 1 6 g n r f) returns "1 4 6 9 f g n r"
771
772
Function: $notify()
773
Usage: $notify(on/off/serv #)
774
Returns: various info about NOTIFY list
775
Example: $notify() returns current notify list
776
$notify(on serv 0) returns who is currently ON server #5
777
778
Function: $numsort()
779
Usage: $numsort(words and/or numbers)
780
Returns: sorts stuff first alphabetically the numerically
781
Example: $numsort(asdf abdr c d 1 2 3 e) returns "abdr asdf c d e 1 2 3"
782
783
Function: $glob()
784
Usage: $glob(path/mask)
785
Returns: the list of files in path which match "mask" using glob type
786
matching
787
Example: $glob(/*lin*) should return vmlinuz if you are ereet and run linux
788
789
Function: $mkdir()
790
Usage: $mkdir(dir)
791
Returns: 0 if the mkdir was successful, 1 if not
792
Example: $mkdir(/usr) returns 1 (unsuccessful)
793
794
Function: $umask()
795
Usage: $umask()
796
Returns: Sets the default umask for file creation
797
Example:
798
799
Function: $help()
800
Usage: $help(help)
801
Returns: the bX /bhelp for "help"
802
Example: $help(help) returns:
803
"[�] Help on Topic: help"
804
" Usage: /BHelp <Topic|Index>"
805
" Topic - This gives help on <Topic>"
806
" Index - This shows the list of commands supplied in BitchX"
807
808
Function: $isuser(nick userhost)
809
Usage: $isuser(nick userhost)
810
Returns: given a nick (or *) and a user@host (any wildcard form), the
811
corresponding userlist information if a match is found.
812
Example: $isuser(* edwards@*.sympatico.ca) returns
813
"USER 100 1 1 *edwards@*.sympatico.ca #bitchx" on my machine
814
815
Function: $isban()
816
Usage: $isban(channel ban)
817
Returns: 1 if the ban matches a shitlist ban entry (3 or 4), 0 if not
818
Example: $isban(#bitchx *!*@*mirc*) returns 1 ;)
819
820
Function: $banonchannel()
821
Usage: $banonchannel(channel ban)
822
Returns: 0 if the ban does not exist on the channel, 1 if it does
823
Example: $banonchannel(#bitchx *!*@*mirc*) returns 1 ;)
824
825
Function: $isop()
826
Usage: $isop(channel nick)
827
Returns: 1 if the nick is an op in both your userlist for the channel AND an
828
op on the channel, 0 otherwise.
829
Example: $isop(#bitchx panasync) returns 1
830
831
Function: $isvoice()
832
Usage: $isvoice(channel nick)
833
Returns: 1 if the nick is +v, 0 if not.
834
Example: $isvoice(#bitchx panasync) returns 0
835
836
Function: $randomnick()
837
Usage: $randomnick()
838
Returns: a random nick
839
Example: $randomnick() returned "tqfftjg" one time
840
841
Function: $cparse()
842
Usage: $cparse(text)
843
Returns: "text" with the ANSI codes substituted for the ANSI parse vars.
844
Example: /do echo $cparse("%Rthis is bright red")
845
846
Function: $getreason()
847
Usage: $getreason(text)
848
Returns: a random reason from BitchX.reasons
849
Notes: you MUST use some argument for this, or it returns nothing.
850
Example: $getreason(asdf) returned
851
"When faith is lost, when honor dies, The man is dead!"
852
853
Function: $chmod()
854
Usage: $chmod(file numeric-mode)
855
Returns: 0 if a successful, -1 if not
856
Example: $chmod(.BitchX/BitchX.quits 666) returns 0 and sets the permissions
857
of the file to "666" or "-rw-rw-rw-"
858
859
Function: $twiddle()
860
Usage: $twiddle(arg)
861
Returns: the expanded variable "arg"
862
Example: $twiddle(~) returns "/home/by-tor"
863
$twiddle($HOME) returns "/home/by-tor"
864
865
Function: $uhost()
866
Usage: $uhost(nick)
867
Returns: the user@host of nick
868
Notes: it is CASE SENSITIVE
869
Example: $uhost(mr_bill) returns [email protected] =]
870
871
Function: $numdiff()
872
Usage: $numdiff(num1 num2)
873
Returns: the difference of num1 and num2
874
Example: $numdiff(5 4) returns "1"
875
876
Function: $winvisible()
877
Usage: $winvisible(winnum)
878
Returns: 1 of the window is visible, 0 if not and -1 if it does not exist
879
Example: $winvisible(1) returns 1
880
$winvisible(0) returns 1
881
$winvisible(11111111111111111111) returns -1
882
883
Function: $mircansi()
884
Usage: $mircansi(text with lame mirc color codes)
885
Returns: the given text with ANSI color substituted for mirc color
886
Example: $mircansi(3asdf) returns the same color as $cparse(%gasdf)
887
888
Function: $winrefs()
889
Usage: $winrefs()
890
Returns: the window numbers in the order they were last active, from current
891
to last
892
Example: $winrefs() returned "3 2 1" when i used it
893
894
Function: $getenv()
895
Usage: $getenv(var)
896
Returns: the environment variable "var"
897
Notes: do NOT use a $
898
Example: $getenv(HOME) returns "/home/by-tor"
899
900
Function: $gethost(nick)
901
Usage: $gethost(nick)
902
Returns: the user@host of the given nick
903
Notes: NOT case sensitive
904
Example: $gethost(piker) returns [email protected] :)
905
906
Function: $aliasctl()
907
Usage: $aliactl(alias|assign get|set|match <lval> [<rval>])
908
Notes: This function allows low-level manipulation of aliases and assigns.
909
The noun of the action is either "alias" or "assign". The verb is
910
either "get", "set", or "match". The "lval" must a valid variable
911
name. The "rval" is used only if the verb is "set", and is any
912
sequence of octets.
913
914
* The "GET" verb allows you to retrieve the value of an alias or
915
assign named by "lval".
916
* The "SET" verb allows you to set the value of an alias or assign
917
named by "lval" to "rval".
918
* The "MATCH" verb allows you to retrive the list of all same-level
919
variable names that begin with "lval" (ie, command completion).
920
Wildcards are not allowed, but the simple use of a single asterisk
921
is allowed to match all assigns or aliases.
922
Example: $aliasctl(alias get join) returns current value of alias "join"
923
$aliasctl(alias set join //channel) sets an alias called "join"
924
$aliasctl(assign match foo) returns all vars starting with "foo"
925
$aliasctl(alias match foo.) returns all aliases of "foo" struct
926
927
Function: $statsparse()
928
Usage: $statsparse(status vars)
929
Returns: the status vars expanded, formatted and everything :)
930
Example: $statsparse(%M) returns "mail: 7" when i ran it
931
932
Function: $absstrlen()
933
Usage: $absstrlen(text)
934
Returns: the absolute length of text, which is how long it would be on your
935
screen
936
Example: $absstrlen($cparse(%Fasdf)) returns 4, where
937
$strlen($cparse(%Fasdf)) returns 12
938
939
Function: $findw()
940
Usage: $findw(word string of text)
941
Returns: the index of the first occurrence of "word" in the string of text
942
Notes: the first word is index 0
943
Example: $findw(word there is a word in here somewhere) returns 3
944
945
Function: $countansi()
946
Usage: $countansi(text)
947
Returns: the number of ansi-color related chars in the string
948
Example: $countansi($cparse(%B)) returns 11
949
950
Function: $longip()
951
Usage: $longip(dotted.quad.ip)
952
Returns: the "long" form of the given IP
953
Example: $longip(127.0.0.1) returns 2130706433
954
955
Function: $status()
956
Usage: $status(winref# statusline#)
957
Returns: The Status line # of the window
958
Example: /eval echo $status(0 1)
959
960
Function: $getvar()
961
Usage: $getvar(alias)
962
Returns: The given alias
963
Example: /eval echo $getvar(kb)
964
965
Function: $openserver()
966
Usage: $openserver(servername port)
967
Returns: File descriptor or -1
968
969
Function: $closeserver()
970
Usage: $closeserver(number_of_open_socket)
971
Returns: The socket number
972
973
Function: $readserver()
974
Usage: $readserver(socket_num)
975
Returns: -1 if socket returns an error or it doesn't exist
976
or
977
the passed socket number plus any info read from the socket
978
979
Function: $writeserver()
980
Usage: $writeserver(socket_num text)
981
Returns: Length written or -1, Never returns 0
982
Note: "\n" is appended to the end.
983
984
Function: $addtabkey()
985
Usage: $addtabkey(nick array)
986
Returns: nothing
987
988
Function: $gettabkey()
989
Usage: $gettabkey(direction array)
990
Returns: The tabkey list
991
Example: /eval echo $gettabkey(1)
992
993
Function: $umode()
994
Usage: $umode(server_number)
995
Returns: returns the umode on that server or current server if no number given
996
997
Function: $bcopy()
998
Usage: $bcopy(num num)
999
Returns: 1 on error, 0 on success
1000
Note: Binary copy a file. Takes two numbers. Both have to be open
1001
file descriptors from $open()
1002
1003
Function: $cluster()
1004
Usage: $cluster(host)
1005
Returns: proper string for a ban
1006
Example: $cluster([email protected])
1007
1008
Function: $channelmode()
1009
Usage: $channelmode(#chan1 #chan2 #chan3)
1010
Retuens: channel modes of the specified channels on the current window
1011
1012
Function: $translate()
1013
Usage: $translate()
1014
Example: $translate(/ //text)
1015
Note: translates characters in a str
1016
See $tr() also.
1017
1018
Function: $server_version()
1019
Usage: $server_version(open_server_number)
1020
Returns: Server version, or "Unknown"
1021
1022
Function: $trunc()
1023
Usage: $trunc(num_of_digits number)
1024
Returns: number truncated to num_of_digits
1025
Example: /do echo $trunc(5 7819263864) returns 7819263864.00000
1026
1027
Function: $country()
1028
Usage: $country(CA) or $country(hostname)
1029
Returns: country of origin.
1030
Example: /eval echo $country(ca)
1031
/eval echo $country(ppp713.iameleet.kw)
1032
1033
Funtion: $line()
1034
Usage: $line(number)
1035
Returns: The line number in your scroll back buffer, line 1 being the
1036
last line said in the window.
1037
Example: /eval echo $line(4)
1038
1039
Function: $longcomma()
1040
Usage: $longcomma(number)
1041
Returns: The number given formatted with commas.
1042
Example: /eval echo $longcomma(10000) returns 10,000.
1043
1044
Function: $dccitem([number] [#number])
1045
Usage: For dccitem: $dccitem(dcc_item_number)
1046
For socketnum: $dccitem(#dcc_socket_number)
1047
Returns: Information based on the passed dcc number or socket number.
1048
$0 type
1049
$1 nick
1050
$2 status
1051
$3 start time
1052
$4 start posistion (for resume/reget resend)
1053
$5 bytes received
1054
$6 bytes sent
1055
$7 filesize
1056
$8 filename
1057
$9 socket number of this connection
1058
$10 server
1059
Example: /eval echo $dccitem(4) returns info on open dcc #4.
1060
/eval echo $dccitem(#7) returns into on open dcc socket #7.
1061
1062
Function: $winitem(num)
1063
Usage: $winitem(num) for info on window 'num'.
1064
$0 refnum
1065
$1 name or <none>
1066
$2 server num
1067
$3 current chan or <none>
1068
$4 query nick or <none>
1069
$5 waiting channel or <none>
1070
$6 <none> openirc has menu name
1071
$7 1=visible 0=non-visible
1072
$8 num of columns
1073
$9 num of rows
1074
$10 reserved
1075
$11 reserved
1076
$12 reserved
1077
$13 reserved
1078
$14 reserved
1079
$15 logfile name or <none>
1080
$16 L=logging on - "" always a part of string
1081
$17 n=nicklist
1082
$18 reserved
1083
$19 reserved
1084
$20+ window level
1085
Example: /eval echo $winitem(1) returns:
1086
1 <none> 0 #BitchX <none> <none> <none> 1 79 25 <none> <none>
1087
<none> <none> <none> <none> "" "" <none> <none> NONE
1088
1089
Function: $chanmode(#chan num)
1090
Usage: $chanmode(#chan num) - 'num' can be one of 0=normal, 1=bans,
1091
2=ban whoset time, 3=exemptions for TS4.
1092
Example: /do echo $chanmode(#BitchX 1) returns "*!*@*.aol.com"
1093
/do echo $chanmode(#BitchX 2) returns "*!*@*.aol.com power 7812"
1094
1095
Function: $channicks(#chan sort_type)
1096
Usage: $channicks(#chan sort_type) - 'sort_type' can me one of:
1097
0=normal, 1=none, 2=nick, 3=host, 4=time, 5=ip (if available)
1098
Example: /eval echo $channicks(#BitchX) returns nicks on #BitchX
1099
/eval echo $channicks(#BitchX 3) returns nick on #BitchX
1100
sorted by host.
1101
1102
Function: $topic(#channel)
1103
Usage: $topic() or $topic(#channel)
1104
Example: /eval echo $topic() returns topic on current channel.
1105
/eval echo $topic(#BitchX) returns topic on #BitchX.
1106
1107
1108