<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>5 Language</TITLE> <META NAME="description" CONTENT="5 Language"> <META NAME="keywords" CONTENT="ifm"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="ifm.css"> <LINK REL="next" HREF="node9.htm"> <LINK REL="previous" HREF="node7.htm"> <LINK REL="up" HREF="ifm.htm"> <LINK REL="next" HREF="node9.htm"> </HEAD> <BODY > <DIV CLASS="navigation"><!--Navigation Panel--> <A NAME="tex2html274" HREF="node9.htm"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A> <A NAME="tex2html270" HREF="ifm.htm"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A> <A NAME="tex2html264" HREF="node7.htm"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A> <A NAME="tex2html272" HREF="node1.htm"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html275" HREF="node9.htm">6 Diagnostics</A> <B> Up:</B> <A NAME="tex2html271" HREF="ifm.htm">IFM</A> <B> Previous:</B> <A NAME="tex2html265" HREF="node7.htm">4 Using IFM</A> <B> <A NAME="tex2html273" HREF="node1.htm">Contents</A></B> <BR> <BR></DIV> <!--End of Navigation Panel--> <!--Table of Child-Links--> <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A> <UL CLASS="ChildLinks"> <LI><A NAME="tex2html276" HREF="node8.htm#SECTION00081000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Symbols</A> <LI><A NAME="tex2html277" HREF="node8.htm#SECTION00082000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Format</A> <LI><A NAME="tex2html278" HREF="node8.htm#SECTION00083000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> Control</A> <LI><A NAME="tex2html279" HREF="node8.htm#SECTION00084000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN> Tags</A> <LI><A NAME="tex2html280" HREF="node8.htm#SECTION00085000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN> Commands</A> <UL> <LI><A NAME="tex2html281" HREF="node8.htm#SECTION00085100000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Rooms</A> <LI><A NAME="tex2html282" HREF="node8.htm#SECTION00085200000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Items</A> <LI><A NAME="tex2html283" HREF="node8.htm#SECTION00085300000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> Links</A> <LI><A NAME="tex2html284" HREF="node8.htm#SECTION00085400000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN> Joins</A> <LI><A NAME="tex2html285" HREF="node8.htm#SECTION00085500000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN> Tasks</A> </UL> <BR> <LI><A NAME="tex2html286" HREF="node8.htm#SECTION00086000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">6</SPAN> Variables</A> <LI><A NAME="tex2html287" HREF="node8.htm#SECTION00087000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">7</SPAN> Styles</A> <LI><A NAME="tex2html288" HREF="node8.htm#SECTION00088000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">8</SPAN> Expressions</A> <LI><A NAME="tex2html289" HREF="node8.htm#SECTION00089000000000000000"><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">9</SPAN> Preprocessor</A> </UL> <!--End of Table of Child-Links--> <HR> <H1><A NAME="SECTION00080000000000000000"></A><A NAME="sec:language"></A> <BR> <SPAN CLASS="arabic">5</SPAN> Language </H1> <P> This section gives a complete detailed description of the IFM language. <P> <H2><A NAME="SECTION00081000000000000000"></A><A NAME="sec:symbols"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Symbols </H2> <P> In the following sections, these symbols are used: <P> <UL> <LI>[<TT>ID</TT>]A name starting with a letter, followed by any combination of upper- and lowercase letters or numbers or an underscore. For example, <TT>Dense_Forest</TT>. IDs are not allowed to clash with reserved words (e.g. <TT>room</TT>, or <TT>tag</TT>). One way to avoid this is to capitalize all tags (reserved words are all in lowercase). </LI> <LI>[<TT>STRING</TT>]Any sequence of characters, in double-quotes. For example, <TT>"Black Rod"</TT>. To get a double-quote inside a string, quote it using a backslash, like this: <P> <DL COMPACT> <DT> <DD>"Ground Floor, \"A\" Block" </DD> </DL>You can continue strings on several lines--a newline-and-whitespace sequence is translated into a single space, just like in TADS and Inform. <P> Note that dollars (<TT>$</TT>) are special inside strings--they mark the start of a variable substitution. See Section <A HREF="#sec:variables">5.6</A> for details. If you want a literal dollar symbol in a string, use <TT>$$</TT>. <P> </LI> <LI>[<TT>NUMBER</TT>]A number, or an arithmetic expression (see Section <A HREF="#sec:expressions">5.8</A>). If the context requires an integer, the number is silently rounded to the larges integer not greater than this value. </LI> <LI>[<TT>COMPASS</TT>]A compass direction, which can be abbreviated or in full (e.g. <TT>n</TT>, <TT>se</TT>, <TT>northwest</TT>, etc). </LI> <LI>[<TT>OTHERDIR</TT>]One of <TT>up</TT>, <TT>down</TT>, <TT>in</TT> or <TT>out</TT>. </LI> <LI>[<TT>[...]</TT>]An optional part. </LI> <LI>[<TT>A | B</TT>]Either <TT>A</TT> or <TT>B</TT>. </LI> </UL> <P> <H2><A NAME="SECTION00082000000000000000"> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Format</A> </H2> <P> IFM generally has a free-format layout--i.e. whitespace may be placed anywhere to increase readability. The only exception is inside quoted strings, where spaces are significant. Comments may be added, starting with a hash (<TT>#</TT>) and continuing to the end of the line. All commands are terminated with a semicolon. <P> <H2><A NAME="SECTION00083000000000000000"> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> Control</A> </H2> <P> The overall title of the map may be set using the command <P> <DL COMPACT> <DT> <DD>title STRING; </DD> </DL>If a map has several sections, you can set the title of each section using the command <P> <DL COMPACT> <DT> <DD>map STRING; </DD> </DL>This sets the title of the next map section. If you use this command at all, then the number of uses should be the same as the actual number of map sections. It's conventional (but not required) to put the <TT>map</TT> command just before the room that starts a new map section. <P> If your map uses features that are only present in later versions of IFM, you can indicate that up front by using the command <P> <DL COMPACT> <DT> <DD>require NUMBER; </DD> </DL>Then, if the IFM version number is less than this number, parsing will abort immediately, avoiding lots of potentially confusing syntax errors.<A NAME="tex2html11" HREF="footnode.htm#foot1577"><SUP><SPAN CLASS="arabic">8</SPAN></SUP></A> <P> <H2><A NAME="SECTION00084000000000000000"> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN> Tags</A> </H2> <P> All IFM objects may be given tag names, so that you can refer to them in other commands. Tags for different types of object are independent--for example, you could have a room and an item with the same tag. However, tags for similar objects must be unique. <P> In many cases, you are allowed to refer to a tag name anywhere, even earlier in the file that you defined it (as long as the tag is defined somewhere!). Exceptions are the room <TT>from ID</TT> clause (see Section <A HREF="#sec:rooms">5.5.1</A>) and tags in commands that modify existing objects (see Section <A HREF="#sec:commands">5.5</A>)--these tags must be defined before being used. <P> The special tag <TT>last</TT> may be used to refer to the last object that was defined (depending on the context). Also, within an individual command, the special tag <TT>it</TT> may be used to refer to the most recent object tag. <P> <H2><A NAME="SECTION00085000000000000000"></A><A NAME="sec:commands"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN> Commands </H2> <P> There are five different types of object in IFM: rooms, items, links, joins and tasks. Each is created using its own command, the general format of which is: <P> <DL COMPACT> <DT> <DD><type> <body> [attribute-list]; </DD> </DL>For rooms, items and tasks, <TT><body></TT> is just a string description. For links and joins, it specifies two room tags to link or join together. <P> Many of the attributes or objects accept a list of tags as arguments. All of these, if specified more than once in the same object, concatenate the lists together. <P> Once an object as been declared with a tag name, its attributes can be modified by later commands referring to that tag, like this: <P> <DL COMPACT> <DT> <DD><type> ID [attribute-list]; </DD> </DL>where <TT>ID</TT> is the tag name of the object. Note that the tag must be defined earlier in the file than it is used. <P> <H3><A NAME="SECTION00085100000000000000"></A><A NAME="sec:rooms"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">1</SPAN> Rooms </H3> <P> A new room is added using the command <P> <DL COMPACT> <DT> <DD>room STRING [attribute-list]; </DD> </DL>where <TT>STRING</TT> is a description of the room. Room attributes can be: <P> <UL> <LI>[<TT>tag ID</TT>]Give the room a tag name, so that you can refer to it elsewhere. </LI> <LI>[<TT>dir COMPASS [NUMBER] [COMPASS [NUMBER]...] [from</TT>]<TT>ID] </TT> <BR> Specify the position of the room relative to the room with the given tag ID (which must be defined before it is used). If no <TT>from</TT> clause is specified, the last defined room is used instead. There can be more than one direction given--the new room is placed relative to the previous one using them. Following a direction with a number means to repeat it that many times. <P> The <TT>dir</TT> clause creates an implicit link between this room and the previous one. Some of the room attributes below behave differently depending on whether they appear before or after the <TT>dir</TT> clause in the attribute list. <P> If the room is given a tag name, then the implicit link will be given the same tag. <P> </LI> <LI>[<TT>link ID [ID...]</TT>]<TT> </TT> <BR> Specify other rooms that this room links to. Note that this creates a link with no special attributes--use the standalone <TT>link</TT> command for that (see Section <A HREF="#sec:links">5.5.3</A>). </LI> <LI>[<TT>join ID [ID...]</TT>]<TT> </TT> <BR> Specify rooms on other map sections that this room joins to. Note that this creates a join with no special attributes--use the standalone <TT>join</TT> command for that (see Section <A HREF="#sec:joins">5.5.4</A>). </LI> <LI>[<TT>exit COMPASS [COMPASS...]</TT>]<TT> </TT> <BR> Indicate which other directions the room has exits in. Room exits in a particular direction are marked on the map only if there is no link going to or from the room in that direction. </LI> <LI>[<TT>note STRING</TT>]<TT> </TT> <BR> Append a note to the room's note list. </LI> <LI>[<TT>score NUMBER</TT>]<TT> </TT> <BR> Indicate that you score the specified number of points when visiting this room for the first time. </LI> <LI>[<TT>need ID [ID...]</TT>]<TT> </TT> <BR> If this appears before a <TT>dir</TT> clause, indicate that you can only enter this room after getting the specified items. If it appears afterwards, it applies to the implicit link instead. </LI> <LI>[<TT>after ID [ID...]</TT>]<TT> </TT> <BR> If this appears before a <TT>dir</TT> clause, indicate that you can only enter this room after doing the specified tasks. If it appears afterwards, it applies to the implicit link instead. </LI> <LI>[<TT>before ID [ID...]</TT>]<TT> </TT> <BR> If this appears before a <TT>dir</TT> clause, indicate that you can only enter this room before doing the specified tasks. If it appears afterwards, it applies to the implicit link instead. Those tasks are marked unsafe. </LI> <LI>[<TT>leave ID [ID...]</TT>]<TT> </TT> <BR> If this appears before a <TT>dir</TT> clause, indicate that the specified items, if carried, must be left behind when entering the room. If it appears afterwards, it applies to the implicit link instead. </LI> <LI>[<TT>leave all [except ID [ID...]]</TT>]<TT> </TT> <BR> As above, except indicate that <SPAN CLASS="textit">all</SPAN> items must be left behind. The <TT>except</TT> clause can be used to omit specific items. </LI> <LI>[<TT>go OTHERDIR</TT>]<TT> </TT> <BR> Indicate that the link to this room is in the specified direction. </LI> <LI>[<TT>cmd STRING</TT>]<TT> </TT> <BR> Specify the command you type to move to this room from the previous one. If no <TT>cmd</TT> clause is given, the command is deduced from the <TT>go</TT> clause. If that isn't specified, the command will be deduced from the <TT>dir</TT> clause. </LI> <LI>[<TT>cmd from STRING</TT>]<TT> </TT> <BR> As above, but this specifies the command to go in the other direction. This defaults to the <TT>cmd to</TT> command, if specified. </LI> <LI>[<TT>cmd to STRING</TT>]<TT> </TT> <BR> This is identical to <TT>cmd</TT> on its own, and only exists for symmetry. </LI> <LI>[<TT>oneway</TT>]Indicate that the return journey from this room to the previous one is not possible. </LI> <LI>[<TT>length NUMBER</TT>]<TT> </TT> <BR> Indicate that the direction link to this room has the specified length (default 1). This only affects the calculation of the nearest task when solving the game--see Section <A HREF="#sec:tasks">5.5.5</A>. </LI> <LI>[<TT>start</TT>]Indicate that this is the room the player starts in. Default is for the first room mentioned to be the start room. If more than one room has this attribute, the last one declared takes precedence. </LI> <LI>[<TT>finish</TT>]Indicate that entering this room finishes the game. </LI> <LI>[<TT>nodrop</TT>]Indicate that no items should be voluntarily dropped in this room. </LI> <LI>[<TT>nolink</TT>]Indicate that this room does not have an implicit link with the previous one via the <TT>dir</TT> clause. </LI> <LI>[<TT>nopath</TT>]Indicate that the implicit link from this room should not be used by the game solver. </LI> <LI>[<TT>style ID [ID...]</TT>]<TT> </TT> <BR> Add a list of display styles to the room (and also the implicit link, if any). See Section <A HREF="#sec:styles">5.7</A>. </LI> </UL> <P> <H3><A NAME="SECTION00085200000000000000"></A><A NAME="sec:items"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN> Items </H3> <P> An item is introduced using the command <P> <DL COMPACT> <DT> <DD>item STRING [attribute-list]; </DD> </DL>where <TT>STRING</TT> is the item description. Item attributes can be: <P> <UL> <LI>[<TT>tag ID</TT>]Give the item a tag name, so you can refer to it elsewhere. </LI> <LI>[<TT>in ID</TT>]Set the initial location of this item. Default is the last defined room. If there is no last room (i.e. an item was declared before any room was declared), then this item is initially carried by the player. </LI> <LI>[<TT>note STRING</TT>] <BR> Append a note to the item's note list. </LI> <LI>[<TT>score NUMBER</TT>] <BR> Indicate that you get points the first time you pick this item up. </LI> <LI>[<TT>hidden</TT>]Indicate that this item is not immediately obvious when entering the room. </LI> <LI>[<TT>keep</TT>]Indicate that this item shouldn't ever be dropped (no ``drop'' task should be generated). </LI> <LI>[<TT>keep with ID [ID...]</TT>] <BR> Indicate that the item shouldn't be dropped until all the other specified items have left the inventory. </LI> <LI>[<TT>keep until ID [ID...]</TT>] <BR> Indicate that the item shouldn't be dropped until all the other specified tasks have been done. </LI> <LI>[<TT>ignore</TT>]Indicate that this item should be ignored when trying to find a solution (i.e. never go out of your way to pick it up). </LI> <LI>[<TT>given</TT>]Indicate that this item didn't have to be picked up when it entered the inventory (no ``get'' task should be generated). This attribute is obsolete--you should use the task <TT>give</TT> clause instead (see Section <A HREF="#sec:tasks">5.5.5</A>). </LI> <LI>[<TT>lost</TT>]Indicate that this item wasn't dropped when it left the inventory (no ``drop'' task should be generated). Normally you should use the task <TT>drop</TT> or <TT>lose</TT> clauses instead (see Section <A HREF="#sec:tasks">5.5.5</A>). The only use for this attribute is for items that are left behind due to a <TT>leave</TT> clause. </LI> <LI>[<TT>need ID [ID...]</TT>] <BR> Indicate that you can only pick this item up after getting the specified items. </LI> <LI>[<TT>after ID [ID...]</TT>] <BR> Indicate you can only pick this item up after the specified tasks are done. </LI> <LI>[<TT>before ID [ID...]</TT>] <BR> Indicate you can only pick this item up before the specified tasks are done. </LI> <LI>[<TT>finish</TT>]Indicate that getting this item finishes the game. </LI> <LI>[<TT>style ID [ID...]</TT>] <BR> Add a list of display styles to the item. See Section <A HREF="#sec:styles">5.7</A>. </LI> </UL> <P> <H3><A NAME="SECTION00085300000000000000"></A><A NAME="sec:links"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">3</SPAN> Links </H3> <P> You can create extra room links using the command <P> <DL COMPACT> <DT> <DD>link ID to ID [attribute-list]; </DD> </DL>and the following attributes may be specified: <P> <UL> <LI>[<TT>tag ID</TT>]Give the link a tag name, so you can refer to it elsewhere. </LI> <LI>[<TT>dir COMPASS [COMPASS...]</TT>] <BR> Set the intermediate directions that this link travels in, in the same manner as for rooms. Note that if you omit the final direction to the linked room, it is added automatically. </LI> <LI>[<TT>go OTHERDIR</TT>] <BR> Indicate that the link is in the specified direction. </LI> <LI>[<TT>cmd STRING</TT>] <BR> Specify the command you type to go in this direction. If no <TT>cmd</TT> clause is given, the command is deduced from the <TT>go</TT> clause. If that isn't specified, the command will be deduced from the <TT>dir</TT> clause. </LI> <LI>[<TT>cmd from STRING</TT>] <BR> As above, but this specifies the command to go in the other direction. This defaults to the <TT>cmd to</TT> command, if specified. </LI> <LI>[<TT>cmd to STRING</TT>] <BR> This is identical to <TT>cmd</TT> on its own, and only exists for symmetry. </LI> <LI>[<TT>oneway</TT>]Indicate that this is a one-way link, in a similar manner to the room attribute of the same name. </LI> <LI>[<TT>hidden</TT>]Indicate that this link should not be drawn on the map. Hidden links are still used when solving the game. </LI> <LI>[<TT>nopath</TT>]Indicate that this link should not be used by the game solver. </LI> <LI>[<TT>length NUMBER</TT>] <BR> Indicate that this link has the specified length (default 1). This only affects the calculation of the nearest task when solving the game--see Section <A HREF="#sec:tasks">5.5.5</A>. </LI> <LI>[<TT>need ID [ID...]</TT>] <BR> Indicate that you can only go in this direction after getting the specified items. </LI> <LI>[<TT>after ID [ID...]</TT>] <BR> Indicate that you can only go in this direction after doing the specified tasks. </LI> <LI>[<TT>before ID [ID...]</TT>] <BR> Indicate that you can only go in this direction before doing the specified tasks. These tasks are marked unsafe. </LI> <LI>[<TT>leave ID [ID...]</TT>] <BR> Indicate that the specified items, if carried, must be left behind when using this connection. </LI> <LI>[<TT>leave all [except ID [ID...]]</TT>] <BR> As above, except indicate that <SPAN CLASS="textit">all</SPAN> items must be left behind. The <TT>except</TT> clause can be used to omit specific items. </LI> <LI>[<TT>style ID [ID...]</TT>] <BR> Add a list of display styles to the link. See Section <A HREF="#sec:styles">5.7</A>. </LI> </UL> <P> <H3><A NAME="SECTION00085400000000000000"></A><A NAME="sec:joins"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">4</SPAN> Joins </H3> <P> There is a standalone <TT>join</TT> command which joins two rooms on different map sections: <P> <DL COMPACT> <DT> <DD>join ID to ID [attribute-list]; </DD> </DL>The following attributes may be specified: <P> <UL> <LI>[<TT>tag ID</TT>]Give the join a tag name, so you can refer to it elsewhere. </LI> <LI>[<TT>go COMPASS | OTHERDIR</TT>] <BR> Indicate that the join to this room is in the specified direction. </LI> <LI>[<TT>cmd STRING</TT>] <BR> Specify the command you type to go in this direction. If no <TT>cmd</TT> clause is given, the command is deduced from the <TT>go</TT> clause. If that isn't specified, the command will be undefined. </LI> <LI>[<TT>cmd from STRING</TT>] <BR> As above, but this specifies the command to go in the other direction. This defaults to the <TT>cmd to</TT> command, if specified. </LI> <LI>[<TT>cmd to STRING</TT>] <BR> This is identical to <TT>cmd</TT> on its own, and only exists for symmetry. </LI> <LI>[<TT>oneway</TT>]Indicate that this is a one-way join, in a similar manner to the room attribute of the same name. </LI> <LI>[<TT>hidden</TT>]Indicate that this join should not be drawn on the map. Hidden joins are still used when solving the game. </LI> <LI>[<TT>nopath</TT>]Indicate that this join should not be used by the game solver. </LI> <LI>[<TT>length NUMBER</TT>] <BR> Indicate that this join has the specified length (default 1). This only affects the calculation of the nearest task when solving the game--see Section <A HREF="#sec:tasks">5.5.5</A>. </LI> <LI>[<TT>need ID [ID...]</TT>] <BR> Indicate that you can only go in this direction after getting the specified items. </LI> <LI>[<TT>after ID [ID...]</TT>] <BR> Indicate that you can only go in this direction after doing the specified tasks. </LI> <LI>[<TT>before ID [ID...]</TT>] <BR> Indicate that you can only go in this direction before doing the specified tasks. These tasks are marked unsafe. </LI> <LI>[<TT>leave ID [ID...]</TT>] <BR> Indicate that the specified items, if carried, must be left behind when using this connection. </LI> <LI>[<TT>leave all [except ID [ID...]]</TT>] <BR> As above, except indicate that <SPAN CLASS="textit">all</SPAN> items must be left behind. The <TT>except</TT> clause can be used to omit specific items. </LI> <LI>[<TT>style ID [ID...]</TT>] <BR> Add a list of display styles to the join. See Section <A HREF="#sec:styles">5.7</A>. </LI> </UL> <P> <H3><A NAME="SECTION00085500000000000000"></A><A NAME="sec:tasks"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">5</SPAN> Tasks </H3> <P> You can indicate tasks which need to be done in order to solve the game using the command <P> <DL COMPACT> <DT> <DD>task STRING [attribute-list]; </DD> </DL>and these are the available attributes: <P> <UL> <LI>[<TT>tag ID</TT>]Give the task a tag name, so you can refer to it elsewhere. </LI> <LI>[<TT>in ID</TT>]Specify the room the task must be done in. If this clause is omitted, it defaults to the last defined room. You can use the special word <TT>any</TT> to indicate that the task may be performed anywhere. A task declared before any room is equivalent to saying <TT>in any</TT>. </LI> <LI>[<TT>need ID [ID...]</TT>] <BR> Indicate that the specified items are required before you can do this task. </LI> <LI>[<TT>after ID [ID...]</TT>] <BR> Indicate that this task can only be done after all the specified tasks have been done. </LI> <LI>[<TT>follow ID</TT>] <BR> Indicate that this task must be done immediately after the specified one. Not even a ``drop item'' task is allowed in between. </LI> <LI>[<TT>do ID [ID...]</TT>] <BR> Indicate that doing this task also causes the specified other tasks to be done (if they aren't done already). These other tasks are done immediately, without regard for any prerequisite items or tasks they might need, and their effects are carried out--including any ``do'' clauses they might have, recursively. </LI> <LI>[<TT>get ID [ID...]</TT>] <BR> Indicate that doing this task enables you to get the specified items, and must be done before you can get them. </LI> <LI>[<TT>give ID [ID...]</TT>] <BR> Indicate that doing this task puts the specified items straight into your inventory, wherever they happen to be. </LI> <LI>[<TT>lose ID [ID...]</TT>] <BR> Indicate that doing this task causes the specified items to be lost. This implies that all tasks which need these items must be done before this one. </LI> <LI>[<TT>drop ID [ID...] [in ID] [until ID [ID...]]</TT>] <BR> Indicate that doing this task drops the specified items in the current room (or the room indicated by the <TT>in</TT> clause) if you're carrying them. No ``drop'' message is generated. If there's an <TT>until</TT> clause, you can't retrieve the items until the specified tasks have been done. </LI> <LI>[<TT>drop all [except ID [ID...]] [in ID] [until ID [ID...]]</TT>] <BR> As above, but drop everything you're carrying. The <TT>except</TT> clause can be used to omit specific items. </LI> <LI>[<TT>goto ID</TT>]Indicate that you get ``teleported'' to the specified room when this task is done. This happens after ``give'' and ``drop'' actions. </LI> <LI>[<TT>safe</TT>]Mark this task as safe--i.e. one that can't cause the game solver to get stuck. </LI> <LI>[<TT>ignore</TT>]Don't ever do this task explicitly when solving the game. The task may still be done via a ``do'' action. </LI> <LI>[<TT>finish</TT>]Indicate that doing this task finishes the game. </LI> <LI>[<TT>score NUMBER</TT>] <BR> Indicate that you get the specified score for doing this task. </LI> <LI>[<TT>note STRING</TT>] <BR> Append a note to the task's note list. </LI> <LI>[<TT>cmd STRING [NUMBER]</TT>] <BR> Specify the exact command you type to do the task. If a number follows the command, do the command that many times. Multiple <TT>cmd</TT> clauses concatenate into a list of commands. </LI> <LI>[<TT>cmd none</TT>] <BR> Indicate that no command is required to do this task. </LI> <LI>[<TT>style ID [ID...]</TT>] <BR> Add a list of display styles to the task. See Section <A HREF="#sec:styles">5.7</A>. </LI> </UL> <P> <H2><A NAME="SECTION00086000000000000000"></A><A NAME="sec:variables"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">6</SPAN> Variables </H2> <P> Various aspects of output are controlled by variables. These are set using the following syntax: <P> <DL COMPACT> <DT> <DD>[FORMAT.]ID = NUMBER | STRING | undef [in style ID]; </DD> </DL><TT>FORMAT</TT>, if specified, is the name of a specific output format--the variable then applies only to that output format. <TT>ID</TT> is the name of the variable, and it can take a numeric or string value. Note that setting a variable to the value <TT>undef</TT> effectively removes it. If the style clause is present, this means to only set the variable to this value in the specified style (see Section <A HREF="#sec:styles">5.7</A>). <P> You can use the value of a defined variable anywhere in the input where a number or string is expected, by prefixing it with a dollar (<TT>$</TT>) symbol. <P> All strings that are printed by IFM output formats undergo variable substitution--that is, parts of the string which look like variable references get the value of the variable inserted. If you want a literal <TT>$</TT> inside a string, use <TT>$$</TT>. If you want substitution to be performed on a variable that is cuddled up to other text that looks like part of the variable name, you must surround it with twiddly brackets, like <TT>${this}</TT>. Note that variable substitution only happens when the string is output--this happens after all other processing, so it is the final value of the variable that will be substituted. <P> Some output formats use variables so that you can customize them. They expect certain variables to be defined, and give an error if they aren't. The default values for these variables are set in the initialization file--see Section <A HREF="node7.htm#sec:output-variables">4.4</A>. <P> <H2><A NAME="SECTION00087000000000000000"></A><A NAME="sec:styles"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">7</SPAN> Styles </H2> <P> A ``style'' defines a set of variables with particular values, so that those values can be referred to together. IFM keeps track of the currently active list of styles, and there are two commands which change this list. The command <P> <DL COMPACT> <DT> <DD>style ID; </DD> </DL>pushes the specified style onto the style list. This style becomes the current style. Any IFM objects declared while a style list is in force will by default be output in those styles. Any variable setting is by default in the current style (though you can specify a particular style using the <TT>in style</TT> clause--see Section <A HREF="#sec:variables">5.6</A>). <P> The command <P> <DL COMPACT> <DT> <DD>endstyle [ID]; </DD> </DL>pops the current style from the style list. The previous style on the list (if any) becomes the current style. The ID, if specified, should match the ID in the corresponding <TT>style</TT> command, or a warning is given. <P> Each display style has its own set of values for customization variables. On output, when the value of a variable is needed for displaying an object, the style list for that object is searched in reverse order of declaration. The value used is from the first style to define this variable. If no style defines it, then the default value is used. <P> If a style is referenced by an object but not defined anywhere in the input, then its definition is assumed to be in a separate file, which is searched for using the standard search path. The name of this file is formed by adding a <TT>.ifm</TT> suffix to the style name. If the file is not found, or it does not define the required style, a warning is given. <P> <H2><A NAME="SECTION00088000000000000000"></A><A NAME="sec:expressions"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">8</SPAN> Expressions </H2> <P> Whenever a number is expected in IFM input, you can supply an arithmetic expression. An expression can be a number or a variable value, or a combination using the following constructs (in order of precedence): <P> <P> <BR> <DIV ALIGN="CENTER"> <TABLE CELLPADDING=3> <TR><TD ALIGN="CENTER"><TT>( expr )</TT></TD> <TD ALIGN="LEFT">parentheses</TD> </TR> <TR><TD ALIGN="CENTER"><TT>expr ^ expr</TT></TD> <TD ALIGN="LEFT">exponentiation</TD> </TR> <TR><TD ALIGN="CENTER"><TT>+ expr</TT></TD> <TD ALIGN="LEFT">unary plus</TD> </TR> <TR><TD ALIGN="CENTER"><TT>- expr</TT></TD> <TD ALIGN="LEFT">unary minus</TD> </TR> <TR><TD ALIGN="CENTER"><TT>expr * expr</TT></TD> <TD ALIGN="LEFT">multiply</TD> </TR> <TR><TD ALIGN="CENTER"><TT>expr / expr</TT></TD> <TD ALIGN="LEFT">divide</TD> </TR> <TR><TD ALIGN="CENTER"><TT>expr % expr</TT></TD> <TD ALIGN="LEFT">remainder</TD> </TR> <TR><TD ALIGN="CENTER"><TT>expr + expr</TT></TD> <TD ALIGN="LEFT">addition</TD> </TR> <TR><TD ALIGN="CENTER"><TT>expr - expr</TT></TD> <TD ALIGN="LEFT">subtraction</TD> </TR> </TABLE> </DIV> <P> <BR> <P> Note that in expressions, all variables are treated as numeric. If a variable is set to be a string and is then used in an expression, its numeric value will be read from the string. For most strings, this will be zero. This means that if you want to set a string variable to be exactly equal to another variable, you can't say something like <P> <DL COMPACT> <DT> <DD>string_var = $other_string_var; </DD> </DL>because the right hand side is an expression, which is treated as numeric. The way to do it is to use variable substitution in strings: <P> <DL COMPACT> <DT> <DD>string_var = "$other_string_var"; </DD> </DL> <P> <H2><A NAME="SECTION00089000000000000000"></A><A NAME="sec:preprocessor"></A> <BR> <SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">9</SPAN> Preprocessor </H2> <P> Before IFM sees any input, it is ``preprocessed''--special preprocessing directives are acted upon and removed. This allows you to include other files, define macros, and process the input conditionally. <P> The preprocessing directives all begin with a percent symbol and must be at the start of a line. Some of the available preprocessing directives are:<A NAME="tex2html12" HREF="footnode.htm#foot1630"><SUP><SPAN CLASS="arabic">9</SPAN></SUP></A> <P> <UL> <LI>[<TT>%include "filename"</TT>]Include the specified file. A directory search is done to find the file, using the IFM search path (which can be modified via the <TT>-I</TT> command line option, or the <TT>IFMPATH</TT> environment variable). </LI> <LI>[<TT>%define ID VALUE</TT>]Define macro <TT>ID</TT> to expand to the value <TT>VALUE</TT>. If <TT>VALUE</TT> is not supplied, <TT>ID</TT> is defined with no value. For example: <P> <DL COMPACT> <DT> <DD>%define revealed hidden after last </DD> </DL>A macro can also have arguments, indicated in parentheses after <TT>ID</TT>. For example: <P> <DL COMPACT> <DT> <DD>%define revealed_by(task) hidden after task </DD> </DL> </LI> <LI>[<TT>%undef ID</TT>]Remove any existing definition of <TT>ID</TT>. </LI> <LI>[<TT>%ifdef ID</TT>]Begin a conditional block. The following text is evaluated only if <TT>ID</TT> is defined, until an <TT>%else</TT> or <TT>%endif</TT> is encountered. </LI> <LI>[<TT>%ifndef ID</TT>]Begin a conditional block, like <TT>%ifdef</TT>, but the sense of the test is reversed. </LI> <LI>[<TT>%else</TT>]This toggles the logical value of the current conditional block. </LI> <LI>[<TT>%endif</TT>]This ends a conditional block. </LI> </UL>A few macros are predefined and available to all input: <P> <UL> <LI>[<TT>IFM_VERSION</TT>]The current version of IFM. </LI> <LI>[<TT>IFM_FORMAT</TT>]If defined, this is the requested output format (e.g. <TT>ps</TT>, <TT>fig</TT>). </LI> </UL>IFM also comes with a few predefined include files for you to use: <P> <UL> <LI>[<TT>ifm-color.ifm</TT>]Contains <TT>%define</TT>'s to allow some US variable spellings. </LI> <LI>[<TT>ifm-compat.ifm</TT>]Contains <TT>%define</TT>'s for backward compatibility with some old variable names. </LI> </UL> <P> <DIV CLASS="navigation"><HR> <!--Navigation Panel--> <A NAME="tex2html274" HREF="node9.htm"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A> <A NAME="tex2html270" HREF="ifm.htm"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A> <A NAME="tex2html264" HREF="node7.htm"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A> <A NAME="tex2html272" HREF="node1.htm"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html275" HREF="node9.htm">6 Diagnostics</A> <B> Up:</B> <A NAME="tex2html271" HREF="ifm.htm">IFM</A> <B> Previous:</B> <A NAME="tex2html265" HREF="node7.htm">4 Using IFM</A> <B> <A NAME="tex2html273" HREF="node1.htm">Contents</A></B> </DIV> <!--End of Navigation Panel--> </BODY> </HTML>