Home › Forums › Archives › Instant Messaging › Other Instant Messengers › IRC › Introduction to mIRC Scripting
- This topic has 0 replies, 1 voice, and was last updated 17 years, 7 months ago by .Clint.
-
AuthorPosts
-
May 6, 2007 at 1:32 am #26895.ClintParticipant
So, do you know the basic commands of mIRC, but you want to push your limits and learn mIRC scripting? Perhaps you want to make a bot, or you want to extend the capabilities of mIRC. Unfortunately, you can’t just jump into the complicated stuff, yet. Learning mIRC script will take time and patience, as we’ve all found out, many the hard way.
First, you’ll need to know the different kinds of scripts.
There are aliases, popups, and remotes.Aliases: These may also be known as identifiers, because they virtually work the same way. There is code processed in the alias, and it usually outputs something whenever it’s called. In an identifier, something is returned and not output, so you can use it in a remote or a popup without using a lot of redundant code. You may use aliases/identifiers in other aliases, in popups, and in remotes. You can even call them from the editbox, the area where you input text. These can be made in a remote script by prefixing them with the word alias, like this:
Code:alias CrazySlap {
;The semicolon denotes a comment
;The describe command is like using /me, but you put in the channel
;$$1 is the first parameter
;The double dollar-signs mean that the command only gets evaluated if $1 is not empty (it is not given)
describe # slaps $$1 until they go crazy!!
}Popups: Popups are what you see when you right click in a channel, on the nicklist, or in another window. Usually, they are just places to call an alias or two, not a place for very complex code. You can create a nested menu by using more dots between the name, to show the menu level. These can be created in a remote script by prefixing them with the word menu, followed by the location. The location can be the status window, a channel, query windows (private message), nicklist, and menubar. Here’s how it would look in a remote script:
Code:menu nicklist {
;This is a menu item
Slap them crazy!:/crazyslap $1
;This is a submenu
Other Slaps
;Item in there..
.Slap One:/me slaps $1 with a 100lb. trout!
;Another Submenu
.Other Trouts
..Troutalicious:/me gives $1 a troutalicious slap! Wasn’t that tasty?
}Remotes: No, no, they won’t control your television. These are scripts that are triggered on events, but as you’ve learned, they can also contain aliases and popup menus. mIRC has many types of events, however a beginner to scripting shouldn’t attempt to use the complicated ones. All events start with the word on, but you can change it to off to disable the event. Then, there is a level, by default, all users have a level of 1. Then, you have a colon, followed by the event name. After that, there may be more colons and more properties, but it really depends on the event. After the last colon, you may put a command, or you may use brackets to continue the commands onto other lines.
When you’re learning, don’t be intimidated by advanced scripters trying to use a small amount of lines. It’s best to have your scripts readable, that way, if there are any problems, it’s easy to be able to follow the commands that your script is running.
Here’s an example that complains whenever someone trouts you. 🙂Code:;Level is *, for anyone
;on ACTION event is for a /me or /describe, also known as action
;You want any action that contains the word slap and your nickname. The * is a wildcard meaning anything.
;The next asterisk (*) means that it is triggered in a query or in a channel.
;The opening curly bracket means that the commands are on several lines.
on *:action:*slap*$me*:*:{
;Echo the command locally, no one else sees it
;-a means the active window
;the 4 is the color code for red
;$nick is the person that slapped you
echo -a 4 * $nick just slapped you! YELL AT THEM!
;Message the channel the event was triggered on
;$nick, is not proper and will not work. You need to separate it and the comma
;The $+ removes the spaces, after the $nick was evaluated, so it works!
msg $chan Hey, $nick $+ , don’t slap me!!
}
;This is the output:
;* EvilSeph slaps Clint with a large trout!
;Hey, EvilSeph, don’t slap me!! Well, I’ll definitely be adding more, probably in other posts, though 🙂
If you’ve got any questions or comments, don’t hesitate to reply, or talk to me on IRC.The best resource is mIRC’s own helpfile, and I also found this wiki very helpful. The wiki has articles for most of mIRC’s functions, so just search for it.
If you need any help, just post back with the problem, I’m sure someone around here (*cough a certain staff member cough*) will be able to help with your most difficult problems if I don’t know the answer. 🙂
Clint
-
AuthorPosts
- You must be logged in to reply to this topic.