Visual IRC
Encyclopedia
Visual IRC is an open source
Internet Relay Chat
client for the Windows
operating system. Unlike many other IRC clients, nearly all of the functionality in ViRC is driven by the included script
, with the result that the program's behavior can be extended or changed without altering the source code
.
Much of the source code to BIRC, ViRC 2, and the related utilities has been released under the GPL
through the project's web site and SourceForge
.
originally developed for the IRC client Bisual IRC, and currently used with Visual IRC. It is similar in many ways to the scripting languages used by ircII
and mIRC
, as well as Tcl
and C
.
The name "Versus" was chosen because it could be shortened to "VS", which was a common abbreviation for ViRCScript, the language used by Visual IRC '96 through '98. Versus remained mostly backward compatible
with ViRCScript, so existing documentation and commentary that mentioned "VS" remained mostly accurate when applied to Versus. The name also alluded to BIRC's origins as a replacement for ViRC.
Object Versus, or OVS, refers to the object-oriented
features of Versus. Scripts can define classes
and work with objects and methods instead of textual data and aliases
; however, in practice, OVS is mostly used to manipulate the VCL
objects that make up ViRC's interface.
s to be interpreted when the script is loaded; any blocks defined in a script (see below) will replace blocks defined with the same name by previous scripts.
Aliases, methods (including constructors and destructors), events, menu items, and toolbar items are referred to as routines or code blocks.
Here is an example to count to ten:
Here is an example to make everyone in the current channel an operator:
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
Internet Relay Chat
Internet Relay Chat
Internet Relay Chat is a protocol for real-time Internet text messaging or synchronous conferencing. It is mainly designed for group communication in discussion forums, called channels, but also allows one-to-one communication via private message as well as chat and data transfer, including file...
client for the Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
operating system. Unlike many other IRC clients, nearly all of the functionality in ViRC is driven by the included script
IRC script
IRC scripts are a way of shortening commands and responding automatically to certain events while connected to an IRC Network. There are many different scripting languages for different types of IRC clients: ircII, BitchX, XChat, mIRC, Visual IRC, Bersirc, and others have their own scripting...
, with the result that the program's behavior can be extended or changed without altering the source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...
.
History
- Visual IRC (16-bit) - Released in 1995 for Windows 3.x, written by MeGALiTH. This programComputer programA computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
had many built-in features, but it was also scriptable with VPL (ViRC Programming Language), the predecessor to ViRCScript and Versus.
- Visual IRC '96 (and later Visual IRC '97, Visual IRC '98) - Released in 1996, written by MeGALiTH. This was the first 32-bit version of ViRC, written for Windows 9x/NT. Many of the features that were built into 16-bit ViRC were handled by the default script in ViRC '96. ViRC '98 contained some code contributed by Jesse McGrew AKA "Mr2001", particularly enhancements to the ViRCScript engine. The scripting language was incompatible with the earlier version. In later versions, voice chat and video conferencing features were added.
- Development of the second incarnation slowed down, and by 2000, Visual IRC appeared to be dead. The original author MeGALiTH (Adrian Cable) passed the source code to a user, Mr2001 (Jesse McGrew), who had previously contributed some code, and who had secretly been developing a cloneClone (computer science)In computing, a clone is a hardware or software system that is designed to mimic another system. Compatibility with the original system is usually the explicit purpose of cloning hardware or low-level software such as operating systems...
called Bisual IRC (BIRC). Rather than restarting development of the ViRC '98 code base, he merged some of ViRC '98's features into BIRC and released it as Visual IRC 2.
- Visual IRC 2 - First released by Mr2001, coincidentally in 2001, this version's Versus scripting language is based on ViRCScript, but internally it has been almost totally rewritten. In fact, ViRC 2 only shares a few hundred lines of code with ViRC '98. The voice and video conferencing features were removed in this version because the librariesLibrary (computer science)In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....
used to implement them were no longer supported.
Much of the source code to BIRC, ViRC 2, and the related utilities has been released under the GPL
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
through the project's web site and SourceForge
SourceForge
SourceForge Enterprise Edition is a collaborative revision control and software development management system. It provides a front-end to a range of software development lifecycle services and integrates with a number of free software / open source software applications .While originally itself...
.
Versus
Versus is a scripting languageScripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...
originally developed for the IRC client Bisual IRC, and currently used with Visual IRC. It is similar in many ways to the scripting languages used by ircII
IrcII
ircII is a free, open-source Unix IRC and ICB client written in C. Initially released in the late 1980s, it is the oldest IRC client still maintained. Several other UNIX IRC clients, including BitchX, EPIC, and ScrollZ, were originally forks of ircII...
and mIRC
MIRC
mIRC is an Internet Relay Chat client for Microsoft Windows, created in 1995 and developed by Khaled Mardam-Bey. Although it is a fully functional chat utility, its integrated scripting language makes it extensible and versatile....
, as well as Tcl
Tcl
Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...
and C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
.
The name "Versus" was chosen because it could be shortened to "VS", which was a common abbreviation for ViRCScript, the language used by Visual IRC '96 through '98. Versus remained mostly backward compatible
Backward compatibility
In the context of telecommunications and computing, a device or technology is said to be backward or downward compatible if it can work with input generated by an older device...
with ViRCScript, so existing documentation and commentary that mentioned "VS" remained mostly accurate when applied to Versus. The name also alluded to BIRC's origins as a replacement for ViRC.
Object Versus, or OVS, refers to the object-oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
features of Versus. Scripts can define classes
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...
and work with objects and methods instead of textual data and aliases
IRC script
IRC scripts are a way of shortening commands and responding automatically to certain events while connected to an IRC Network. There are many different scripting languages for different types of IRC clients: ircII, BitchX, XChat, mIRC, Visual IRC, Bersirc, and others have their own scripting...
; however, in practice, OVS is mostly used to manipulate the VCL
Visual Component Library
VCL is a visual component-based object-oriented framework for developing Microsoft Windows applications. It was developed by Borland for use in, and tightly integrated with, its Delphi and C++Builder RAD tools...
objects that make up ViRC's interface.
Script storage
Scripts are stored in files, usually with a .vsc file extension, though the .lib extension is sometimes used. A Versus script file simply contains statementStatement (programming)
In computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components .Many languages In computer programming...
s to be interpreted when the script is loaded; any blocks defined in a script (see below) will replace blocks defined with the same name by previous scripts.
Blocks that can be defined in a script
- Aliases are subroutineSubroutineIn computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....
s. They can be called from the command entry line of any window, or from other parts of the script. Aliases that return a value are called functions; an alias can determine whether it's expected to return a value, and then act as a function or a command appropriately. - Classes are used in object-oriented scripting (OVS). Each class may contain properties, methodMethod (computer science)In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...
s, a constructorConstructor (computer science)In object-oriented programming, a constructor in a class is a special type of subroutine called at the creation of an object. It prepares the new object for use, often accepting parameters which the constructor uses to set any member variables required when the object is first created...
, and a destructorDestructor (computer science)In object-oriented programming, a destructor is a method which is automatically invoked when the object is destroyed...
. - Events are used to handle messages from the IRC serverServer (computing)In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...
, as well as certain system- or client-level occurrences, such as completing a file transferDirect Client-to-ClientDirect Client-to-Client is an IRC-related sub-protocol enabling peers to interconnect using an IRC server for handshaking in order to exchange files or perform non-relayed chats. Once established, a typical DCC session runs independently from the IRC server. Originally designed to be used with...
or opening a new window.- Server events use regular expressionRegular expressionIn computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...
s or Versus's own wildcard characterWildcard character-Telecommunication:In telecommunications, a wildcard character is a character that may be substituted for any of a defined subset of all possible characters....
s to match messages from the server. If multiple server events match a particular message, only the one with the highest priority (calculated from the length of the pattern and the relative "value" of the wildcards therein) will be executed. - Client events are identified by name: for example, <OnCreateWindow_foo> and <OnCreateWindow_bar> will both run when a new window is opened. They can also include patterns, which limit the particular occurrences that can trigger that event (for example, to only run when a new channel window is created).
- Server events use regular expression
- Menu trees and menu items define the context menuContext menuA context menu is a menu in a graphical user interface that appears upon user interaction, such as a right mouse click or middle click mouse operation...
s that can appear for various elements of the client's interface, as well as the main menu which is always visible. Menu tree blocks define the menu's layout and set captions for each item; menu item blocks define the script code to be executed when an item is clicked. - Toolbars and toolbar items are similar to menu tree and menu item blocks, but they define the toolbarToolbarIn a graphical user interface, on a computer monitor, a toolbar is a GUI widget on which on-screen buttons, icons, menus, or other input or output elements are placed. Toolbars are seen in office suites, graphics editors, and web browsers...
s associated with each window. New toolbars can be added to the interface simply by choosing a unique name.
Aliases, methods (including constructors and destructors), events, menu items, and toolbar items are referred to as routines or code blocks.
Files
- Scripts can access files with the functions $RandomRead and $ReadLine, and the commands CreateFile and AppendText.
- Scripts can also use the TStringList VCLVisual Component LibraryVCL is a visual component-based object-oriented framework for developing Microsoft Windows applications. It was developed by Borland for use in, and tightly integrated with, its Delphi and C++Builder RAD tools...
class to read an entire text file into memory, manipulate it, and save it.
Variables
- All variables may contain up to 4 GiBGibibyteThe gibibyte is a standards-based binary multiple of the byte, a unit of digital information storage. The gibibyte unit symbol is GiB....
of data. - Variable names begin with a dollar sign ($) and an uppercase letter, lowercase letter, or underscore.
- Variables may contain any characters, although they are usually used for printable text.
- Local variables are set with the
@L
command and only exist in the context of the routine that created them. They are deleted when the routine ends. Some local variables are predefined, such as $C for the current channel's name. - Global variables are set with the
@
command and can be accessed from any routine. They are deleted when the client exits. Aliases may return a value by setting the global variable $fresult. - Stored variables are set with the
@S
command and, like global variables, can be accessed anywhere. Their values are saved to persistent storage immediately, and restored the next time the client starts.
Associative arrays
- Associative arrayAssociative arrayIn computer science, an associative array is an abstract data type composed of a collection of pairs, such that each possible key appears at most once in the collection....
s map keys to values. - Keys and values can contain up to 4 GiB of data with no limits on the allowed characters.
- Local, global, and stored array values can be set using the
@L
,@
, and@S
commands, and they behave just like the corresponding variables. When a stored array value is set, the entire array is saved. - The syntax
$arrayname[key]
is used to set or retrieve the value for a particular key. - The syntax
$arrayname
alone treats an array as a list of key-value pairs, allowing a script to set the entire contents of an array at once, or iterate through the keys that are already present.
Pseudovariables
- Pseudovariables (or pvars) are similar in syntax to variables, but their values cannot be changed.
- The pvars $0 through $9 contain the parameters that were passed to the current routine, in order. $0 contains the routine's name, $1 contains the first word of the parameter string, and so on.
- The pvars $0- through $9- contain the parameters that were passed to the current routine, plus all following parameters. $0- contains the routine's name and the entire parameter string, $1- contains all parameters, $2- contains all parameters after the first, and so on.
- The special sequence
$?="PROMPT STRING"
causes a dialog box to appear, prompting the user to enter a value.
Code examples
Here is the Hello World code example:Alias HELLO
TextOut > $C clBlack Hello, world!
EndAlias
Here is an example to count to ten:
Alias TEN
for (@l $i = 1; $i <= 10; $i++)
TextOut > $C clBlack $i
endfor
EndAlias
Here is an example to make everyone in the current channel an operator:
Alias MASSOP
foreach ($a,$b,$c,$d; $nicklist($C))
Mode $C +oooo $a $b $c $d
endforeach
EndAlias