Scripting     Basics    AppleScript     IrcII scripting
Version History

Snak Manual

Connecting to a server
Joining channels
Sending messages
Keeping track of people
Customization and settings
Using DCC
IRC commands



Understanding scripting will give you a handy set of new abilities and ways to use Snak. In many cases you can use an Action to automate Snak's behavior but there are things that go beyond the capabilities of an Action. For those cases, knowledge of regular scripting will be useful.

You can use scripting to complement or even replace some of the built in commands with aliases to provide enhanced functionality. Snak looks for script files in the Scripts folder. The Scripts folder is found in the Application Support folder. You can use the menu item in Window menu to open the folder directly.

A script can be a mini-program with variables and functions, a simple command alias, an entry in the Tools menu or a command to run in an Action. An alias complements the built-in commands and is used the same way, but it is still a script. The term simply refers to a sequence of program instructions.

Snak supports two different scripting languages - AppleScript and ircII (pronounced irk 2) and come with extensive examples of scripts written in both languages.

The two languages differ in their focus, their access to the internal data of Snak, their ease of use and their speed, but you can use scripts written in both languages side by side to get the most benefits of both environments.

Scripts in the ircII language are regular text files that can easily be edited with a text editor, like BBEdit or even SimpleText. If you edit them in a word processor, please take care to save the files as pure text without formatting or they will become unusable.

AppleScripts are created with the Script Editor application that comes with the Macintosh OS. There are also third party script editors and debuggers available that will let you examine a script while it's running to easily debug it.

IMPORTANT: AppleScripts must be saved in compiled form in order for Snak to use them.

For both types of scripts, be sure not to include spaces in the filename under which you save them. You can use the Command Reference from the Help menu to get a full listing of all the loaded scripts and commands.

Each connection maintains its own list of loaded scripts, so that you can modify the behavior and use of each connection. For example, one connection could be used to run an automated service, called a bot and another could be used normally.

Standard script files

When you open a connection, the program will automatically read in the contents of the basical and action script files from the Scripts folder. These files contain aliases that extends the built-in command set and serves as examples of how to extend and modify Snak's behavior. The files have informative comments and explanations to help you understand what is going on.

The /msg and /query aliases in the script file called basical are examples of command aliases. They redefine the built in commands of the same names to allow you to use abbreviated nicks for the people you send private messages to. Aliases are also used to provide shortcuts for frequently used commands like /join. For examples the /j alias simply calls the /join command.

The script file action contains a number of small scripts to provide atmosphere, like /sing, /shiver, /slap and many more.

Included with Snak is a complete script package called PurePak, which contains extensive functionality for both channel operators and normal IRC users. It can maintain list of friends and enemies on IRC that can be set up to auto-op friends and try to avoid enemies. It has functions for channel management, and file exchange, and it comes with extensive built-in help. To load purepak, type "/load purepak.irc" and notice the intro messages that come up. The built-in help is accessed with /pphelp and an optional topic like /pphelp main.

Scripts can be complex multi-line programs like PurePak or they can be simple abbreviations of frequently used commands. You are encouraged to study the example script files that come with the program to learn details.

Snak also come with a large number of scripts written in AppleScript. Please see the read me files in the Scripts folder for more information. The Musical script is an extensive package for controlling iTunes from Snak, and for broadcasting information about what songs you are listening to. It can listen for specific messages containing an artist name or song title. If it finds such messages it will instruct iTunes to play the appropriate song. The script comes with its own read me file with full instructions.


Snak is Copyright © 1997-2006 Kent Sorensen. All Rights Reserved.
Logo design by energetics-design.