You are on page 1of 4

Hugo (programming language)

From Wikipedia, the free encyclopedia

Hugo is a programming language and design system for interactive fiction created by Kent Tessman. While not as popular as Inform or TADS, it is still used, particularly for multimedia interactive fiction (as opposed to strict text adventures).

Hugo

Contents
1 Language Construction 1.1 Verbs 1.2 Attributes 1.3 Properties 1.4 Objects 1.5 Routines 1.6 Other features 2 Notable games written in Hugo 3 References 4 External links
Paradigm(s) multiparadigm, procedural, object-oriented, high-level, domain-specific June 1995 Kent Tessman The General Coffee Company Film Productions 3.1.03 (January 10, 2006)

Appeared in Designed by Developer Stable release

Implementation C language Platform OS Acorn, Macintosh, Palm, PC, Pocket PC, Psion Cross-platform: Amiga, BeOS, DOS, OS/2, Palm, EPOC, RISC OS, Unix (Linux, Macintosh), Windows, Windows Mobile[1] Freeware www.generalcoffee.com

Language Construction
The Hugo language is a hybrid of several features to provide a command processing system. The system consists of a verb definition section, a property and attribute definition section, an object definition section, and a code section. One may assign multiple names to the same attribute or property through the alias parameter to an attribute or property.

License Website

The language is not case sensitive, although much of the code base in (http://www.generalcoffee.com) the standard library uses camel case for identifiers. Identifiers must start with a letter, and may contain letters, numbers and underscores. Strings are defined by using a double quote. Where it is necessary to include a double quote in a string, it may be escaped by preceding it with a backslash, i.e. \" . With the exception of quoted strings, lines must be explicitly marked as being continued by having the last character on the line to be a backslash. The system provides for procedures, called a "routine" which may optionally return a value. All executable statements must be within a routine, there is no "default" mode to execute code outside of a routine. Comments may be specified anywhere that white space is acceptable, and are indicated by an exclamation point !. This causes anything remaining on the line from that point to be ignored. A special type of block comment for commenting a large area may be used by having the first two characters on a line begin with the comment !\ and the block comment is closed by the next occurrence of the inverse string \! . Where a "block" is needed - a set of related values or a particular piece of executable code - it is indicated by encasing it in the open brace character { and closing it with the }, similar to the same functionality in the C language. As with a number of other programming languages, Hugo borrows from C for a number of features, including "escaping" some values by preceding them with a backslash, the use of the ++ symbol to increment a variable, and the { and } braces for block begin and block end, as noted earlier. Hugo borrows the use of the "print" command for displaying variables and the use of the semi-colon ( ; ) from the Basic programming language to indicate output that is not to be broken by a new line.

There are two mandatory routines, one named "init" and one named "main." Init is run once when the program starts, and as the name implies, initializes anything the system needs to do. After Init ends, the routine "main" is run on every turn, a "turn" being used in the sense that each command issued by the player is a new turn. The main routine is used to do the typical housekeeping on each turn. The user is prompted for input, the parser processes the input to translate it into a verb and options to the verb, then determine the routine that processes that verb. The routine then returns a set of responses to the verb and options (if any), and the user is then prompted to type in a command. The system requests commands and continues to do so until a routine indicates the program is over. Since the system was originally designed for writing of games, the determination of the program being over is typically because either because the player "won" according to the rules for that game, or because the player "lost".

Verbs
In the verb definition section, one begins by defining each command, known as a "verb" in which the code defines the verb as a quoted string. One then lists, one line at a time, each of the parameters to be used for processing the command issued. For example, if one has a command of "incinerate" one would define a verb such as
v e r b" i n c i n e r a t e " * *o b j e c t *" m e "

D o I n c i n e r a t e D o I n c i n e r a t e D o S u i c i d e

Where the first parameter means that, if the user running the program types the command "incinerate" with no options, it runs the routine "DoIncinerate". If the user types the command "incinerate" and names a defined object, the DoIncinerate routine is run with the default object (whose name is 'object') being assigned the value of whatever object the user selected. If the user types the command "incinerate" followed by the option "me" then the DoSuicide routine is run.

Attributes

The system allows for up to 128 different attributes to be defined. Attributes are true/false values that represent conditions of an object. All attributes defined in a program are available to any object. For example, if an attribute of an object was hot or cold, one could define an attribute for one or the other, then use "not" preceding an attribute to test for the opposite condition. Attributes are defined by the attribute command and the name of the attribute, such as:
A t t r i b u t ew e t a t t r i b u t ef e m a l e a t t r i b u t ec o l d a t t r i b u t eh a r d

One defines an attribute as being possessed by an object by the "is" command, followed by the name of the attribute. To explicitly state that the attribute is not possessed, one indicated by placing "not" before the attribute on the "is" command.

Properties
Properties can contain essentially any value desired, including other objects. While every object contains all defined attributes, an object only contains the properties assigned to it when it is defined. A property may be defined either with or without a value, and is defined by the property command, the name of the property, and the optional value, such as
p r o p e r t yc o l o r p r o p e r t yw e i g h t3 0 p r o p e r t ys i z e4 p r o p e r t yc o m m e n t" w h o a "

Objects

Every thing that can be manipulated in a Hugo program is an object. Objects have attributes and properties. All defined attributes are available to all objects, but each object only has the properties assigned to it when it is created. An object is a block of specifications stating all of the information about it, begins with the object command, the name of the object, an optional descriptive string for the name, a block open symbol (the open brace ( ) the various values to assign to the object, and a block close symbol (the close brace } ). In the following object
o b j e c tt a b l e" K i t c h e nT a b l e " { i sh a r d i sn o tf e m a l e c o l o rb r o w n s i z e1 0 }

The "table" object would have the hard attribute (set to true) and would have the cold, female and wet attributes, which are all false. The object would have been set to "is not female" by default, but explicitly specifying it may be useful, or if the object is a copy of another object but with additional or different properties or differing values for the attributes. The color property of the table object could be referenced through "table.color".

Routines
All action in a Hugo program takes place in a routine. In the example given above, if the user had typed "Incinerate me" the DoSuicide routine would have been executed:
r o u t i n eD o S u i c i d e { " Ic a n ' ta l l o wy o ut od ot h i s , " ; p r i n tp l a y e r . n a m e ; " . " }

A quoted string by itself is treated as an implicit print statement. To print actual values such as the name property (one of about six properties automatically defined by the compiler) it is necessary to specify it through the print command, by specifying the name of the object and the property, separated by the dot ( . ) operator. To reference an attribute, it may be tested in an if statement, like so:
i f( t a b l ei sc o l d ) { . . .o t h e rc o d e. . . }e l s e{ i f( t a b l ei sn o th a r d ){ . . .o t h e rc o d e. . . } }

Other features
The Hugo language also provides for classes, which are more like types of objects than full classes as used in object oriented programming (classes do not have direct methods in Hugo). A property may be a value, an array, or it may represent executable code such as an equivalent to a method in a full object oriented language.

Notable games written in Hugo


Future Boy!, by Kent Tessman (2005), features extensive multimedia. One of the few commercial text adventures published in the modern era. Tales of the Traveling Swordsman, by Mike Snyder (2006). Fourth place in the 2006 Interactive Fiction Competition, the highest a Hugo game has placed. Cryptozookeeper, by Robb Sherwin (2011), winner of five XYZZY Awards in 2011.

References
1. ^ Hugo Downloads (http://www.generalcoffee.com/hugo/gethugo.html)

External links
Official website (http://www.generalcoffee.com) Unofficial support forum at Jolt Country (http://www.joltcountry.com/phpBB2/viewforum.php?f=8) Unofficial tutorial wiki at gerynarsabode (http://hugo.gerynarsabode.org) Cloak of Darkness: Hugo (http://www.firthworks.com/roger/cloak/hugo/index.html) presents a short game implemented in Hugo, as well as other languages for comparison Eddie Park. "Hugo - Create Your Own Text Adventures" (http://www.insidemacgames.com/news/story.php? ArticleID=7979). Inside Mac Games. "if-archive/games/hugo" (http://ifarchive.org/indexes/if-archiveXgamesXhugo.html). IF archive. "Hugor" (http://freecode.com/projects/hugor). Freecode. "Interactive Fiction Game Engine and Editors" (http://ascii-world.wikidot.com/text-adventure-engine). Wikidot. Terry Tompkins. "webHugo 1.0 - Web-based Interactive Fiction System" (http://transwebtools.com/webhugo/index.html). Transweb Tools. "PHPIF - A PHP IF game system for web-based Interactive Fiction" (http://fiziwig.com/intfic/design2.html). Retrieved from "http://en.wikipedia.org/w/index.php?title=Hugo_(programming_language)&oldid=545453601" Categories: 1995 software Domain-specific programming languages Freeware Interactive fiction Text adventure game engines Video game development software This page was last modified on 19 March 2013 at 16:00. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.

You might also like