MIRC Scripting/Basics/Become Familiar with mIRC
Chapter 1: Become Familiar With mIRC
← Title Page | mIRC Scripting | Getting Started → |
Starting From Scratch: Become Familiar with mIRC |
Getting Started
Learning the Ropes: Branching and Loops |
Timers |
User Levels |
Text Matching |
File Handling |
Hash Tables |
Dialogs
Advanced Subjects: Custom Windows |
Agents |
Sockets
Planned: DLLs |
COM Objects |
Error Checking and Handling
Before beginning mIRC scripting, you should get to know mIRC a bit better and make sure you have some basic knowledge under your belt.
- Do you know how to use basic commands, join servers, and chat?
- Can you tell what a command is and how to identify one?
- Do you know what most of the options in the options dialog are for?
- Do you know what the command line is?
- Have you ever used the script editor before? Can you find it on the toolbar?
If you can't do any of those first four, then you should do so now. If you aren't doing step one, well...you should not be here. You should be learning how to chat, first. If you need help with the last item, read the section below.
Getting to Know Your Script Editor
[edit | edit source]First things first: locate the button on your toolbar that looks like a paper scroll with a green dot on it. This is the script editor toolbar button. If you can not find the button or don't have the toolbar open, push Alt+R on your keyboard. Look at the window that opens. It is a fairly simple window. You should see a menu bar, a tab bar, a lone button with a checkmark, the OK/Cancel/Apply buttons, and some information about the script. Let's digest this step by step.
The Main Body of the dialog
[edit | edit source]Every tab on the tab bar has the same three items, no matter what. A menu bar, a text area, and three buttons. The OK button saves changes you've made and closes the editor. The Cancel button saves nothing and exits. If you have made changes, it will ask you to save them. Apply saves changes but doesn't close the editor.
The Tabs
[edit | edit source]Each tab has three things. A large text field where you enter your scripts, tab specific menu commands (if any; see section The Menu Bar), and text containing file information. The text on the left tells you which file you are viewing. The other side shows your text position and the file size. The text position is in the format character:line/total lines. So if it reads 12:15/40, you are 12 characters into the 15th line out of 40 lines in the entire script. This is really helpful only in very large scripts several hundred lines long when trying to find errors on a certain line. Nonetheless, it is always there to look at.
- Aliases - This tab is for aliases, commands that stand for one or more other commands. An example of an alias would be: hello msg $active Hello, I'm $me $+ .
- Popups - The popups section contains custom popup menus.
- Remotes - The bulk of the time you spend in the script editor will be here, in the remote section, where remote events are placed.
- Users - The users tab contains user levels for restricting remote event access.
- Variables - The variables tab stores the values of global variables made using the /set command.
The "Bracket Check" Button
[edit | edit source]One notable mention on the tab bar, besides the tabs, is the lone button with a checkmark on it. This button is incredibly useful. In mIRC scripting, chances are when a script has an error, there is a missing opening or closing brace (the { and } are what we call "braces" or "brackets"). This button will check them and let you know if you have a bracket error.
The Menu Bar
[edit | edit source]The menu bar is the bar at the top of the screen just under the title bar. There are six menus: File, Edit, View, Listen, Options, and Help. Most of the important script editor functions can be found here. There should be a lot of commands familiar to computer users, such as Save, Open, Undo, Cut, and Paste, but we'll go over everything anyways. You don't have to memorize these, but it's worth a quick read. You can also come back here any time and reference this if you are unsure what a menu item does.
- File
- New – Creates a new script file. This command is disabled in the Popups, Users, and Variables tabs.
- Load – Load a new script file into the current tab.
- Unload – Unload a script file from the current tab. This command is disabled in the Popups, Users, and Variables tabs.
- Save – Save changes to the current script file.
- Save As – Save changes to the script as a different file.
- Save All – Save changes to all script files under a tab.
- Order – Change the processing order of the loaded scripts. This command is disabled in the Popups, Users, and Variables tabs.
- Font – Change the style and the size of the font used in the editor here.
- Save and Exit – Save your changes and exit the editor.
- Edit
- Undo – Undo the last changes you made to a script.
- Redo – The opposite of undo.
- Cut/Copy/Paste – Cut removes selected text in a script, and copy makes a copy of it. Paste puts that text back in the document.
- Delete – Deletes selected text, if any.
- Select All – Selects all text on the page.
- Check Brackets – Serves the same function as the check brackets button. This command is disabled in the Users tab and not available in the Variables tab.
- Sort Variables – Alphabetically sorts all your global variables. This command is not available in the Aliases, Popups, Remote, and users tabs.
- Goto line – Go to any line in the script.
- More Files – If you have a lot of script files loaded, this command will show you a whole list of them to view. This command is disabled in the Popups, Users, and Variables tabs.
- Find – Finds whatever text you enter wherever it shows up in the script. It always goes down from where your cursor is, so for best results, move to the top of the script before searching. If nothing is found, you'll hear a ding.
- Find Next – Find next is identical to Find, except it finds the next occurrence of text. Again, if nothing is found, it will make a ding.
- View
- The View menu is a special menu. It doesn't have a set list of commands for every tab, (except for the Popups tab). Four of the tabs simply have a list of script files loaded. The Aliases tab shows a list of alias files, and the Remote, Users, and Variables tabs show a list of remote scripts. However, the Popups tab is a special case. It has five options: Status, Channel, Query, Menu Bar, Nicklist. The Status, Channel, and Query popups all open in their respective windows when you right-click. The Nick List and Menu Bar popups each alter the menus that show up when you right-click on the nicklist or Menu Bar.
- Alias – Only appears on Aliases tab.
- The Alias menu shows you a list of aliases you have entered alphabetically.
- Popup – Only appears on Popups tab.
- The Popup menu is loaded with whatever popup you are viewing.
- Listen
- This menu lets you change the settings for what events to listen for. You can listen for CTCPs, remote events, and raw events.
- Options
- Initialization Warning – A fairly annoying option that pops up a warning box when you load a script that has an On START or an On LOAD event that wants to execute code. As a general rule, you shouldn't be running code you don't understand anyways, so turning this off would be helpful.
- Ask to Save Files – If you try to close the script editor after you've changed a script, this will ask you to save if turned on.
- Backup File on Save – Quite self-explanatory, this will make a backup file when you save the script.
- Show on Desktop – This will make the script editor appear on the taskbar and as its own window, instead of being a child window of mIRC.
- Always on Top – Another self-explanatory option, this will keep the mIRC Script Editor on top of all other open windows.
- Default Level: x – The default level to use in an event when * is the event level, such as On *:Start:. You probably should NOT change this, as the default level of 1 works fine and it will most likely screw up a script using a * level.
- Help
- Contents – Opens the help file contents page.
- Search – Search the help file for certain keywords.
- Topic-specific help – Clicking on the items below Search will open the help file to a certain page depending on what you clicked on. Available topics are Aliases, Commands, Identifiers, If-Then-Else, Popups, Remote, and Variables.