Project

General

Profile

Scripting » History » Version 180

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