Scripting » History » Version 181
Per Amundsen, 02/07/2014 10:41 AM
1 | 167 | Per Amundsen | h1. Scripting changes as of 1.9.1 |
---|---|---|---|
2 | 39 | Per Amundsen | |
3 | 180 | Per Amundsen | [[Scripting Events|Implemented mIRC events so far]] |
4 | 1 | Per Amundsen | |
5 | 169 | Per Amundsen | h1. identifiers added so far |
6 | 166 | Per Amundsen | |
7 | <pre> |
||
8 | 1 | Per Amundsen | $0 |
9 | 179 | Per Amundsen | $active |
10 | $activecid |
||
11 | $activeserver |
||
12 | $activewid |
||
13 | $adate |
||
14 | $address |
||
15 | $adiircdir |
||
16 | $adiircexe |
||
17 | $adiircini |
||
18 | $album |
||
19 | $anick |
||
20 | $appactive |
||
21 | $appbits |
||
22 | $appstate |
||
23 | $artist |
||
24 | $asctime |
||
25 | $audio |
||
26 | $away |
||
27 | $awaymsg |
||
28 | $awaytime |
||
29 | $beta |
||
30 | $bitrate |
||
31 | $bits |
||
32 | $builddate |
||
33 | $bwdown |
||
34 | $bwdownb |
||
35 | $bwname |
||
36 | $bwrec |
||
37 | $bwsent |
||
38 | $bwspeed |
||
39 | $bwup |
||
40 | $bwupb |
||
41 | $cb |
||
42 | $chan |
||
43 | $chanmodes |
||
44 | $channel |
||
45 | $channelbar |
||
46 | $chantypes |
||
47 | $cid |
||
48 | $clevel |
||
49 | $cmdline |
||
50 | $comerror |
||
51 | $comment |
||
52 | $cpucache |
||
53 | $cpucount |
||
54 | $cpuident |
||
55 | $cpuload |
||
56 | $cpumhz |
||
57 | $cpuname |
||
58 | $cpuvendor |
||
59 | $cr |
||
60 | $crlf |
||
61 | $ctime |
||
62 | $date |
||
63 | $day |
||
64 | $daylight |
||
65 | $dccport |
||
66 | $ddename |
||
67 | $disk |
||
68 | $diskfree |
||
69 | $disktotal |
||
70 | $dlevel |
||
71 | $docked |
||
72 | $dotnet |
||
73 | $duration |
||
74 | $error |
||
75 | $event |
||
76 | $false |
||
77 | $feof |
||
78 | $ferr |
||
79 | $frequency |
||
80 | $fulladdress |
||
81 | $fulldate |
||
82 | $fullscreen |
||
83 | $fulltitle |
||
84 | $genre |
||
85 | $getdir |
||
86 | $gfx |
||
87 | $gfxram |
||
88 | $gmt |
||
89 | $highlight |
||
90 | $host |
||
91 | $ial |
||
92 | $ident |
||
93 | $idle |
||
94 | $ifmatch |
||
95 | $ifmatch2 |
||
96 | $ignore |
||
97 | $inmidi |
||
98 | $inpaste |
||
99 | $insong |
||
100 | $inwave |
||
101 | $ip |
||
102 | $isid |
||
103 | $lactive |
||
104 | $lactivewid |
||
105 | $lag |
||
106 | $layer |
||
107 | $left |
||
108 | $length |
||
109 | $lf |
||
110 | $locked |
||
111 | $logdir |
||
112 | $logstamp |
||
113 | $logstampfmt |
||
114 | $ltimer |
||
115 | $maddress |
||
116 | $matchkey |
||
117 | $me |
||
118 | $memfree |
||
119 | $memfreep |
||
120 | $memtotal |
||
121 | $menubar |
||
122 | $mircdir |
||
123 | $mircexe |
||
124 | $mircini |
||
125 | $mnick |
||
126 | $mode |
||
127 | $modespl |
||
128 | $motherboard |
||
129 | $mouse |
||
130 | $mversion |
||
131 | $myhost |
||
132 | $myident |
||
133 | $network |
||
134 | $newnick |
||
135 | $nick |
||
136 | $nickmode |
||
137 | $now |
||
138 | $null |
||
139 | $numeric |
||
140 | $online |
||
141 | $os |
||
142 | $osbuild |
||
143 | $osedition |
||
144 | $osinstalldate |
||
145 | $osmajor |
||
146 | $osminor |
||
147 | $osname |
||
148 | $osservicepack |
||
149 | $osversion |
||
150 | $percentl |
||
151 | $percentp |
||
152 | $pi |
||
153 | $playcount |
||
154 | $player |
||
155 | $port |
||
156 | $portable |
||
157 | $position |
||
158 | $prefix |
||
159 | $progress |
||
160 | $quitmessage |
||
161 | $randomcolors |
||
162 | $rating |
||
163 | $rawbytes |
||
164 | $rawmsg |
||
165 | $realname |
||
166 | $remote |
||
167 | $result |
||
168 | $screen |
||
169 | $screenb |
||
170 | $screenh |
||
171 | $screenw |
||
172 | $script |
||
173 | $scriptdir |
||
174 | $scriptline |
||
175 | $server |
||
176 | $serverip |
||
177 | $show |
||
178 | $sidebar |
||
179 | $site |
||
180 | $size |
||
181 | $snicks |
||
182 | $sockbr |
||
183 | $sockerr |
||
184 | $sockname |
||
185 | $song |
||
186 | $ssl |
||
187 | $sslready |
||
188 | $status |
||
189 | $statusbar |
||
190 | $switchbar |
||
191 | $target |
||
192 | $ticks |
||
193 | $time |
||
194 | $timestamp |
||
195 | $timestampfmt |
||
196 | $timezone |
||
197 | $title |
||
198 | $toolbar |
||
199 | $totaltracks |
||
200 | $track |
||
201 | $treebar |
||
202 | $true |
||
203 | $ulevel |
||
204 | $updays |
||
205 | $uphours |
||
206 | $upmins |
||
207 | $usermode |
||
208 | $v1 |
||
209 | $v2 |
||
210 | $version |
||
211 | $volume |
||
212 | $volumeb |
||
213 | $volumep |
||
214 | $wid |
||
215 | $wildsite |
||
216 | $window |
||
217 | $year |
||
218 | $0 |
||
219 | 1 | Per Amundsen | $abs |
220 | 166 | Per Amundsen | $acos |
221 | $active |
||
222 | 179 | Per Amundsen | $activecid |
223 | 166 | Per Amundsen | $activeserver |
224 | 1 | Per Amundsen | $activewid |
225 | 169 | Per Amundsen | $adate |
226 | $address |
||
227 | 166 | Per Amundsen | $addtok |
228 | $addtokcs |
||
229 | $adiircdir |
||
230 | $adiircexe |
||
231 | 169 | Per Amundsen | $adiircini |
232 | 179 | Per Amundsen | $adilang |
233 | 1 | Per Amundsen | $album |
234 | 166 | Per Amundsen | $and |
235 | $anick |
||
236 | $appactive |
||
237 | 179 | Per Amundsen | $appbits |
238 | 169 | Per Amundsen | $appstate |
239 | $artist |
||
240 | $asc |
||
241 | $asctime |
||
242 | 166 | Per Amundsen | $asin |
243 | $atan |
||
244 | 1 | Per Amundsen | $audio |
245 | $away |
||
246 | 169 | Per Amundsen | $awaymsg |
247 | $awaytime |
||
248 | $base |
||
249 | 179 | Per Amundsen | $beta |
250 | 169 | Per Amundsen | $bfind |
251 | $bindip |
||
252 | $bitoff |
||
253 | 1 | Per Amundsen | $biton |
254 | $bitrate |
||
255 | 179 | Per Amundsen | $bits |
256 | $builddate |
||
257 | 1 | Per Amundsen | $bvar |
258 | $bwdown |
||
259 | $bwdownb |
||
260 | 169 | Per Amundsen | $bwname |
261 | 179 | Per Amundsen | $bwrec |
262 | $bwsent |
||
263 | 169 | Per Amundsen | $bwspeed |
264 | 1 | Per Amundsen | $bwup |
265 | 169 | Per Amundsen | $bwupb |
266 | 1 | Per Amundsen | $bytes |
267 | $calc |
||
268 | $cb |
||
269 | $ceil |
||
270 | 169 | Per Amundsen | $chan |
271 | $chanmodes |
||
272 | 1 | Per Amundsen | $channel |
273 | 179 | Per Amundsen | $channelbar |
274 | 1 | Per Amundsen | $chantypes |
275 | 166 | Per Amundsen | $chat |
276 | 169 | Per Amundsen | $chr |
277 | $cid |
||
278 | $clevel |
||
279 | 1 | Per Amundsen | $cmdline |
280 | 179 | Per Amundsen | $cnick |
281 | 169 | Per Amundsen | $color |
282 | $colour |
||
283 | 179 | Per Amundsen | $com |
284 | 169 | Per Amundsen | $comchan |
285 | 179 | Per Amundsen | $comerror |
286 | 166 | Per Amundsen | $comment |
287 | $cos |
||
288 | $count |
||
289 | $countcs |
||
290 | $cpucache |
||
291 | 1 | Per Amundsen | $cpucount |
292 | 166 | Per Amundsen | $cpuident |
293 | 169 | Per Amundsen | $cpuload |
294 | 1 | Per Amundsen | $cpumhz |
295 | $cpuname |
||
296 | 179 | Per Amundsen | $cpuvendor |
297 | 1 | Per Amundsen | $cr |
298 | 169 | Per Amundsen | $crc |
299 | $crlf |
||
300 | 166 | Per Amundsen | $ctime |
301 | $date |
||
302 | 169 | Per Amundsen | $datediff |
303 | $datematch |
||
304 | $day |
||
305 | $daylight |
||
306 | 179 | Per Amundsen | $dccport |
307 | $ddename |
||
308 | 169 | Per Amundsen | $decode |
309 | $decrypt |
||
310 | $deltok |
||
311 | $dialog |
||
312 | 166 | Per Amundsen | $did |
313 | 1 | Per Amundsen | $didreg |
314 | 169 | Per Amundsen | $didtok |
315 | 1 | Per Amundsen | $didwm |
316 | $disk |
||
317 | 169 | Per Amundsen | $diskfree |
318 | $diskmenu |
||
319 | 166 | Per Amundsen | $disktotal |
320 | 169 | Per Amundsen | $dlevel |
321 | 179 | Per Amundsen | $dll |
322 | $dllcall |
||
323 | 169 | Per Amundsen | $dns |
324 | 179 | Per Amundsen | $docked |
325 | 169 | Per Amundsen | $dotnet |
326 | $duration |
||
327 | 166 | Per Amundsen | $editbox |
328 | 1 | Per Amundsen | $encode |
329 | 169 | Per Amundsen | $encodingmenu |
330 | 1 | Per Amundsen | $encrypt |
331 | $error |
||
332 | 166 | Per Amundsen | $event |
333 | 169 | Per Amundsen | $exists |
334 | $false |
||
335 | $feof |
||
336 | $ferr |
||
337 | $fgetc |
||
338 | $file |
||
339 | $finddir |
||
340 | $findfile |
||
341 | $findtok |
||
342 | $findtokcs |
||
343 | $fline |
||
344 | $floop |
||
345 | 1 | Per Amundsen | $floor |
346 | $fopen |
||
347 | 166 | Per Amundsen | $frand |
348 | 1 | Per Amundsen | $fread |
349 | 166 | Per Amundsen | $frequency |
350 | $fulladdress |
||
351 | 169 | Per Amundsen | $fulldate |
352 | 179 | Per Amundsen | $fullscreen |
353 | 169 | Per Amundsen | $fulltitle |
354 | 1 | Per Amundsen | $genre |
355 | 179 | Per Amundsen | $get |
356 | 166 | Per Amundsen | $getdir |
357 | 1 | Per Amundsen | $getdot |
358 | 169 | Per Amundsen | $gettok |
359 | $gfx |
||
360 | $gfxram |
||
361 | $gmt |
||
362 | 166 | Per Amundsen | $group |
363 | $height |
||
364 | $hfind |
||
365 | 169 | Per Amundsen | $hget |
366 | $highlight |
||
367 | 166 | Per Amundsen | $host |
368 | $ial |
||
369 | 169 | Per Amundsen | $ialchan |
370 | 166 | Per Amundsen | $ibl |
371 | 169 | Per Amundsen | $ident |
372 | $idle |
||
373 | $iel |
||
374 | 179 | Per Amundsen | $ifmatch |
375 | $ifmatch2 |
||
376 | 166 | Per Amundsen | $ignore |
377 | $iil |
||
378 | 169 | Per Amundsen | $inellipse |
379 | $ini |
||
380 | $inmidi |
||
381 | $inpaste |
||
382 | 166 | Per Amundsen | $inpoly |
383 | 169 | Per Amundsen | $input |
384 | $inrect |
||
385 | $insert |
||
386 | 166 | Per Amundsen | $insong |
387 | $instok |
||
388 | 169 | Per Amundsen | $int |
389 | $invitemenu |
||
390 | $inwave |
||
391 | $ip |
||
392 | 179 | Per Amundsen | $iptype |
393 | 166 | Per Amundsen | $isalias |
394 | 169 | Per Amundsen | $isbit |
395 | $isdir |
||
396 | $isfile |
||
397 | $isid |
||
398 | $islower |
||
399 | 166 | Per Amundsen | $istok |
400 | $istokcs |
||
401 | 169 | Per Amundsen | $istype |
402 | 166 | Per Amundsen | $isupper |
403 | 179 | Per Amundsen | $lactive |
404 | $lactivewid |
||
405 | $lag |
||
406 | 169 | Per Amundsen | $layer |
407 | $left |
||
408 | $len |
||
409 | $length |
||
410 | 166 | Per Amundsen | $lf |
411 | $line |
||
412 | 1 | Per Amundsen | $lines |
413 | 179 | Per Amundsen | $lock |
414 | $locked |
||
415 | $lof |
||
416 | 169 | Per Amundsen | $log |
417 | $logdir |
||
418 | $logstamp |
||
419 | 166 | Per Amundsen | $logstampfmt |
420 | $longfn |
||
421 | 169 | Per Amundsen | $longip |
422 | 166 | Per Amundsen | $lower |
423 | 169 | Per Amundsen | $ltimer |
424 | $maddress |
||
425 | $mask |
||
426 | 166 | Per Amundsen | $matchkey |
427 | $matchtok |
||
428 | $matchtokcs |
||
429 | $md5 |
||
430 | 169 | Per Amundsen | $me |
431 | $memfree |
||
432 | 166 | Per Amundsen | $memfreep |
433 | 1 | Per Amundsen | $memtotal |
434 | 179 | Per Amundsen | $menubar |
435 | 1 | Per Amundsen | $mid |
436 | 166 | Per Amundsen | $mircdir |
437 | 179 | Per Amundsen | $mircexe |
438 | 169 | Per Amundsen | $mircini |
439 | $mkfn |
||
440 | 166 | Per Amundsen | $mklogfn |
441 | $mknickfn |
||
442 | $mnick |
||
443 | $mode |
||
444 | 169 | Per Amundsen | $modespl |
445 | $motherboard |
||
446 | $mouse |
||
447 | 166 | Per Amundsen | $mp3 |
448 | $msfile |
||
449 | $mversion |
||
450 | $myhost |
||
451 | $myident |
||
452 | $network |
||
453 | 1 | Per Amundsen | $newnick |
454 | 169 | Per Amundsen | $nick |
455 | 179 | Per Amundsen | $nickmode |
456 | 169 | Per Amundsen | $nofile |
457 | $nopath |
||
458 | $noqt |
||
459 | 166 | Per Amundsen | $not |
460 | $notify |
||
461 | $now |
||
462 | 169 | Per Amundsen | $null |
463 | 166 | Per Amundsen | $numeric |
464 | 169 | Per Amundsen | $numtok |
465 | $online |
||
466 | 166 | Per Amundsen | $or |
467 | $ord |
||
468 | $os |
||
469 | 169 | Per Amundsen | $osbuild |
470 | 166 | Per Amundsen | $osedition |
471 | $osinstalldate |
||
472 | $osmajor |
||
473 | $osminor |
||
474 | $osname |
||
475 | $osservicepack |
||
476 | $osversion |
||
477 | 1 | Per Amundsen | $percentl |
478 | 169 | Per Amundsen | $percentp |
479 | 179 | Per Amundsen | $pi |
480 | 166 | Per Amundsen | $pic |
481 | $playcount |
||
482 | 1 | Per Amundsen | $player |
483 | 169 | Per Amundsen | $port |
484 | 179 | Per Amundsen | $portable |
485 | 169 | Per Amundsen | $portfree |
486 | 166 | Per Amundsen | $pos |
487 | $poscs |
||
488 | $position |
||
489 | 169 | Per Amundsen | $prefix |
490 | $progress |
||
491 | $prop |
||
492 | $puttok |
||
493 | 1 | Per Amundsen | $qt |
494 | $query |
||
495 | 179 | Per Amundsen | $quitmessage |
496 | 166 | Per Amundsen | $r |
497 | $rand |
||
498 | 179 | Per Amundsen | $randomcolors |
499 | $rating |
||
500 | 166 | Per Amundsen | $rawbytes |
501 | $rawmsg |
||
502 | 169 | Per Amundsen | $read |
503 | $readini |
||
504 | $realname |
||
505 | 1 | Per Amundsen | $regex |
506 | 169 | Per Amundsen | $regml |
507 | $regsub |
||
508 | $regsubex |
||
509 | 179 | Per Amundsen | $remote |
510 | 169 | Per Amundsen | $remove |
511 | $removecs |
||
512 | $remtok |
||
513 | $remtokcs |
||
514 | $replace |
||
515 | $replacecs |
||
516 | $replacex |
||
517 | $replacexcs |
||
518 | $reptok |
||
519 | $reptokcs |
||
520 | 166 | Per Amundsen | $result |
521 | 169 | Per Amundsen | $rgb |
522 | $right |
||
523 | $round |
||
524 | $scid |
||
525 | $scon |
||
526 | 166 | Per Amundsen | $screen |
527 | $screenb |
||
528 | $screenh |
||
529 | $screenw |
||
530 | 1 | Per Amundsen | $script |
531 | 166 | Per Amundsen | $scriptdir |
532 | $scriptline |
||
533 | $sdir |
||
534 | 179 | Per Amundsen | $send |
535 | 166 | Per Amundsen | $server |
536 | $serverip |
||
537 | 1 | Per Amundsen | $sfile |
538 | 169 | Per Amundsen | $sha1 |
539 | $shortfn |
||
540 | $show |
||
541 | 179 | Per Amundsen | $sidebar |
542 | 169 | Per Amundsen | $sin |
543 | 166 | Per Amundsen | $site |
544 | 1 | Per Amundsen | $size |
545 | 166 | Per Amundsen | $slapsmenu |
546 | 169 | Per Amundsen | $sline |
547 | 1 | Per Amundsen | $snick |
548 | 179 | Per Amundsen | $snicks |
549 | 169 | Per Amundsen | $sock |
550 | $sockbr |
||
551 | 179 | Per Amundsen | $sockerr |
552 | $sockname |
||
553 | 1 | Per Amundsen | $song |
554 | $sorttok |
||
555 | 166 | Per Amundsen | $sorttokcs |
556 | 1 | Per Amundsen | $sqrt |
557 | 179 | Per Amundsen | $ssl |
558 | $sslready |
||
559 | 169 | Per Amundsen | $status |
560 | 179 | Per Amundsen | $statusbar |
561 | 1 | Per Amundsen | $str |
562 | 169 | Per Amundsen | $strip |
563 | $style |
||
564 | $submenu |
||
565 | 179 | Per Amundsen | $switchbar |
566 | 169 | Per Amundsen | $tan |
567 | 166 | Per Amundsen | $target |
568 | $ticks |
||
569 | $time |
||
570 | 169 | Per Amundsen | $timer |
571 | 166 | Per Amundsen | $timestamp |
572 | $timestampfmt |
||
573 | $timezone |
||
574 | 169 | Per Amundsen | $tip |
575 | 166 | Per Amundsen | $title |
576 | 1 | Per Amundsen | $token |
577 | 169 | Per Amundsen | $toolbar |
578 | $totaltracks |
||
579 | 166 | Per Amundsen | $track |
580 | 179 | Per Amundsen | $treebar |
581 | 166 | Per Amundsen | $true |
582 | 169 | Per Amundsen | $trust |
583 | 166 | Per Amundsen | $ulevel |
584 | $updays |
||
585 | 1 | Per Amundsen | $uphours |
586 | 166 | Per Amundsen | $upmins |
587 | $upper |
||
588 | 169 | Per Amundsen | $uptime |
589 | 179 | Per Amundsen | $url |
590 | 1 | Per Amundsen | $user |
591 | $usermode |
||
592 | 169 | Per Amundsen | $utfdecode |
593 | 166 | Per Amundsen | $utfencode |
594 | 179 | Per Amundsen | $v1 |
595 | $v2 |
||
596 | 169 | Per Amundsen | $var |
597 | 166 | Per Amundsen | $version |
598 | 169 | Per Amundsen | $vol |
599 | 166 | Per Amundsen | $volume |
600 | $volumeb |
||
601 | $volumep |
||
602 | $wid |
||
603 | 169 | Per Amundsen | $width |
604 | 166 | Per Amundsen | $wildsite |
605 | 169 | Per Amundsen | $wildtok |
606 | $wildtokcs |
||
607 | 166 | Per Amundsen | $window |
608 | 169 | Per Amundsen | $xor |
609 | 166 | Per Amundsen | $year |
610 | </pre> |
||
611 | 149 | Per Amundsen | |
612 | 166 | Per Amundsen | All operaters are added. |
613 | |||
614 | 154 | Per Amundsen | h1. Example scripts |
615 | |||
616 | Simple kickcounter script: |
||
617 | |||
618 | <pre> |
||
619 | 166 | Per Amundsen | alias kick { |
620 | if (!%kickcount) %kickcount = 0 |
||
621 | 154 | Per Amundsen | |
622 | 166 | Per Amundsen | inc %kickcount |
623 | 154 | Per Amundsen | |
624 | 166 | Per Amundsen | if (!$3) { |
625 | kick # $$2 Kick number %kickcount |
||
626 | 154 | Per Amundsen | halt |
627 | } |
||
628 | } |
||
629 | </pre> |
||
630 | |||
631 | Kickban example |
||
632 | <pre> |
||
633 | 166 | Per Amundsen | alias kb { |
634 | 175 | Per Amundsen | if (!$1) { |
635 | echo /kb - Nick missing |
||
636 | return |
||
637 | } |
||
638 | 154 | Per Amundsen | |
639 | 175 | Per Amundsen | var %msg = $iif(#, $2-, $3-) |
640 | var %chan = $iif(#, #, $2) |
||
641 | 154 | Per Amundsen | |
642 | 175 | Per Amundsen | ; Set this for default ban reason, or remove for no default reason |
643 | ; Can be shortened to %msg = $iif(%msg, %msg, GTFO) |
||
644 | if (!%msg) %msg = GTFO |
||
645 | 154 | Per Amundsen | |
646 | 175 | Per Amundsen | if ($me isop %chan) { |
647 | 177 | Per Amundsen | MODE %chan +b $wildsite |
648 | KICK %chan $1 %msg |
||
649 | 175 | Per Amundsen | } |
650 | else echo You are not oper on %chan |
||
651 | 154 | Per Amundsen | } |
652 | </pre> |
||
653 | |||
654 | Simple calculator script: |
||
655 | <pre> |
||
656 | 166 | Per Amundsen | alias calc { |
657 | 175 | Per Amundsen | if (!$1) { |
658 | echo /calc - Parameters missing |
||
659 | return |
||
660 | } |
||
661 | 154 | Per Amundsen | |
662 | 175 | Per Amundsen | ; typing /calc -p <expression> sends output to channel |
663 | if ($1 == -p) { |
||
664 | 176 | Per Amundsen | msg # Calculating : $2- |
665 | msg # Result is : $calc($2-) |
||
666 | 175 | Per Amundsen | } else { |
667 | 176 | Per Amundsen | echo Calculating : $1- |
668 | echo Result is : $calc($1-) |
||
669 | 175 | Per Amundsen | } |
670 | 154 | Per Amundsen | } |
671 | </pre> |
||
672 | |||
673 | Colored version |
||
674 | <pre> |
||
675 | 166 | Per Amundsen | alias calc { |
676 | 175 | Per Amundsen | if (!$1) { |
677 | echo /calc - Parameters missing |
||
678 | return |
||
679 | } |
||
680 | 156 | Per Amundsen | |
681 | 175 | Per Amundsen | # typing /calc -p <expression> sends output to channel |
682 | if ($1 == -p) { |
||
683 | 176 | Per Amundsen | msg # $chr(3)4Calculating : $2- |
684 | msg # $chr(3)4Result is : $calc($2-) |
||
685 | 175 | Per Amundsen | } else { |
686 | echo $chr(3)4Calculating : 4$1- |
||
687 | echo $chr(3)4Result is : $calc($1-) |
||
688 | } |
||
689 | 166 | Per Amundsen | } |
690 | 154 | Per Amundsen | </pre> |
691 | |||
692 | CTCP flood detection example |
||
693 | |||
694 | <pre> |
||
695 | 166 | Per Amundsen | CTCP *:*:*:{ |
696 | 175 | Per Amundsen | if (!%count) set -u10 %count 1 |
697 | else inc -u10 %count 1 |
||
698 | 154 | Per Amundsen | |
699 | 175 | Per Amundsen | if (%count > 4) ignore -tu30 $wildsite |
700 | 154 | Per Amundsen | } |
701 | </pre> |
||
702 | |||
703 | Mass mode example |
||
704 | |||
705 | <pre> |
||
706 | 166 | Per Amundsen | alias mass { |
707 | 175 | Per Amundsen | if (!$2) { |
708 | echo /mass - Parameters missing [+/-<mode> <nick> <nick> <nick>] |
||
709 | return |
||
710 | } |
||
711 | 154 | Per Amundsen | |
712 | 175 | Per Amundsen | %len = 2 |
713 | 154 | Per Amundsen | |
714 | 175 | Per Amundsen | ; equal to while (%len <= $count(%1-, $chr(32))) |
715 | while (%len <= $0) { |
||
716 | if ($(%len) ison #) mode # $1 $($ $+ %len) |
||
717 | inc %len |
||
718 | } |
||
719 | 154 | Per Amundsen | } |
720 | </pre> |
||
721 | |||
722 | Shows info about servers, channels and users |
||
723 | <pre> |
||
724 | 166 | Per Amundsen | on *:JOIN:#: { |
725 | 175 | Per Amundsen | var %s = $scon(0), %c = 0, %u = 0, %t = 0, %c2 = 0; |
726 | 154 | Per Amundsen | |
727 | 175 | Per Amundsen | while (%t < %s) { |
728 | inc %t |
||
729 | scon $scon(%t); |
||
730 | inc %c $chan(0) |
||
731 | 154 | Per Amundsen | |
732 | 175 | Per Amundsen | %c2 = 0 |
733 | while (%c2 < $chan(0)) { |
||
734 | inc %c2 |
||
735 | inc %u $user($chan(%c2), 0) |
||
736 | } |
||
737 | } |
||
738 | 154 | Per Amundsen | |
739 | 175 | Per Amundsen | /echo You are on ( $+ %s $+ ) servers, ( $+ %c $+ ) channels with ( $+ %u $+ ) users |
740 | 154 | Per Amundsen | } |
741 | </pre> |
||
742 | |||
743 | It is possible to use scripts as functions. |
||
744 | These functions are fully nested like the client functions. |
||
745 | |||
746 | Lets say you make a /mycalc like this. |
||
747 | <pre> |
||
748 | 166 | Per Amundsen | alias mycalc { |
749 | 175 | Per Amundsen | return $calc($$1 + $$2); |
750 | 154 | Per Amundsen | } |
751 | </pre> |
||
752 | |||
753 | Then you can call this function with eiter /mycalc <number> <number> the normal way or $mycalc(<number, <number>) |
||
754 | Typing /testcalc will show the result. |
||
755 | <pre> |
||
756 | 166 | Per Amundsen | alias testcalc { |
757 | 175 | Per Amundsen | echo -a $1 + $2 is $mycalc($1, $2); |
758 | echo -a 5 + 4 is $mycalc(5, 4); |
||
759 | 154 | Per Amundsen | } |
760 | </pre> |
||
761 | |||
762 | Simple convert temperature C to F or F to C |
||
763 | /temp C 20 will print 68 F |
||
764 | |||
765 | <pre> |
||
766 | 166 | Per Amundsen | alias temp { |
767 | 175 | Per Amundsen | if ($1 == C) echo $calc(($2 * 9/5) + 32) F |
768 | else if ($1 == F) echo $round($calc(($2 - 32) * 5/9), 1) C |
||
769 | else echo Temp missing |
||
770 | 154 | Per Amundsen | } |
771 | </pre> |
||
772 | |||
773 | 166 | Per Amundsen | Announce song changes in a channel or to a user |
774 | 154 | Per Amundsen | <pre> |
775 | 166 | Per Amundsen | On *:SONG:{ |
776 | 175 | Per Amundsen | nmsg <network> <channel/Nick> $1- |
777 | 154 | Per Amundsen | } |
778 | 158 | Per Amundsen | </pre> |
779 | |||
780 | 166 | Per Amundsen | Announce to several channels with: |
781 | 158 | Per Amundsen | <pre> |
782 | 166 | Per Amundsen | On *:SONG:{ |
783 | 175 | Per Amundsen | nmsg <network> <channel1/Nick>,<channel2/Nick> $1- |
784 | nmsg <network2> <channel3/Nick> $1- |
||
785 | 158 | Per Amundsen | } |
786 | 166 | Per Amundsen | </pre> |
787 | 158 | Per Amundsen | |
788 | 166 | Per Amundsen | Automatically find the summary of a imdb url |
789 | <pre> |
||
790 | On *:TEXT:*:#k: { |
||
791 | 175 | Per Amundsen | var %reg = $regex($1-, http://www\.imdb\.com(/title/[a-z0-9]+/)) |
792 | if (!%reg) { return } |
||
793 | sockclose imdb |
||
794 | unset %data |
||
795 | %imdb = $regml(1) $+ plotsummary |
||
796 | %imdbchan = # |
||
797 | sockopen imdb www.imdb.com 80 |
||
798 | 1 | Per Amundsen | } |
799 | |||
800 | 166 | Per Amundsen | on *:sockopen:imdb: { |
801 | 175 | Per Amundsen | sockwrite -n imdb GET %imdb HTTP/1.1 |
802 | sockwrite -n imdb Host: www.imdb.com |
||
803 | 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 |
||
804 | sockwrite -n imdb Referer: http://www.imdb.com |
||
805 | 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 |
||
806 | sockwrite -n imdb Accept-Language: en-us, en;q=0.50 |
||
807 | sockwrite -n imdb Connection: Close $+ $crlf $+ $crlf |
||
808 | 1 | Per Amundsen | } |
809 | |||
810 | 166 | Per Amundsen | on *:sockread:imdb:{ |
811 | 175 | Per Amundsen | sockread %text |
812 | %data = %data $+ %text |
||
813 | 1 | Per Amundsen | } |
814 | |||
815 | 166 | Per Amundsen | on *:sockclose:imdb: { |
816 | 175 | Per Amundsen | if ($regex(%data, <p class="plotpar">([\s\S]*?)<i>)) { |
817 | msg %imdbchan $regml(1) |
||
818 | } |
||
819 | 1 | Per Amundsen | |
820 | 175 | Per Amundsen | unset %data |
821 | 1 | Per Amundsen | } |
822 | </pre> |
||
823 | 170 | Per Amundsen | |
824 | 171 | Per Amundsen | h1. More information |
825 | 172 | Per Amundsen | |
826 | 178 | Per Amundsen | You can find many mIRC scripts at places such as http://www.mircscripts.com/ and http://www.mircscripts.org/ |
827 | 170 | Per Amundsen | |
828 | 1 | Per Amundsen | Not everyone will work, if you find one that dosen't, please open a new issue with a link to the script. |
829 | |||
830 | 172 | Per Amundsen | For more on mIRC scripting and how it works, check out http://www.zigwap.com/mirc/docs/ and http://www.mirc.org/mishbox/index.htm |