User:IceCreamJonsey

From IFWiki
Jump to: navigation, search

Template:Infobox programming language

Hugo is a programming language and design system for interactive fiction<ref>Template:Cite web</ref><ref>Template:Cite web</ref> created by Kent Tessman. It features development and run-time support for Windows,<ref>Template:Cite web</ref> OSX<ref>Template:Cite web</ref> and Linux<ref>Template:Cite web</ref>/Unix<ref>Template:Cite web</ref> operating systems and a JavaScript interpreter.<ref>Template:Cite web</ref><ref>Template:Cite web</ref> It is known as one of the easier languages for running and playing interactive fiction.<ref>Template:Cite web</ref> Hugo was part of a wave of community created interactive fiction programming languages that enabled text and multimedia<ref>Template:Cite book</ref> to be displayed simultaneously, along with Glux and HTML-TADS.<ref>Template:Cite web</ref><ref>Jackson-Mead, Kevin, and Wheeler, J. Robinson (eds.) (2011) IF Theory Reader. Boston, MA: Transcript On Press</ref>

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.

The language is not case sensitive,<ref>http://hugo.gerynarsabode.org/index.php?title=Identifier</ref> although much of the code base in 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<ref>http://hugo.gerynarsabode.org/index.php?title=Routine</ref> 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<ref>http://hugo.gerynarsabode.org/index.php?title=Init</ref> and one named main.<ref>http://hugo.gerynarsabode.org/index.php?title=Main</ref> 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

<syntaxhighlight lang="text"> verb "incinerate"

  *                           DoIncinerate
  * object                    DoIncinerate
  * "me"                      DoSuicide

</syntaxhighlight>

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.<ref>http://hugo.gerynarsabode.org/index.php?title=Attributes</ref> 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:

<syntaxhighlight lang="text"> Attribute wet attribute female attribute cold attribute hard </syntaxhighlight>

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

<syntaxhighlight lang="text"> property color property weight 30 property size 4 property comment "whoa" </syntaxhighlight>

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

<syntaxhighlight lang="text"> object table "Kitchen Table" {

 is hard
 is not female
 color brown
 size 10

} </syntaxhighlight>

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:

<syntaxhighlight lang="text"> routine DoSuicide {

  "I can't allow you to do this,";
  print player.name;"."

} </syntaxhighlight>

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:

<syntaxhighlight lang="c">

  if (table is cold)
  {
 ... other code ...
  } else {
    if (table is not hard) {
 ... other code ...
    }
  }

</syntaxhighlight>

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.

One of the "most powerful"<ref>Template:Cite web</ref> of the cross-platform options for developing Interactive Fiction, classics such as Colossal Cave<ref>Template:Cite web</ref>, and Zork<ref>Template:Cite web</ref> <ref name="hugozork">Template:Cite newsgroup</ref> have been ported to Hugo.

Hugo is customizable with third-party library extensions,<ref>Template:Cite web</ref> and a JavaScript online interpreter for Hugo games<ref>Template:Cite web</ref> was announced at Wordplay London<ref>Template:Cite news</ref><ref>Template:Cite news</ref> on November 16, 2016.<ref>Template:Cite news</ref>

See also

Notable games written in Hugo

References

"Hugo: An Interactive Fiction Design System by Kent Tessman" (PDF). 2004. Retrieved 2016-12-19.

Jump up ^ http://tracks.ranea.org/post/47146430669/kent-tessmans-name-keeps-coming-up-at-least-if Jump up ^ http://brasslantern.org/community/history/timeline-c.html Jump up ^ http://www.bioeddie.co.uk/Psion/main/emulators.htm Jump up ^ https://www.audiogames.net/page.php?pagefile=_Audyssey_Magazine_issue_24_-_July_-_August_2000_ Jump up ^ https://github.com/HaikuArchives/BeHugo Jump up ^ https://joomla.iscomputeron.com/index.php/441-superman-was-yesterday-future-boy-is-tomorrow Jump up ^ http://ifdb.tads.org/opsys?id=10 Jump up ^ http://www.generalcoffee.com/hugo/gethugo.html#macintosh Jump up ^ http://www.gryphel.com/c/sw/other/ Jump up ^ Hugo Downloads Jump up ^ http://mirrors.ibiblio.org/interactive-fiction/programming/hugo/manuals/hugo_book.pdf Jump up ^ "CIS 487 Description". groups.engin.umd.umich.edu. Retrieved 2016-12-22. Jump up ^ "Game Creation Resources". www.ambrosine.com. Retrieved 2016-12-22. Jump up ^ "realnc/hugor". GitHub. Retrieved 2016-12-22. Jump up ^ "realnc/hugor". GitHub. Retrieved 2016-12-22. Jump up ^ "Hugo Engine and Guilty Bastards for Linux - Slashdot". games.slashdot.org. Retrieved 2016-12-22. Jump up ^ "0branch / hugo-unix — Bitbucket". bitbucket.org. Retrieved 2016-12-22. Jump up ^ "intfiction.org • View topic - Hugo online interpreter and story file parser". www.intfiction.org. Retrieved 2016-12-22. Jump up ^ "juhana/hugojs". GitHub. Retrieved 2016-12-22. Jump up ^ Granade, Stephen. "Brass Lantern Downloading and Running Text Adventures: Hugo, Alan, TADS". brasslantern.org. Retrieved 2016-12-22. Jump up ^ Montfort, Nick (2003). Twisty Little Passages: An Approach to Interactive Fiction. United States of America: The MIT Press. p. 221. ISBN 0-262-13436-5. [T]he more capable cross-platform multimedia system Hugo by Kent Tessman. Jump up ^ "Chapter 9: The Evolution of a Community". maher.filfre.net. Retrieved 2016-12-22. Jump up ^ Jackson-Mead, Kevin, and Wheeler, J. Robinson (eds.) (2011) IF Theory Reader. Boston, MA: Transcript On Press Jump up ^ http://hugo.gerynarsabode.org/index.php?title=Identifier Jump up ^ http://hugo.gerynarsabode.org/index.php?title=Routine Jump up ^ http://hugo.gerynarsabode.org/index.php?title=Init Jump up ^ http://hugo.gerynarsabode.org/index.php?title=Main Jump up ^ http://hugo.gerynarsabode.org/index.php?title=Attributes Jump up ^ "Interactive Fiction FAQ". nickm.com. Retrieved 2016-12-22. Jump up ^ "'Adventure' downloads". rickadams.org. Retrieved 2016-12-22. Jump up ^ "..:: FrobozzMagicCo.com ::..". www.frobozzmagicco.com. Retrieved 2016-12-22. Jump up ^ John Menichelli (1997-09-05). "Hugo Zork". Newsgroup: rec.arts.int-fiction. Usenet: 3410A9C6.4577@pixi.com. Retrieved 2016-12-19. Jump up ^ "Roodylib - Hugo By Example". hugo.gerynarsabode.org. Retrieved 2016-12-22. Jump up ^ Short, Emily (2016-12-21). "IF Only: Looking back at 2016 in Interactive Fiction". Rock, Paper, Shotgun. Retrieved 2016-12-22. Jump up ^ "Emily Short on Twitter". Twitter. Retrieved 2016-12-22. Jump up ^ "Alastair Horne on Twitter". Twitter. Retrieved 2016-12-22. Jump up ^ "Crafting Interactive Fiction Tools". WordPlay London. 2016-11-14. Retrieved 2016-12-22. Jump up ^ "Hugo games". MobyGames. Retrieved 2016-12-22. Jump up ^ Short, Emily (2016-12-21). "IF Only: Looking back at 2016 in Interactive Fiction". Rock, Paper, Shotgun. Retrieved 2016-12-22. Jump up ^ "Future Boy!". The Globe and Mail. Retrieved 2016-12-22. Jump up ^ "Future Boy! review - AdventureGamers.com". www.adventuregamers.com. Retrieved 2016-12-22. Jump up ^ "Macologist :: View topic - Game Review: Future Boy". 2005-04-04. Retrieved 2016-12-22. Jump up ^ Aplin, Gordon (December 2004). "Future Boy!". www.quandaryland.com. Retrieved December 22, 2016. Jump up ^ Underdogs. "Home of the Underdogs". www.homeoftheunderdogs.net. Retrieved 2016-12-22. Jump up ^ "ISSUE #49 - August 18, 2007 - SPAG". www.spagmag.org. Retrieved 2016-12-22. Jump up ^ MacAddict 101. 2016-12-22. Jump up ^ Tessman, Kent (2004-10-22), Future Boy!, retrieved 2016-12-22 Jump up ^ "Grand Text Auto » Future Boy!". Retrieved 2016-12-22. Jump up ^ "IFComp 2006". ifcomp.org. Retrieved 2016-12-22. Jump up ^ "Jimmy Maher's IF Comp 2006 Reviews". maher.filfre.net. Retrieved 2016-12-22. Jump up ^ "Tales of the Traveling Swordsman". www.highprogrammer.com. Retrieved 2016-12-22. Jump up ^ "Caltrops - Tales of the Traveling Swordsman - Pretty damn great.". www.caltrops.com. Retrieved 2016-12-22. Jump up ^ Short, Emily (2008-06-21). "More IF publicity". Emily Short's Interactive Storytelling. Retrieved 2016-12-22. Jump up ^ https://groups.google.com/forum/#!original/rec.games.int-fiction/PEEMwQ2U_OM/yocV3OBZK4wJ Jump up ^ Desilets, Brendan (November 22, 2008). "Teaching IF to Kids -- Game Recommendations". groups.google.com. Retrieved December 22, 2016. Jump up ^ "Top Fifty". 2015-03-06. Retrieved 2016-12-22. Jump up ^ "Hugo games". MobyGames. Retrieved 2016-12-22. Jump up ^ Short, Emily (2016-12-21). "IF Only: Looking back at 2016 in Interactive Fiction". Rock, Paper, Shotgun. Retrieved 2016-12-22. Jump up ^ Smith, Adam (2011-09-21). "Splice Of Life: Cryptozookeeper". Rock, Paper, Shotgun. Retrieved 2016-12-22. Jump up ^ "IF-Review: We Eat The Night, We Drink The Time". www.ministryofpeace.com. Retrieved 2016-12-22.

External links