Hey guys, here is another one of my tutorials on mIRC. This time we are going to work on basic scripting on mIRC. First off, you should have some basic knowledge of mIRC and IRC, and you should have most likely added some add-ons into your Remote section on your mIRC program. So now that you have some of the little nick-picks down, we can start on some more of the basics of mIRC scripting. The first thing we are going to discuss is Aliases. Now if you haven't already opened mIRC up and go to Tools - Aliases. You should have a screen that shows up and the platform should be already have some information in there, first go to File - New, this is where we are going to be scripting. Now to get you started lets write something like this in there:
/Hello /say Hello World!!! :-)
Let's go ahead and dissect this little piece of information; by the way if you aren't already go ahead and get into any IRC channel. First off the command " /say " is what you speak without any actions, you can go ahead and try to type /say (anything here) and it will come out just as you normally type in an IRC channel. Go ahead and press the 'Ok' button if you haven't already on the Aliases section. Now type this:
/Hello
See what comes up in the IRC channel, you should see "Hello World!!! :-)" come up in the middle of the chat, you have just written and successfully made your first alias. Now you have just created a new command that uses /Hello to say in the channel Hello World!!! :-). Let's try another one this time. Here it is.
/letsgo /join #Ro0l3rz
Now you try to decipher this one yourself. Well if you haven't figured it out, I will help you. Our new command is /letsgo. On this alias /letsgo is going to the command for lets go to channel Ro0l3rz, on whatever IRC network you are on. As you should know, the /join command lets you join a channel while specifying what channel you want to go to. Here let's try one more.
/sing /me sings $1
This starts to use identifiers, which is what $1 is. $1 identifier let's you declare the action. So this is what you would type into IRC chat. /sing (place words here, but for now we'll say loneliness kills me) and it will come out as *Obscurity sings loneliness kills me. Now, there are some basic ways to make aliases, simple eh? :p
Let's move on into the Remote section, this is where the real fun comes in. If you still have the Aliases section up, go ahead and switch to the Remote tab, but if you don't have it open go to Tools - Remote. There should be an open white section here let's go ahead and start with this little ditty here:
On *:text:*love:#: { //msg $chan I love you too }
This is the easiest script add-on to look at, or even make. Let's decipher this add-on to the extreme.
On - This is quite simple, in this case we are using On *:text:* so it means On this certain whatever variable (text, join etc), execute this command. Lets talk about this - *:text:* - As you can see there are two stars and two colons there. Let's start off with the stars; they represent the beginning and ending of a function. The first star represents the beginning of a function and the second star represents the ending of the function. Next the colon stands for subject of command follows. Next we see the word 'love' basically this is the keyword that your add-on is going to respond to. Next you see # which signifies a channel. Well if you use the number sign just as a number sign with no other words on it, it responds to all channels. Or you could as well use it with just a single channel. Alright, now let's take a look at the rest of it which can be summed up rather quickly. The brackets enclose a set of commands, which will be shown in much more advanced scripts a lot more in-depth. Next, //msg signifies that you want to say something in the chat. $chan represents you want to say it to the channel, there are other things to say it to as well (single nicks etc). Immediately following '$chan' you see the response to the keyword which is 'love'. So all in all, this add-on is telling your mIRC script this: If someone types the word 'love' then tell them automatically 'I love you too'. See, simple :-)
So let's say you want your room to be nice, clean and tidy especially from those bad words that some people really love to use, let's try this one:
on *:text:*Obscurity sucks:#: { if ($nick isop $chan) return | /mode +b $nick | kick # $nick Get out lamer (Access ban set forever) }
Yep, that's a nice little one to get you started :-) You can either add that in the line under the previous add-on or you can go to FILES - NEW and create a new file and add it in. Alright since we understand the first function, let's move over into the bracket area. Simply enough, this is an If-Then-Else statement, which means this: If, X happens Then do this, if X doesn't happen Then do this. This is probably one of the better and smaller If-Then-Else statements because you can easily decipher it. I'm sure you can decipher it yourself after learning some more of the basic functions of add-ons but just in case Ill go over some of the key points. if ($nick isop $chan) return - this tells you that is the user that said Obscurity sucks, is an operator of the room, your add-on doesn't automatically kick him. Next you see | which tells your script that there is a new command in the same structure, you could also add it on the next line without the | but it looks more professional this way (and yes the way your add-ons look is very valued). Following that is the mode ban which you should already know and then is another command kicking the user. A nice little script add-on to help brighten your day, and keep your chat clean.
on *:TEXT:*!fact*:#: { //describe $nick $read(fact.txt) }
Here's an add-on that's more for fun then anything :-) First off this is an add-on that reads off from a txt file (notepad etc). Let's go over this just to make sure you get the hang of it. I am pretty certain that most of you reading have gotten the first section down, so let's move to the brackets again. //describe , may seem different then //msg but actually it just whispers the user that types !fact. $read(fact.txt) is a new piece that we are seeing. It tells your script to read from the file fact.txt in your mIRC directory. So simply this add-on tells the script to read strings from fact.txt in your mIRC directory, and whisper them to whomever types in !fact. Cool huh?
Cool, I think we've gone over most of the basic things, so now you guys can start writing your own add-ons and maybe one day your own bots. Remember if you ever have a question on identifiers or commands everything is in the mIRC help file. So I hope you guys continue to work with mIRC scripting and have a fun time programming.
----
Written by Obscurity
Member of CAUniversity
-----
This article was originally published by CyberArmy.net in the CyberArmy Library.
|
|