Misplaced Pages

Versus programming language: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 01:21, 14 February 2009 editTothwolf (talk | contribs)Autopatrolled, Extended confirmed users, File movers, Pending changes reviewers, Rollbackers10,326 edits Added {{IRC footer}} template footer← Previous edit Revision as of 23:25, 30 September 2009 edit undoMiami33139 (talk | contribs)6,175 edits Proposing article for deletion per WP:PROD. (TW)Next edit →
Line 1: Line 1:
{{dated prod|concern = Non-notable scripting language for a barely notable software product. No references.|month = September|day = 30|year = 2009|time = 23:25|timestamp = 20090930232514}}
<!-- Do not use the "dated prod" template directly; the above line is generated by "subst:prod|reason" -->
'''Versus''' is a ] originally developed for the ] ] ], and currently used with ]. It is similar in many ways to the scripting languages used by ] and ], as well as ] and ]. '''Versus''' is a ] originally developed for the ] ] ], and currently used with ]. It is similar in many ways to the scripting languages used by ] and ], as well as ] and ].



Revision as of 23:25, 30 September 2009

It is proposed that this article be deleted because of the following concern:

Non-notable scripting language for a barely notable software product. No references.

If you can address this concern by improving, copyediting, sourcing, renaming, or merging the page, please edit this page and do so. You may remove this message if you improve the article or otherwise object to deletion for any reason. Although not required, you are encouraged to explain why you object to the deletion, either in your edit summary or on the talk page. If this template is removed, do not replace it.

This message has remained in place for seven days, so the article may be deleted without further notice.

If you created the article, please don't be offended. Instead, consider improving the article so that it is acceptable according to the deletion policy.
Find sources: "Versus programming language" – news · newspapers · books · scholar · JSTOR
PRODExpired+%5B%5BWP%3APROD%7CPROD%5D%5D%2C+concern+was%3A+Non-notable+scripting+language+for+a+barely+notable+software+product.++No+references.Expired ], concern was: Non-notable scripting language for a barely notable software product. No references.
Nominator: Please consider notifying the author/project: {{subst:proposed deletion notify|Versus programming language|concern=Non-notable scripting language for a barely notable software product. No references.}} ~~~~
Timestamp: 20090930232514 23:25, 30 September 2009 (UTC)
Administrators: delete

Versus is a scripting language 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.

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 statements 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 subroutines. 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, methods, a constructor, and a destructor.
  • Events are used to handle messages from the IRC server, as well as certain system- or client-level occurrences, such as completing a file transfer or opening a new window.
    • Server events use regular expressions or Versus's own wildcard characters 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).
  • Menu trees and menu items define the context menus 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 toolbars 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.

Data storage

Files

  • Scripts can access files with the functions $RandomRead() and $ReadLine(), and the commands CreateFile and AppendText.
  • Scripts can also use the TStringList VCL class to read an entire text file into memory, manipulate it, and save it.

Variables

  • All variables may contain up to 4 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 arrays 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 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

External links

Internet Relay Chat (IRC)
Common terms
Related protocols
Networks
Technology
See also
Clients
macOS
Microsoft Windows
Unix-like
Cross-platform
Multi-IM
Web-based
Web browser components
Library and plug-ins
Category
Categories: