Scripting » History » Version 166
Per Amundsen, 05/19/2013 12:02 AM
1 | 166 | Per Amundsen | h1. Scripting changes as of 1.9.0 |
---|---|---|---|
2 | 39 | Per Amundsen | |
3 | 166 | Per Amundsen | h1. Implemented mIRC events so far: |
4 | 1 | Per Amundsen | |
5 | 166 | Per Amundsen | <pre> |
6 | raw <numeric>:<matchtext>:<commands> |
||
7 | 1 | Per Amundsen | |
8 | 166 | Per Amundsen | ctcp <level>:<matchtext>:<*|#|?>:<commands> |
9 | 38 | Per Amundsen | |
10 | 166 | Per Amundsen | on 1:sockopen:name:commands |
11 | 1 | Per Amundsen | |
12 | 166 | Per Amundsen | on 1:sockread:name:commands |
13 | 1 | Per Amundsen | |
14 | 166 | Per Amundsen | on 1:socklisten:name:commands |
15 | 1 | Per Amundsen | |
16 | 166 | Per Amundsen | on 1:sockclose:name:commands |
17 | 149 | Per Amundsen | |
18 | 166 | Per Amundsen | on *:SIGNAL:name:command |
19 | 1 | Per Amundsen | |
20 | 166 | Per Amundsen | on <level>:DNS:<commands> |
21 | 149 | Per Amundsen | |
22 | 166 | Per Amundsen | on <level>:CTCPREPLY:<matchtext>:<commands> |
23 | 1 | Per Amundsen | |
24 | 166 | Per Amundsen | on <level>:OPEN|CLOSE:<?|@|=|!|*>:<matchtext>:<commands> |
25 | 149 | Per Amundsen | |
26 | 166 | Per Amundsen | on <level>:ACTIVE:<*#?=!@>:<commands> |
27 | 1 | Per Amundsen | |
28 | 166 | Per Amundsen | on <level>:HOTLINK:<matchtext>:<*#?=!@>:<commands> |
29 | 1 | Per Amundsen | |
30 | 166 | Per Amundsen | on <level>:INVITE:<#[,#]>:<commands> |
31 | 1 | Per Amundsen | |
32 | 166 | Per Amundsen | on <level>:TABCOMP:<*#?=!@>:<commands> |
33 | 1 | Per Amundsen | |
34 | 166 | Per Amundsen | on <level>:WALLOPS:<matchtext>:<commands> |
35 | 1 | Per Amundsen | |
36 | 166 | Per Amundsen | on <level>:ERROR:<matchtext>:<commands> |
37 | 1 | Per Amundsen | |
38 | 166 | Per Amundsen | on <level>:RAWMODE:#:<commands> |
39 | 1 | Per Amundsen | |
40 | 166 | Per Amundsen | on <level>:DEHELP:<#[,#]>:<commands> |
41 | 1 | Per Amundsen | |
42 | 166 | Per Amundsen | on <level>:HELP:<#[,#]>:<commands> |
43 | 1 | Per Amundsen | |
44 | 166 | Per Amundsen | on <level>:DEVOICE:<#[,#]>:<commands> |
45 | 1 | Per Amundsen | |
46 | 166 | Per Amundsen | on <level>:VOICE:<#[,#]>:<commands> |
47 | 1 | Per Amundsen | |
48 | 166 | Per Amundsen | on <level>:DEOP:<#[,#]>:<commands> |
49 | 1 | Per Amundsen | |
50 | 166 | Per Amundsen | on <level>:OP:<#[,#]>:<commands> |
51 | 1 | Per Amundsen | |
52 | 166 | Per Amundsen | on <level>:INPUT:<*#?=!@>:<commands> |
53 | 1 | Per Amundsen | |
54 | 166 | Per Amundsen | on <level>:UNBAN:<#[,#]>:<commands> |
55 | 1 | Per Amundsen | |
56 | 166 | Per Amundsen | on <level>:BAN:<#[,#]>:<commands> |
57 | 149 | Per Amundsen | |
58 | 166 | Per Amundsen | on <level>:CHAT:<matchtext>:<commands> |
59 | 1 | Per Amundsen | |
60 | 166 | Per Amundsen | on <level>:KICK:<#[,#]>:<commands> |
61 | 1 | Per Amundsen | |
62 | 166 | Per Amundsen | on <level>:NOTIFY:<commands> |
63 | 1 | Per Amundsen | |
64 | 166 | Per Amundsen | on <level>:UNNOTIFY:<commands> |
65 | 1 | Per Amundsen | |
66 | 166 | Per Amundsen | on <level>:NICK:<commands> |
67 | 1 | Per Amundsen | |
68 | 166 | Per Amundsen | on <level>:QUIT:<commands> |
69 | 1 | Per Amundsen | |
70 | 166 | Per Amundsen | on <level>:LOAD:<commands> |
71 | 1 | Per Amundsen | |
72 | 166 | Per Amundsen | on <level>:UNLOAD:<commands>' |
73 | 1 | Per Amundsen | |
74 | 166 | Per Amundsen | on <level>:START:<commands> |
75 | 1 | Per Amundsen | |
76 | 166 | Per Amundsen | on <level>:EXIT:<commands> |
77 | 1 | Per Amundsen | |
78 | 166 | Per Amundsen | on <level>:DNS:<commands> |
79 | 1 | Per Amundsen | |
80 | 166 | Per Amundsen | on <level>:CONNECTFAIL:<commands> |
81 | 1 | Per Amundsen | |
82 | 166 | Per Amundsen | on <level>:CONNECT:<commands> |
83 | 1 | Per Amundsen | |
84 | 166 | Per Amundsen | on <level>:DISCONNECT:<commands> |
85 | 1 | Per Amundsen | |
86 | 166 | Per Amundsen | on <level>:TOPIC:<#[,#]>:<commands> |
87 | 1 | Per Amundsen | |
88 | 166 | Per Amundsen | on <level>:USERMODE:<commands> |
89 | 1 | Per Amundsen | |
90 | 166 | Per Amundsen | on <level>:MODE:<#[,#]>:<commands> |
91 | 1 | Per Amundsen | |
92 | 166 | Per Amundsen | on <level>:PART:<#[,#]>:<commands> |
93 | 1 | Per Amundsen | |
94 | 166 | Per Amundsen | on <level>:JOIN:<#[,#]>:<commands> |
95 | 1 | Per Amundsen | |
96 | 166 | Per Amundsen | on <level>:SNOTICE:<matchtext>:<commands> |
97 | 1 | Per Amundsen | |
98 | 166 | Per Amundsen | on <level>:NOTICE:<matchtext>:<*><?><#[,#]>:<commands> |
99 | 1 | Per Amundsen | |
100 | 166 | Per Amundsen | on <level>:ACTION:<matchtext>:<*><?><#[,#]>:<commands> |
101 | 1 | Per Amundsen | |
102 | 166 | Per Amundsen | on <level>:TEXT:<matchtext>:<*><?><#[,#]>:<commands> |
103 | 1 | Per Amundsen | |
104 | 166 | Per Amundsen | This event is added as a replacement for OnSongChanged |
105 | on <level>:SONG:<commands> |
||
106 | |||
107 | 1 | Per Amundsen | </pre> |
108 | |||
109 | 166 | Per Amundsen | Supported prefixes so far are ^ to enable halt events (hide default text output from the event), ! to ignore events made by you, @ to only trigger if you have channel op, $ to indicate the wildcard text is a regular expression. |
110 | 1 | Per Amundsen | |
111 | 166 | Per Amundsen | User access will come later. |
112 | 1 | Per Amundsen | |
113 | 166 | Per Amundsen | h1. Functions added so far |
114 | |||
115 | 1 | Per Amundsen | <pre> |
116 | 166 | Per Amundsen | $abs() |
117 | $acos() |
||
118 | $address() |
||
119 | $addtok() |
||
120 | $addtokcs() |
||
121 | $and() |
||
122 | $asc() |
||
123 | $asctime() |
||
124 | $asin() |
||
125 | $atan() |
||
126 | $audio() |
||
127 | $base() |
||
128 | $bfind() |
||
129 | $bindip() |
||
130 | $bitoff() |
||
131 | $biton() |
||
132 | $bvar() |
||
133 | $bytes() |
||
134 | $calc() |
||
135 | $cb() |
||
136 | $ceil() |
||
137 | $chan() |
||
138 | $char() |
||
139 | $chat() |
||
140 | $chr() |
||
141 | $color() |
||
142 | $colour() |
||
143 | $comchan() |
||
144 | $cos() |
||
145 | $count() |
||
146 | $countcs() |
||
147 | $crc() |
||
148 | $ctime() |
||
149 | $datediff() |
||
150 | $datematch() |
||
151 | $decode() |
||
152 | $decrypt() |
||
153 | $deltok() |
||
154 | $dialog() |
||
155 | $did() |
||
156 | $didreg() |
||
157 | $didtok() |
||
158 | $didwm() |
||
159 | $disk() |
||
160 | $diskmenu() |
||
161 | $dns() |
||
162 | $duration() |
||
163 | $editbox() |
||
164 | $encode() |
||
165 | $encodingmenu() |
||
166 | $encrypt() |
||
167 | $eval() |
||
168 | $exists() |
||
169 | $fdate() |
||
170 | $fgetc() |
||
171 | $file() |
||
172 | $fileexists() |
||
173 | $fileloop() |
||
174 | $filerandom() |
||
175 | $finddir() |
||
176 | $findfile() |
||
177 | $findtok() |
||
178 | $findtokcs() |
||
179 | $fline() |
||
180 | $floop() |
||
181 | $floor() |
||
182 | $fopen() |
||
183 | $formatdate() |
||
184 | $frand() |
||
185 | $fread() |
||
186 | $freadc() |
||
187 | $freadchar() |
||
188 | $getdir() |
||
189 | $getdot() |
||
190 | $gettok() |
||
191 | $gfx() |
||
192 | $gfxram() |
||
193 | $group() |
||
194 | $height() |
||
195 | $hfind() |
||
196 | $hget() |
||
197 | $host() |
||
198 | $ial() |
||
199 | $ialchan() |
||
200 | $ibl() |
||
201 | $ident() |
||
202 | $iel() |
||
203 | $ignore() |
||
204 | $iil() |
||
205 | $inellipse() |
||
206 | $ini() |
||
207 | $inpoly() |
||
208 | $input() |
||
209 | $inrect() |
||
210 | $insert() |
||
211 | $instok() |
||
212 | $int() |
||
213 | $invitemenu() |
||
214 | $isalias() |
||
215 | $isbit() |
||
216 | $isdir() |
||
217 | $isfile() |
||
218 | $isid() |
||
219 | $islower() |
||
220 | $istok() |
||
221 | $istokcs() |
||
222 | $istype() |
||
223 | $isupper() |
||
224 | $left() |
||
225 | $len() |
||
226 | $line() |
||
227 | $lines() |
||
228 | $log() |
||
229 | $longfn() |
||
230 | $longip() |
||
231 | $lower() |
||
232 | $mask() |
||
233 | $matchtok() |
||
234 | $matchtokcs() |
||
235 | $md5() |
||
236 | $mid() |
||
237 | $mkfn() |
||
238 | $mklogfn() |
||
239 | $mknickfn() |
||
240 | $mp3() |
||
241 | $msfile() |
||
242 | $nick() |
||
243 | $nofile() |
||
244 | $nopath() |
||
245 | $noqt() |
||
246 | $not() |
||
247 | $notify() |
||
248 | $numtok() |
||
249 | $or() |
||
250 | $ord() |
||
251 | $pic() |
||
252 | $portfree() |
||
253 | $pos() |
||
254 | $poscs() |
||
255 | $prop() |
||
256 | $puttok() |
||
257 | $qt() |
||
258 | $query() |
||
259 | $r() |
||
260 | $rand() |
||
261 | $read() |
||
262 | $readini() |
||
263 | $regex() |
||
264 | $regmatch() |
||
265 | $regml() |
||
266 | $regreplace() |
||
267 | $regsub() |
||
268 | $regsubex() |
||
269 | $remove() |
||
270 | $removecs() |
||
271 | $remtok() |
||
272 | $remtokcs() |
||
273 | $repeat() |
||
274 | $replace() |
||
275 | $replacecs() |
||
276 | $replacex() |
||
277 | $replacexcs() |
||
278 | $reptok() |
||
279 | $reptokcs() |
||
280 | $rgb() |
||
281 | $right() |
||
282 | $round() |
||
283 | $scid() |
||
284 | $scon() |
||
285 | $screen() |
||
286 | $screenb() |
||
287 | $screenh() |
||
288 | $screenw() |
||
289 | $script() |
||
290 | $sdir() |
||
291 | $server() |
||
292 | $sfile() |
||
293 | $sha1() |
||
294 | $shortfn() |
||
295 | $sin() |
||
296 | $slapsmenu() |
||
297 | $sline() |
||
298 | $snick() |
||
299 | $sock() |
||
300 | $sorttok() |
||
301 | $sorttokcs() |
||
302 | $sqrt() |
||
303 | $str() |
||
304 | $strip() |
||
305 | $style() |
||
306 | $substr() |
||
307 | $tan() |
||
308 | $time() |
||
309 | $timer() |
||
310 | $tip() |
||
311 | $toolbar() |
||
312 | $true() |
||
313 | $trust() |
||
314 | $upper() |
||
315 | $uptime() |
||
316 | $user() |
||
317 | $utfdecode() |
||
318 | $utfencode() |
||
319 | $var() |
||
320 | $vol() |
||
321 | $width() |
||
322 | $wildtok() |
||
323 | $wildtokcs() |
||
324 | $window() |
||
325 | $xor() |
||
326 | 1 | Per Amundsen | </pre> |
327 | |||
328 | 166 | Per Amundsen | h1. Variables added so far |
329 | 1 | Per Amundsen | |
330 | 166 | Per Amundsen | <pre> |
331 | $0 |
||
332 | $active |
||
333 | $activeserver |
||
334 | $activewid |
||
335 | $adate |
||
336 | $address |
||
337 | $adiircdir |
||
338 | $adiircexe |
||
339 | $adiircini |
||
340 | $album |
||
341 | $anick |
||
342 | $appactive |
||
343 | $appstate |
||
344 | $artist |
||
345 | $audio |
||
346 | $away |
||
347 | $awaymsg |
||
348 | $awaytime |
||
349 | $bitrate |
||
350 | $bwdown |
||
351 | $bwdownb |
||
352 | $bwname |
||
353 | $bwspeed |
||
354 | $bwup |
||
355 | $bwupb |
||
356 | $cb |
||
357 | $chan |
||
358 | $chanmodes |
||
359 | $channel |
||
360 | $chantypes |
||
361 | $cid |
||
362 | $clevel |
||
363 | $cmdline |
||
364 | $comment |
||
365 | $cpucache |
||
366 | $cpucount |
||
367 | $cpuident |
||
368 | $cpuload |
||
369 | $cpumhz |
||
370 | $cpuname |
||
371 | $cr |
||
372 | $crlf |
||
373 | $ctime |
||
374 | $date |
||
375 | $day |
||
376 | $daylight |
||
377 | $disk |
||
378 | $diskfree |
||
379 | $disktotal |
||
380 | $dlevel |
||
381 | $duration |
||
382 | $error |
||
383 | $event |
||
384 | $false |
||
385 | $feof |
||
386 | $ferr |
||
387 | $frequency |
||
388 | $fulladdress |
||
389 | $fulldate |
||
390 | $fulltitle |
||
391 | $genre |
||
392 | $getdir |
||
393 | $gfx |
||
394 | $gfxram |
||
395 | $gmt |
||
396 | $highlight |
||
397 | $host |
||
398 | $ial |
||
399 | $ident |
||
400 | $idle |
||
401 | $ignore |
||
402 | $inmidi |
||
403 | $inpaste |
||
404 | $insong |
||
405 | $inwave |
||
406 | $ip |
||
407 | $isid |
||
408 | $layer |
||
409 | $left |
||
410 | $length |
||
411 | $logdir |
||
412 | $logstamp |
||
413 | $logstampfmt |
||
414 | $lr |
||
415 | $ltimer |
||
416 | $maddress |
||
417 | $matchkey |
||
418 | $me |
||
419 | $memfree |
||
420 | $memfreep |
||
421 | $memtotal |
||
422 | $mircdir |
||
423 | $mircexec |
||
424 | $mircini |
||
425 | $mnick |
||
426 | $mode |
||
427 | $modespl |
||
428 | $motherboard |
||
429 | $mversion |
||
430 | $myhost |
||
431 | $myident |
||
432 | $network |
||
433 | $newnick |
||
434 | $nick |
||
435 | $now |
||
436 | $null |
||
437 | $numeric |
||
438 | $online |
||
439 | $os |
||
440 | $osbuild |
||
441 | $osedition |
||
442 | $osmajor |
||
443 | $osminor |
||
444 | $osname |
||
445 | $osservicepack |
||
446 | $osversion |
||
447 | $percentl |
||
448 | $percentp |
||
449 | $playcount |
||
450 | $player |
||
451 | $port |
||
452 | $position |
||
453 | $prefix |
||
454 | $progress |
||
455 | $r |
||
456 | $r0 |
||
457 | $raw0 |
||
458 | $rawbytes |
||
459 | $rawmsg |
||
460 | $result |
||
461 | $screen |
||
462 | $screenb |
||
463 | $screenh |
||
464 | $screenw |
||
465 | $script |
||
466 | $scriptdir |
||
467 | $scriptline |
||
468 | $server |
||
469 | $serverip |
||
470 | $show |
||
471 | $site |
||
472 | $size |
||
473 | $sockbr |
||
474 | $song |
||
475 | $status |
||
476 | $target |
||
477 | $ticks |
||
478 | $time |
||
479 | $timestamp |
||
480 | $timestampfmt |
||
481 | $timezone |
||
482 | $title |
||
483 | $totaltracks |
||
484 | $track |
||
485 | $true |
||
486 | $ulevel |
||
487 | $updays |
||
488 | $uphours |
||
489 | $upmins |
||
490 | $usermode |
||
491 | $version |
||
492 | $volume |
||
493 | $volumeb |
||
494 | $volumep |
||
495 | $wid |
||
496 | $wildsite |
||
497 | $window |
||
498 | $year |
||
499 | </pre> |
||
500 | 149 | Per Amundsen | |
501 | 166 | Per Amundsen | Commands added so far |
502 | |||
503 | <pre> |
||
504 | /aclear |
||
505 | /action |
||
506 | /advertise |
||
507 | /ajinvite |
||
508 | /alias |
||
509 | /aline |
||
510 | /alphaup |
||
511 | /amark |
||
512 | /ame |
||
513 | /amsg |
||
514 | /anick |
||
515 | /aquit |
||
516 | /away |
||
517 | /back |
||
518 | /background |
||
519 | /ban |
||
520 | /banlist |
||
521 | /bcopy |
||
522 | /beep |
||
523 | /betaup |
||
524 | /bin2txt |
||
525 | /bindip |
||
526 | /bread |
||
527 | /break |
||
528 | /breplace |
||
529 | /bset |
||
530 | /btrunc |
||
531 | /bunset |
||
532 | /bwrite |
||
533 | /channel |
||
534 | /channelbar |
||
535 | /charset |
||
536 | /clear |
||
537 | /clearall |
||
538 | /clipboard |
||
539 | /close |
||
540 | /closefile |
||
541 | /color |
||
542 | /config |
||
543 | /continue |
||
544 | /ctcp |
||
545 | /ctcpreply |
||
546 | /cycle |
||
547 | /dcc |
||
548 | /debug |
||
549 | /dec |
||
550 | /dehalfop |
||
551 | /deop |
||
552 | /describe |
||
553 | /desop |
||
554 | /devoice |
||
555 | /dialog |
||
556 | /did |
||
557 | /didtok |
||
558 | /disable |
||
559 | /disconnect |
||
560 | /dns |
||
561 | /dop |
||
562 | /drawcopy |
||
563 | /drawdot |
||
564 | /drawfill |
||
565 | /drawline |
||
566 | /drawpic |
||
567 | /drawrect |
||
568 | /drawreplace |
||
569 | /drawsave |
||
570 | /drawscroll |
||
571 | /drawtext |
||
572 | /echo |
||
573 | /editbox |
||
574 | /enable |
||
575 | /encoding |
||
576 | /exec |
||
577 | /exit |
||
578 | /fakeraw |
||
579 | /fclose |
||
580 | /filter |
||
581 | /flist |
||
582 | /fopen |
||
583 | /fseek |
||
584 | /fwrite |
||
585 | /gcmem |
||
586 | |||
587 | |||
588 | /goto |
||
589 | /hadd |
||
590 | /halfop |
||
591 | /halt |
||
592 | /haltdef |
||
593 | /hdec |
||
594 | /hdel |
||
595 | /help |
||
596 | /hfree |
||
597 | /hinc |
||
598 | /hload |
||
599 | /hmake |
||
600 | /hop |
||
601 | /hsave |
||
602 | /ignore |
||
603 | /inc |
||
604 | /join |
||
605 | /kick |
||
606 | /kickban |
||
607 | /kill |
||
608 | /lag |
||
609 | /linesep |
||
610 | /list |
||
611 | /load |
||
612 | /logs |
||
613 | /logview |
||
614 | /loopfile |
||
615 | /markall |
||
616 | /me |
||
617 | /menubar |
||
618 | /mkdir |
||
619 | /mode |
||
620 | /msg |
||
621 | /msgbox |
||
622 | /nick |
||
623 | /nickcolor |
||
624 | /nmsg |
||
625 | /nomsg |
||
626 | /noop |
||
627 | /noquery |
||
628 | /notice |
||
629 | /notify |
||
630 | /np |
||
631 | /onotice |
||
632 | /op |
||
633 | /openfile |
||
634 | /part |
||
635 | /paths |
||
636 | /pgoogle |
||
637 | /pgoogle |
||
638 | /priv |
||
639 | /query |
||
640 | /quit |
||
641 | /quote |
||
642 | /raw |
||
643 | /rawlog |
||
644 | /reconnect |
||
645 | /rejoin |
||
646 | /reload |
||
647 | /remini |
||
648 | /remove |
||
649 | /rename |
||
650 | /reseterror |
||
651 | /resolve |
||
652 | /restart |
||
653 | /return |
||
654 | /rmdir |
||
655 | /run |
||
656 | /runloop |
||
657 | /say |
||
658 | /scid |
||
659 | /sclose |
||
660 | /scon |
||
661 | /search |
||
662 | /seekfile |
||
663 | /server |
||
664 | /serverlist |
||
665 | /set |
||
666 | /setoption |
||
667 | /sidebar |
||
668 | /signal |
||
669 | /slap |
||
670 | /sleep |
||
671 | /smsg |
||
672 | /sockaccept |
||
673 | /sockclose |
||
674 | /socklist |
||
675 | /socklisten |
||
676 | /sockmark |
||
677 | /sockopen |
||
678 | /sockpause |
||
679 | /sockread |
||
680 | /sockrename |
||
681 | /sockwrite |
||
682 | /sop |
||
683 | /sopen |
||
684 | /splay |
||
685 | /split |
||
686 | /statusbar |
||
687 | /swrite |
||
688 | /tab |
||
689 | /tester |
||
690 | /time |
||
691 | /timer |
||
692 | /titlebar |
||
693 | /tokenize |
||
694 | /toolbar |
||
695 | /topic |
||
696 | /txt2bin |
||
697 | /unban |
||
698 | /unignore |
||
699 | /unload |
||
700 | /unnotify |
||
701 | /unset |
||
702 | /update |
||
703 | /var |
||
704 | /vars |
||
705 | /viewlog |
||
706 | /voice |
||
707 | /vol |
||
708 | /wdown |
||
709 | /window |
||
710 | /wjump |
||
711 | /wnext |
||
712 | /wpause |
||
713 | /wplay |
||
714 | /wprev |
||
715 | /write |
||
716 | /writefile |
||
717 | /writeini |
||
718 | /wsearch |
||
719 | /wseekf |
||
720 | /wseekr |
||
721 | /wselect |
||
722 | /wstop |
||
723 | /wup |
||
724 | </pre> |
||
725 | |||
726 | Not all are from mIRC, ill seperate the list later. |
||
727 | |||
728 | All operaters are added. |
||
729 | |||
730 | 154 | Per Amundsen | h1. Example scripts |
731 | |||
732 | Simple kickcounter script: |
||
733 | |||
734 | <pre> |
||
735 | 166 | Per Amundsen | alias kick { |
736 | if (!%kickcount) %kickcount = 0 |
||
737 | 154 | Per Amundsen | |
738 | 166 | Per Amundsen | inc %kickcount |
739 | 154 | Per Amundsen | |
740 | 166 | Per Amundsen | if (!$3) { |
741 | kick # $$2 Kick number %kickcount |
||
742 | 154 | Per Amundsen | halt |
743 | } |
||
744 | } |
||
745 | </pre> |
||
746 | |||
747 | Kickban example |
||
748 | <pre> |
||
749 | 166 | Per Amundsen | alias kb { |
750 | 154 | Per Amundsen | if (!$1) { |
751 | 166 | Per Amundsen | echo /kb - Nick missing |
752 | 154 | Per Amundsen | return |
753 | } |
||
754 | |||
755 | 166 | Per Amundsen | var %msg = $iif(#, $2-, $3-) |
756 | var %chan = $iif(#, #, $2) |
||
757 | 154 | Per Amundsen | |
758 | 166 | Per Amundsen | ; Set this for default ban reason, or remove for no default reason |
759 | ; Can be shortened to %msg = $iif(%msg, %msg, GTFO) |
||
760 | if (!%msg) %msg = GTFO |
||
761 | 154 | Per Amundsen | |
762 | if ($me isop %chan) { |
||
763 | 166 | Per Amundsen | MODE %chan +b $wildsite |
764 | KICK %chan $1 %msg |
||
765 | 154 | Per Amundsen | } |
766 | 166 | Per Amundsen | else echo You are not oper on %chan |
767 | 154 | Per Amundsen | } |
768 | </pre> |
||
769 | |||
770 | Simple calculator script: |
||
771 | <pre> |
||
772 | 166 | Per Amundsen | alias calc { |
773 | 154 | Per Amundsen | if (!$1) { |
774 | 166 | Per Amundsen | echo /calc - Parameters missing |
775 | 154 | Per Amundsen | return |
776 | } |
||
777 | |||
778 | 166 | Per Amundsen | ; typing /calc -p <expression> sends output to channel |
779 | 154 | Per Amundsen | if ($1 == -p) { |
780 | 166 | Per Amundsen | msg # Calculating : $2- |
781 | msg # Result is : $calc($2-) |
||
782 | 154 | Per Amundsen | } else { |
783 | 166 | Per Amundsen | echo Calculating : $1- |
784 | echo Result is : $calc($1-) |
||
785 | 154 | Per Amundsen | } |
786 | } |
||
787 | </pre> |
||
788 | |||
789 | Colored version |
||
790 | <pre> |
||
791 | 166 | Per Amundsen | alias calc { |
792 | 154 | Per Amundsen | if (!$1) { |
793 | 166 | Per Amundsen | echo /calc - Parameters missing |
794 | 154 | Per Amundsen | return |
795 | } |
||
796 | 156 | Per Amundsen | |
797 | # typing /calc -p <expression> sends output to channel |
||
798 | 154 | Per Amundsen | if ($1 == -p) { |
799 | 166 | Per Amundsen | msg # $chr(3)4Calculating : $2- |
800 | msg # $chr(3)4Result is : $calc($2-) |
||
801 | 154 | Per Amundsen | } else { |
802 | 166 | Per Amundsen | echo $chr(3)4Calculating : 4$1- |
803 | echo $chr(3)4Result is : $calc($1-) |
||
804 | 154 | Per Amundsen | } |
805 | 166 | Per Amundsen | } |
806 | 154 | Per Amundsen | </pre> |
807 | |||
808 | CTCP flood detection example |
||
809 | |||
810 | <pre> |
||
811 | 166 | Per Amundsen | CTCP *:*:*:{ |
812 | if (!%count) set -u10 %count 1 |
||
813 | else inc -u10 %count 1 |
||
814 | 154 | Per Amundsen | |
815 | 166 | Per Amundsen | if (%count > 4) ignore -tu30 $wildsite |
816 | 154 | Per Amundsen | } |
817 | </pre> |
||
818 | |||
819 | Mass mode example |
||
820 | |||
821 | <pre> |
||
822 | 166 | Per Amundsen | alias mass { |
823 | 154 | Per Amundsen | if (!$2) { |
824 | 166 | Per Amundsen | echo /mass - Parameters missing [+/-<mode> <nick> <nick> <nick>] |
825 | 154 | Per Amundsen | return |
826 | } |
||
827 | |||
828 | %len = 2 |
||
829 | |||
830 | 166 | Per Amundsen | ; equal to while (%len <= $count(%1-, $chr(32))) |
831 | while (%len <= $0) { |
||
832 | if ($(%len) ison #) mode # $1 $($ $+ %len) |
||
833 | inc %len |
||
834 | 154 | Per Amundsen | } |
835 | } |
||
836 | </pre> |
||
837 | |||
838 | Shows info about servers, channels and users |
||
839 | <pre> |
||
840 | 166 | Per Amundsen | on *:JOIN:#: { |
841 | 154 | Per Amundsen | var %s = $server(0), %c = 0, %u = 0, %t = 0, %c2 = 0; |
842 | |||
843 | while (%t < %s) { |
||
844 | 166 | Per Amundsen | inc %t |
845 | setserver $server(%t); |
||
846 | 154 | Per Amundsen | %c += $chan(0) |
847 | |||
848 | %c2 = 0 |
||
849 | while (%c2 < $chan(0)) { |
||
850 | 166 | Per Amundsen | in %c2 |
851 | 154 | Per Amundsen | %u += $user($chan(%c2), 0) |
852 | } |
||
853 | } |
||
854 | |||
855 | 166 | Per Amundsen | /echo You are on ( $+ %s $+ ) servers, ( $+ %c $+ ) channels with ( $+ %u $+ ) users |
856 | 154 | Per Amundsen | } |
857 | </pre> |
||
858 | |||
859 | It is possible to use scripts as functions. |
||
860 | These functions are fully nested like the client functions. |
||
861 | |||
862 | Lets say you make a /mycalc like this. |
||
863 | <pre> |
||
864 | 166 | Per Amundsen | alias mycalc { |
865 | return $calc($$1 + $$2); |
||
866 | 154 | Per Amundsen | } |
867 | </pre> |
||
868 | |||
869 | Then you can call this function with eiter /mycalc <number> <number> the normal way or $mycalc(<number, <number>) |
||
870 | Typing /testcalc will show the result. |
||
871 | <pre> |
||
872 | 166 | Per Amundsen | alias testcalc { |
873 | echo -a $1 + $2 is $mycalc($1, $2); |
||
874 | echo -a 5 + 4 is $mycalc(5, 4); |
||
875 | 154 | Per Amundsen | } |
876 | </pre> |
||
877 | |||
878 | Simple convert temperature C to F or F to C |
||
879 | /temp C 20 will print 68 F |
||
880 | |||
881 | <pre> |
||
882 | 166 | Per Amundsen | alias temp { |
883 | if ($1 == C) echo $calc(($2 * 9/5) + 32) F |
||
884 | else if ($1 == F) echo $round($calc(($2 - 32) * 5/9), 1) C |
||
885 | else echo Temp missing |
||
886 | 154 | Per Amundsen | } |
887 | </pre> |
||
888 | |||
889 | 166 | Per Amundsen | Announce song changes in a channel or to a user |
890 | 154 | Per Amundsen | <pre> |
891 | 166 | Per Amundsen | On *:SONG:{ |
892 | nmsg <network> <channel/Nick> $1- |
||
893 | 154 | Per Amundsen | } |
894 | 158 | Per Amundsen | </pre> |
895 | |||
896 | 166 | Per Amundsen | Announce to several channels with: |
897 | 158 | Per Amundsen | <pre> |
898 | 166 | Per Amundsen | On *:SONG:{ |
899 | nmsg <network> <channel1/Nick>,<channel2/Nick> $1- |
||
900 | nmsg <network2> <channel3/Nick> $1- |
||
901 | 158 | Per Amundsen | } |
902 | 166 | Per Amundsen | </pre> |
903 | 158 | Per Amundsen | |
904 | 166 | Per Amundsen | Automatically find the summary of a imdb url |
905 | <pre> |
||
906 | On *:TEXT:*:#k: { |
||
907 | var %reg = $regex($1-, http://www\.imdb\.com(/title/[a-z0-9]+/)) |
||
908 | if (!%reg) { return } |
||
909 | sockclose imdb |
||
910 | unset %data |
||
911 | %imdb = $regml(1) $+ plotsummary |
||
912 | %imdbchan = # |
||
913 | sockopen imdb www.imdb.com 80 |
||
914 | 1 | Per Amundsen | } |
915 | |||
916 | 166 | Per Amundsen | on *:sockopen:imdb: { |
917 | sockwrite -n imdb GET %imdb HTTP/1.1 |
||
918 | sockwrite -n imdb Host: www.imdb.com |
||
919 | sockwrite -n imdb User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.24 Safari/536.5 |
||
920 | sockwrite -n imdb Referer: http://www.imdb.com |
||
921 | sockwrite -n imdb Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1 |
||
922 | sockwrite -n imdb Accept-Language: en-us, en;q=0.50 |
||
923 | sockwrite -n imdb Connection: Close $+ $crlf $+ $crlf |
||
924 | 1 | Per Amundsen | } |
925 | |||
926 | 166 | Per Amundsen | on *:sockread:imdb:{ |
927 | sockread %text |
||
928 | %data = %data $+ %text |
||
929 | 1 | Per Amundsen | } |
930 | |||
931 | 166 | Per Amundsen | on *:sockclose:imdb: { |
932 | if ($regex(%data, <p class="plotpar">([\s\S]*?)<i>)) { |
||
933 | msg %imdbchan $regml(1) |
||
934 | } |
||
935 | 1 | Per Amundsen | |
936 | 166 | Per Amundsen | unset %data |
937 | 1 | Per Amundsen | } |
938 | </pre> |