Hack 30 Add Your IRC Nickname to Your Webcam


you're doing. With a little IRC scripting, show
people your current nickname, too. Webcams are the best
way to let people know exactly what you're
doingafter all, a picture is worth a thousand words, or so
they say. Adding extra text to your webcam image can reveal a lot
more, particularly if you are not there to be seen. This hack shows
you how to display your current IRC nickname on your webcam image.The Windows webcam software used
in this hack is Dorgem. This unusual name
doesn't actually mean anything; it is a combination
of letters that could sound like a word and
didn't return any results on search engines at the
time of its creation. So the chances are that if you Google this,
you'll be able to find it easily. If not, you can
download it from http://dorgem.sourceforge.net.One useful feature of Dorgem is that it allows you to overlay
captions on your webcam image. These captions can be either bitmap
images or plain text. If you go for the plain text option, you can
choose to overlay a string that you type in, or tell it to read the
contents of a file. The latter choice allows you to include whatever
text is in the file, so you can easily create a script for your IRC
client that updates the file with your current nickname.
4.15.1 Writing Your Nickname to a File
As this hack is to run on a Windows machine, it will use mIRC as the IRC
client. To update the contents of the file every time you change your
nickname, it's going to be necessary to trap that
event. The easiest way of doing this is to override
mIRC's
/nick command so that it saves the new
nickname in a file.Open up the mIRC Scripts Editor (Tools
and select the Aliases tab. Now create the alias for the
/nick command shown in Figure 4-29.
Figure 4-29. Modifying the behavior of mIRC's /nick command

sequence of three other commands to be executed instead. The first of
these passes the $1 variable to the
/nick command. $1 is the first
argument that is supplied to your alias, so this has the effect of
changing your nickname as usual.The second line echoes a string to your active window so you can
receive a confirmation of what your webcam message will say.
$2- is a variable that refers to the second
argument, including everything after it. This means you can add some
more details after your nickname, and they will also be included in
this message.The third line writes the same message to a file. The
-c means that the file will be cleared before it
is written to. In this example, the message will be written to
c:\temp\nick.txt.The alias lets you add extra parameters to the
/nick command in case you want to add more detail
to your webcam message. For example, if Paul
wants to change his nickname to Paul|desk-less,
he can do so in the usual way by entering:
/nick Paul|desk-lessThis would cause nick.txt to contain:
Current IRC nick: Paul|desk-less ...If he wanted to include some more information about his nickname, he
could simply add some more details after the /nick
command:
/nick Paul|desk-less they came and stole my desk :(This would cause nick.txt to contain:
Current IRC nick: Paul|desk-less ... they came and stole my desk :(Now that you've configured your IRC client to keep
this file up-to-date, you just have to set up Dorgem to display its
contents on your webcam image.
4.15.2 Displaying File Contents in Dorgem
Assuming Dorgem is up and running properly,
you can add a caption to the webcam image by clicking on the
Caption Settings button, as shown in Figure 4-30.
Figure 4-30. The main Dorgem window

new caption overlay. When prompted, select a
Text caption and click on
OK.
Figure 4-31. Adding a new type of caption

Figure 4-32, give the caption a meaningful name,
such as "IRC nick." This will not
appear on the webcam image, but it will help you work out what this
caption is used for if you end up adding any others.Make sure the Enable checkbox is checked and
that the length is set to 0 (unlimited). Enter the filename in the
File box. For best results, you should make the
text transparent, otherwise it will be printed on an opaque
rectangle. If you want to make it stand out better, you could add a
full shadow and use a contrasting color for background and
foreground.
Figure 4-32. Setting up the caption to read from a file

Caption Position dialog, as shown in Figure 4-33. This example places the caption at the bottom
right of the webcam image. If you know the dimensions of your webcam
image, you can even experiment with absolute positioning.
Figure 4-33. Setting the position of the caption

4.15.3 The Results
Figure 4-34 shows the final results: a webcam image
with the user's current IRC nickname and
personalized message in the bottom right.
Figure 4-34. The webcam image with IRC nickname and message

guessing what you're up to when
you're not there.