Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Inform
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== The Inform 6 programming language === The Inform programming language is [[Object-oriented programming|object-oriented]] and [[procedural programming|procedural]]. A key element of the language is objects. Objects are maintained in an object tree which lists the parent–child relationships between objects. Since the parent–child relationship is often used to represent location, an object which is the parent of another object is often said to "hold" it. Objects can be moved throughout the tree. Typically, top level objects represent rooms and other locations within the game, which may hold objects representing the room's contents, be they physical items, non-player characters, the player's character, or background effects. All objects can hold other objects, so a <code>livingroom</code> object might hold an <code>insurancesaleman</code> object which is holding a <code>briefcase</code> object which contains the <code>insurancepaperwork</code> object. In early versions of Inform, objects were different from the notion of objects from object-oriented programming, in that there was no such thing as a class. Later versions added support for class definitions and allowed objects to be members of classes. Objects and classes can inherit from multiple classes. Interactive fiction games typically contain many unique objects. Because of this, many objects in Inform do not inherit from any class, other than the "metaclass" Object. However, objects very frequently have attributes (boolean properties, such as <code>scenery</code> or <code>edible</code>) that are recognized by the Inform library. In other languages this would normally be implemented via inheritance. Here is a simple example of Inform 6 source code. <syntaxhighlight lang="inform6"> ! Square brackets define a routine. This is the Main routine, which takes no arguments. [ Main; print "Hello, World!^"; ]; </syntaxhighlight> The procedual parts, statements and operators, are largely borrowed from C, with the notable exception that {{code|-->x}} instead of {{code|[x]}} is used to take array subscripts. Routines are defined in square brackets, as in the {{code|Main}} routine above,<ref name=Plotkin/> but called with round brackets as in C. The character {{code|@}} is used to [[escape character]]s and to invoke raw Z-machine opcodes.<ref>{{cite web |title=The Inform Designer's Manual, v4, Contents |url=https://www.inform-fiction.org/manual/html/contents.html |website=www.inform-fiction.org}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)