![]() | ![]() | ![]() | ![]() | ![]() |
|
![]() | ![]() | ![]() GatoX Script
Tutorial
| ![]() |
||
![]() | ![]() | ![]() | ![]() |
||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() |
|||||
![]() | ![]() |
||||
![]() |
![]() |
||||
![]() | ![]() |
| ![]() | ![]() |
![]() |
||||
![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() |
MIRC Identifiers sound very technical, but its just a term for some characters that identify a value. Still sounds techie? An identifier is like a magic word that will be replaced by mIRC with whatever value it refers to. The mIRC Identifier $me means your nickname. No matter how many times you change your nick, $me is the identifier for the current one. Wherever you use $me, mIRC will replace that identifier with your nickname. Simple and good isn't it. The mIRC Identifiers are needed so that your scripts can find the values that may change. MIRC Identifiers are no more than that. There are many identifiers, since there are many things you may need to refer to in your scripts that can change between the time of scripting and the time of use. Pretty much everything that you can select or change has an identifier. You can refer to the first word in any string of text ($1); the folder (directory) where you installed mIRC ($mircdir); the currently selected nicks in the nicklist ($snicks); etc. Again, a full list of mIRC's identifiers can be found in the mIRC Help files. In this tutorial I will detail only a few examples of the most practical of the identifiers to start with. MIRC Identifiers can be used at the command line as well as in scripts, but, for mIRC to evaluate them you must prefix the command with two '//' slashes rather than the normal one. If you only use 1 slash '/' mIRC will not convert the identifier given in an editbox to its value. This only applies to command lines - identifiers and variables are always evaluated in scripts. NOTE: One essential thing to remember about identifiers is that they almost always will only work if there is at least one space on either side. If an identifier is not seperated by spaces from other characters in scripts then mIRC will usually fail to 'see' it. ALWAYS space identifiers from anything else in your scripts or commands. $me identifies your current nick. It becomes very useful in scripting of all kinds. $1 $2 $3 $4- identify parameters in text etc. These are both the simplest and most confusing of all identifiers since they can refer to a vast range of values. In text strings $1 is the first word, $2 is the second, and so on. Adding the dash '-' to the end means 'onwards'. So $1- equals all words from the first. $2- means from the second word onwards. The reason for the confusion is that many things create strings which mIRC can choose the first parameter from. In popups for instance, $1 would be the nick selected in the case of nicklist popups. With experience (or help files) you will learn what parameters mIRC will be evaluating in any given situation. This is because you are generally going to use $1 $2 etc. in very specific circumstances. You will learn about this in the scripting tutorials. For now it is enough to know that $1 means parameter 1. $? is a very useful and powerful identifier. $? causes mIRC to prompt the user for a value to enter. You can also put your own text on the prompt. $?="Enter your name" will cause mIRC to open a dialog box that has the text 'Enter your name', a text field for you to enter your data into, and 'OK' and 'Cancel' buttons. The $? identifier is pointless at the command line, but is invaluable in scripts to get user input. To see it in action however before the scripting tutorials just type: /ECHO [-adetsl][channel OR nick] <text> The switches select how to display the <text> specified. If a channel/nickname isn't specified, the -s switch echoes to the status window, the -d switch echoes to the dedicated message window (if you have one), and the -a switch echoes to the currently active window. If you specify a channel or nick, the text will be displayed in the channel window (or query window) that matches the given name. The -etl switches can still be used with a named window. The e switch encloses the line in line separators. The t swich adds a timestamp (e.g. [11:23] ) to the echoed text. The l makes the echo highlighted. $wavedir is the folder you specified in the options for your .wav sound files. $mididir is the folder you specified for .mid files. $fulldate is the current date in the format: Tue Sep 07 23:51:23 1999 $date is the date in day/month/year format. To get the date in the American month/day/year format use $adate. The $time gives the time according to your system clock in Hours Minutes and Seconds. $day returns the current day e.g. Tuesday. That is enough identifiers to give you the idea. You can find all of the mIRC Identifiers in the mIRC help files whenever you wish. Identifiers are not really all that 'techie' at all. Even if you are not yet comfortable with identifiers in mIRC you will still be able to begin scripting. MIRC Identifiers will become crystal clear once you get to use them a little in your scripts. Popups Popups Popups, Funny word isnt it :) Now go to Tools and then Popups and you see all of the code that is the popups, pretty cool it is.Now you see the "View" tab, click it and you get to use *Nick List now you can write your own : this is the syntax (layout) Message For Command:/actual command Like say I wanted to write click and say i was leaving and i would be back later i would add this: Say Bye:/msg $chan Goodbye All | /msg $chan I Will Be Back Later!!! | /msg $chan I Promise, See ya !!!!! now go to File >> Save now when you right click where you added it (normally in Channel Popups) Now you should see a thing saying "Say Bye" and if you click it, in the Room it was in you would see this... Script: Goodbye All Now you can edit it to do anything, add this to channel popups (mode changer) Change Modes Now notice the layout, if you use dots it means it leads into something else like in Channel popups. I would right click and see "Change Modes" if I put my mouse over it I would see: Spec and if I put my mouse on them it would go out to the "on" and "off" messages and clicking them does the actual command, its a cool layout feature to prevent your script to look very crowded. Hopefully now you understand *What Popups Are here is my Modes popus for you to copy and paste into your own script..... Modes Feel free to use that. and play with it. Now in remote files for kicks and bans etc you do kick # $2 or access # add deny $2 most of the time Goto Tools >> Poppups >> View >> Nick List and add this line for example : *note when displaying the nickname use $$1, not for anything else* Kick $$1:/kick # $1 That would kick them , however to spice up youre script, use something like this Kicking Now there is a lot of different commands in there, Banlist/Kicklist/Ownerlist/Hostlist and Voicelist Well no doubt you have heard of all these things but how much when it comes to understanding them, by the end of this I hope you will understand how they work and how to write them (from a file and the userlist) first of all there are a few commands we need to cover. *To add to the userlist : auser <Level> on kicklist:JOIN:*: { kick # $nick ( Well we all know what a variable is *I hope* : on @!*:KICK:#: { Now before you read the rest please examine this code and try to make sense out of it. Having covered Events scripting in mIRC already, in this tutorial I shall show you the true potential of Remotes Scripting. A mIRC remotes script can be made to include aliases, popups, events and more, all grouped together in one exchangeable file. Loading and Unloading mIRC Remotes Scripts is so easy, either with the command /load -rs <filename> or from the File menu of the mIRC editor. This can be used to create modular scripts. You just load and unload the modules as you want. You will find some script modules in the Download area. Adding alias scripts via a mIRC remotes script instead of the alias script is very simple. The main use of this technique is to keep all the parts of a module together. The aliases, popups and remotes of a module all in the one file. alias <alias name> <command to perform with all parameters> Note that the only difference between the Remote script alias above and a normal alias script is the addition of the prefix alias. In the following example an alias is combined with an event script: alias titles { The alias is called 'titles' and sets the variables %served (to show the server you are connected to) and %times (to show the first 5 characters of the current time) and then displays these details, with your current nick in the titlebar as a kind of status display. The 'on *:START' event is triggered when you start mIRC. It starts a timer up called 'title' which runs the /titles command (our alias) every ten seconds. This means that the status displayed on our titlebar is refreshed and updated every 10 seconds while mIRC is running. There are two proceedures and one command that we haven't covered before in that example Remote Script. The square brackets around [ [ %served ] ] are used to force a re-evaluation of the %served variable's value. The dot '.' prefixing the ./timertitle command makes mIRC perform the command 'silently'. In this case preventing mIRC from echoing information about starting and stopping the timer. /timer[name] [-ceom] [time] <repetitions> <interval> <commands> The /timer command sets a timer that will activate the command given every <interval> seconds until it has been repeated <repetitions> times. If you specify <repetitions> as 0, the timer's command will repeat endlessly at the interval specified in <interval>. You can optionally set a specific time, and the timer will activate at that time: /timer9 14:30 1 1 /say It's now 2:30pm The switches (-ceom) control other optional settings. If you specify the -c switch, this makes mIRC "catch up" a timer by executing it more than once during one interval if the real-time interval isn't matching your requested interval. If you specify the -m switch, this indicates that the interval delay is in milliseconds (1000 milliseconds per second). Note: millisecond timers can slow mIRC down significantly because each timer can trigger many times per second, so they should not be used unless they are necessary. To see a list of active timers type /timers. To see the setting for timer1 type /timer1. To deactivate timer1 use /timer1 off. To deactivate all timers use /timers off. The name is optional. If a name is not specified for the timer mIRC will allocate the first free timer number to it automatically. To add popups via a mIRC Remotes Script you simply define which menu of popups you want to add to, and then list the popups in the same format as used when you used the popups editor. menu status { In the above example, menu tells mIRC that we are defining items for a popup menu. The example is for the status popups, but you could set nicklist, channel, query or menubar popups instead. The only differences between a Remotes Script popup definition and that used in a Popups script is the line: Events are scripted in the remotes editor anyway, so there is naturally no difference at all in the procedure as described in the mIRC Events tutorial. However, one new thing to learn about events is creating Groups, which can be enabled and disabled collectively either on command or via scripting. #group1 off Only the first and last lines of the above example are important. The central two lines are just to illustrate where you put events within a group definition. The first line format is the # prefix to the group name. There can be no space between the # and the group name. The second part is the status of the group (off or on). When the first line ends in on the group is enabled and the events scripted within the group will be used. the command /enable #<group name> will switch a group 'on' while the command /disable #<group name> will switch the group off. When a group is disabled the events within the group are totally ignored by mIRC. #blooz off The above script takes the text you input at an editbox and looks to see if it begins with a '/' command prefix, or if it was entered into a custom window. If either of those conditions are true it returns to mIRC's normal processing, ignoring the rest of this script. If the entered text was neither prefixed with a '/' slash nor entered into a custom window mIRC knows that this is just a chat message and adds colour codes to the line automatically to 'jazz it up'. By following these lines with an popup to switch the group (and thus its effect) on and off you have a quick and easy text effect. You just type as normal and when the effect is on (group is enabled) you have funky text effects added. But whenever you wish you can turn the effect off (disable the group). menu menubar { If you have been through all the tutorials to this point you have covered all the essential details of mIRC scripting. All that remains is to put the ideas together and create some scripts. When writing scripts it can be a good idea to include comments. Comments help you (and others who might use the script) to understand the steps and proceedures you are following. Prefix a line with a semi-colon ';' to let mIRC know it is a comment and mIRC will ignore the line when processing the script. ;This is an example of a comment Writing a script can be a little like putting together a jigsaw puzzle. The whole script is made up of smaller functions, controls and sub-routines that must be carefully fit together to form the unified whole. Using comments will help you in identifying the pieces as you go about putting it all together. Moreover, when you later update or rework the script, long after you have forgotten the details of each step, the comments will help you once again. Having completed the tutorials of each of the various aspects of scripting, and having now learnt about unifying those processes into a single mIRC Remotes Script the only fitting examples are modular scripts. The Downloads area will provide you with a range of samples to download and examine. All scripts and add-ons in the Downloads Area are fully functional. Take a look at what they do and how they accomplish it. Use the search function in mIRC's help files to quickly locate any commands or identifiers that you dont understand. We are all familiar with what Timers are. They are a way to halt a process for a certain period of time and then execute a command.There are a few ways to start timers. Here is one: on @!*:KICK:#: { it sets the variable %kic. if it is null on a kick, it sets -u8, which means after 8 seconds %kic. will automatically reset / unset itself. Later on it checks again to see if it has been incremented within the 8 seconds and it has been reset. on *:TEXT:.start timer:#:/privmsg $chan Ok! | /privmsg $chan Timer Started (20 Seconds) | Thats how it SHOULD work, you need to base it out like that . Ok now did you get a message < Timer no such nick/channel > on *:TEXT:.start timer:#:/privmsg $chan Ok! | /privmsg $chan Timer Started (15 Seconds) | /timer 1 15 { /privmsg $!chr(37) $!+ $right($chan,-1) Timer Finished } Here is what you should see now : Traditional_Witch : .start timer Lets go over what we learnt in this lesson on owner:TEXT:.start:#:{ | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() |
![]() |
||||
![]() | ![]() |
| ![]() | ![]() |
![]() |
||||
![]() |
||||
![]() |
||||