21 Maret 2008

2.8 Further into ircII Wizardry

2.8 Further into ircII Wizardry
Note: This part should be reserved for experienced IRC'ers.

Because ircII is not a simple client program, but an Operating System, its programming language is just as simple as you could expect (it's horrendous), but if you want to get into it, here's a little note for you.

There are a few Unix environment variables you can set in your shell configuration file, but you need to find out your shell name before that. "echo $SHELL" should give you a hint.

Table 12: Setting environment variables
----------------------------------------
Shell type Shell name Command
~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~
Bourne shells sh $ VARNAME="value" ; export VARNAME
ksh $ export VARNAME="value"
bash $ export VARNAME="value"
C-shells csh % setenv VARNAME "value"
tcsh > setenv VARNAME "value"


Table 13: Environment variables
--------------------------------
Name Effects
~~~~ ~~~~~~~
HOME where your home directory is
IRCNAME any lunacy you want instead of your real name
(text that appears between parentheses in a WHOIS)
IRCNICK your default IRC nickname
IRCPATH a directory path to LOAD scripts
IRCRC a file to use instead of your $HOME/.ircrc
IRCSERVER a default server list for ircII
TERM your terminal type

The command character, (usually "/irchelp/"), is only necessary when you type commands interactively. When you program things it is no longer needed although it used to be.

Table 14: Advanced commands
---------------------------
Keyword Action
~~~~~~~ ~~~~~~
# same as COMMENT except for the lenght
@ performs variable expressions
ALIAS creates command aliases
ASSIGN creates user variables (expandable with $)
BIND binds a keystroke sequence to a function

CD changes ircII working directory
COMMENT does nothing, but very useful. Strange, uh?
ECHO displays all of its arguments
EXEC allows you to start subprocesses
FLUSH flushes all pending output from the server

IF standard boolean expression checker
LOAD loads an ircII command script file
ON sets up actions to occur when certain events happen
REDIRECT forwards the output from a command
SAVE saves all ircII settings into a file

SAY same as sending text to a channel
SEND same as sending text to a channel
SET sets a variable to a given value
SLEEP suspends ircII for a few seconds
TYPE simulates keystrokes

WAIT waits for all server output to finish
WHILE another control command to make loops
WINDOW lets you manipulate multiple "windows" in ircII
XECHO like ECHO, but takes flag arguments

If you want to type to the channel from within an ALIAS or on BINDing, you have to use SAY or SEND.

The ";" has a special meaning in ALIASes, BINDings and ONs: it's treated as command separator, that means you can execute multiple commands in a row separated by semicolons. The semicolons are not considered separators when you use them interactively, (to be able to type ";-)"), and within an ircII script file. You can escape the meaning of ";" in an ALIAS with "\;".

When you use ircII on a (semi)regular basis, you will discover that every time you start the program you will issue the same initialization sequence. If that is the case, I have good news for you: you don't have to do that anymore! ircII will, at startup, load a file called ".ircrc", (full path: $HOME/.ircrc). It will treat each line in that file as if you typed it manually.

For example, if the content of your .ircrc file is:

JOIN #Twilight_Zone

then each time you will start IRC, you will join this channel.

Advanced commands may come in handy if you need them. Feel free to browse in ircII online help to find out more about them. A few of them are probably worth learning.

0 komentar: