Monday, November 3, 2008

MIRC Remote Script

Code examples

The code below is in the remote scripts format. If placed into an alias file, the command names should not be preceded by the word "alias". Test Comments include the common /* comment */ and ;comment.

Here is an example of alias:

;Defines the alias 'hello' in the remote script

;Note: if this is placed in an alias script, the 'alias' part must be removed (result: hello {)
;Usage: /hello
alias hello {

;Displays(/echo) 'Hello World!' into the active window(-a)
echo -a Hello World!

}

Counting to 10:

alias ten {

;'%i' is locally set as 1
var %i = 1

;The while loop continues until '%i' is greater than 10, then stops.
while (%i <= 10) {

;Displays(/echo) '[value of %i]' into the active window(-a)
;'[value of %i]' will be 1 at the beginning of the execution.
echo -a %i

;To continue the while loop, '%i' must be increased, or you'll
;have yourself an infinite loop (can be breaked with Ctrl+Pause/Break)
inc %i

;Don't forget to close the while loop scope.
}
}

A remote script event handler:

;Placed in a remote script.

;Literally: when any user joins #IRCHelp, message to the channel: Hello [nickname that joined]
on *:JOIN:#IRChelp: msg # Hello $nick

;To do this for any channel, the code would be:
on *:JOIN:#: msg # Hello $nick

A remote script to automatically respond to certain text

;Placed in a remote script

;When a user types Hello! in a channel, you answer back: Hello, [nickname]!
on *:TEXT:Hello!:#: msg # Hello $nick $+ !

;When a user types Hello! in a private message, you answer back: Hello, [nickname]!
on *:TEXT:Hello!:?: msg $nick Hello $nick $+ !

Here is an example of picture windows:

alias cir {

;Create a picture (-p) window (@cir)
window -pek @cir

;Draw a circle (on window @cir) with color 4 (red), size of 50 at coordinates (200,200)
drawdot @cir 4 50 200 200

}

1 comment:

  1. Sibuk ya... Koq ga di update Blognya.. But it's ok,, Your Blog is ok....Tukeran link ya...
    visit me on http://dunianya-it.blogspot.com

    ReplyDelete