Anda di halaman 1dari 6

InfoLib

User-defined constants Library variables


Some constants control features rather than represent values. action
AMUSING_PROVIDED The current action.
at your fingertips Activates the Amusing entry_point. actor
A quick reference to the DEATH_MENTION_UNDO The target of an instruction: the player, or an NPC.
Inform Library
Offers UNDO the last move when the game is over. deadflag
Inform is copyright 2002 by Graham Nelson Normally 0: 1 indicates a regular death, 2 indicates that
http://www.gnelson.demon.co.uk/ DEBUG
Activates the debug commands. the player has won, 3 or more denotes a user-defined end.
This guide is copyright 2002 by Roger Firth
http://www.firthworks.com/roger/ Headline = "string " inventory_stage

Version 1.5 (March 2002) Mandatory: the game style, copyright information, etc. Used by invent and list_together properties.
MANUAL_PRONOUNS keep_silent
Pronouns reflect only objects mentioned by the player. Normally false; true makes most group 2 actions silent.
The road to brevity is via solecism and through imprecision
refer to the Inform Designers Manual for the definitive story. MAX_CARRIED = expr location
Maximum number of direct possessions that the player The players current room; unless thats dark, when it
Library objects can carry (default 100). contains thedark, real_location contains the room.
compass MAX_SCORE = expr notify_mode
A container object holding the twelve direction objects Maximum game score (default 0). Normally true: false remains silent when score changes.
d_obj e_obj in_obj n_obj ne_obj nw_obj out_obj MAX_TIMERS = expr noun
s_obj se_obj sw_obj u_obj w_obj. The primary focus object for the current action.
Maximum number of active timers/daemons (default 32).
LibraryMessages player
NO_PLACES
If defined (between Includes of Parser and VerbLib), The object acting on behalf of the human player.
The OBJECTS and PLACES verbs are not allowed.
changes standard library messages: real_location
NUMBER_TASKS = expr
Object LibraryMessages The players current room when in the dark.
with before [; Number of scored tasks to be performed (default 1).
action : "string "; OBJECT_SCORE = expr score
action : "string "; For taking a scored object for the first time (default 4). The current score.
action : switch (lm_n) { second
value : "string "; ROOM_SCORE = expr
value : "string ",(a) lm_o,"."; For visiting a scored room for the first time (default 5). The secondary focus object for the current action.
... SACK_OBJECT = object self
} The object which received a message .
... A container object where the game places held objects.
];
(Note: a run-time variable, not a compile-time constant.)
Story = "string "
sender
selfobj Mandatory: the name of the story.
The default player object. Avoid: use instead the player The object which sent a message (or nothing).
TASKS_PROVIDED
variable, which usually refers to selfobj. task_scores
Activates the task scoring system.
thedark A byte array holding scores for the task scoring system.
USE_MODULES
A pseudo-room which becomes the location when there the_time
Activates linking with pre-compiled library modules.
is no light (although the player object is not moved there). The games clock, in minutes 0..1439 since midnight.
WITHOUT_DIRECTIONS
turns
De-activates standard compass directions (bar IN and
Library constants The games turn counter.
OUT). Place alternative directions in the compass.
In addition to the standard constants true (1), false (0) and wn
nothing (0), the Library defines NULL (1) for an action, The input stream word number, counting from 1.
property or pronoun whose current value is undefined.
1 1
Library routines NextWordStopped() StartTimer(object,expr )
Achieved(expr ) Returns the next dictionary word in the input stream, Starts the objects timer, initialising its time_left to
A scored task has been achieved. incrementing wn by one. Returns false if the word is not expr. The objects time_out property will be called after
AfterRoutines()
in the dictionary, 1 if the input stream is exhausted. that number of turns have elapsed.
In a group 2 action, controls output of after messages. NounDomain(object1,object2,type ) StopDaemon(object )

AllowPushDir()
Performs object parsing; see also ParseToken(). Stops the objects daemon.
An object can be pushed from one location to another. ObjectIsUntouchable(object,flag ) StopTimer(object )

Banner()
Tests if there is a barrier a container object which is not Stops the objects timer.
open between player and object. Unless the optional TestScope(object,actor )
Prints the game banner. flag is true, outputs You can't because ... is in the way.
ChangePlayer(object,flag )
Returns true if the object is in scope, otherwise false. If
Returns true is a barrier is found, otherwise false. the optional actor is supplied, that defines the scope.
Player assumes the persona of the object. If the optional OffersLight(object )
flag is true, room descriptions include (as object). TryNumber(expr )
Returns true if the object offers light. Parses word expr in the input stream as a number,
CommonAncestor(object1,object2 ) ParseToken(type,value ) recognising decimals, also English words one..twenty.
Returns the nearest object which a parental relationship to Performs general parsing; see also NounDomain(). Returns the number 1..10000, or -1000 if the parse fails.
both objects, or nothing.
PlaceInScope(object ) UnsignedCompare(expr1,expr2 )
DictionaryLookup(byte_array,length )
Used in an add_to_scope property or scope= token to Returns 1 if expr1 is less than expr2, 0 if expr1 equals
Returns address of word in dictionary, or 0 if not found. put the object into scope for the parser. expr2, and 1 if expr1 is greater than expr2. Both
DrawStatusLine() expressions are unsigned, in the range 0..65535.
PlayerTo(object,flag )
Refreshes the status line. Moves the player to object. Prints its description unless WordAddress(expr )
GetGNAOfObject(object ) optional flag is 1 (no description) or 2 (as if walked in). Returns a byte array contains the raw text of word expr in
Returns gender-number-animation 0..11 of the object. PrintOrRun(object,property,flag ) the input stream.
HasLightSource(object ) If object.property is a string, output it (followed by a WordInProperty(word,object,property )
Returns true if the object has light. newline unless optional flag is true), and return true. If Returns true if the dictionary word is listed in the
IndirectlyContains(parent_object,object ) its a routine, run it and return what the routine returns. property values for the object.
Returns true if object is currently a child or grand-child PronounNotice(object ) WordLength(expr )
or great-grand-child... of the parent_object. Associates an appropriate pronoun with the object. Returns the length of word expr in the input stream.
IsSeeThrough(object ) PronounValue('pronoun ') WriteListFrom(object,expr )
Returns true if light can pass through the object. Returns the object to which 'it' (or 'him', 'her', Outputs a list of object and its siblings, in the given style,
Locale(object,"string1 ","string2 ") 'them') currently refers, or nothing. an expr formed by adding any of: ALWAYS_BIT,
ScopeWithin(object ) CONCEAL_BIT, DEFART_BIT, ENGLISH_BIT, FULLINV_BIT,
Describes the contents of object, and returns their
Used in an add_to_scope property or scope= token to INDENT_BIT, ISARE_BIT, NEWLINE_BIT, PARTINV_BIT,
number. After objects with own paragraphs, the rest are
RECURSE_BIT, TERSE_BIT, WORKFLAG_BIT.
listed preceded by string1 or string2. put the contents of the object in scope for the parser.
LoopOverScope(routine,actor ) SetPronoun('pronoun ',object ) YesOrNo()
Calls routine(object) for each object in scope. If the Defines the object to which a given pronoun refers. Returns true if the player types YES, false for NO.
optional actor is supplied, that defines the scope. SetTime(expr1,expr2 ) ZRegion(arg )
MoveFloatingObjects() Sets the_time to expr1 (in mins 0..1439 since midnight), Returns the type of its arg : 3 for a string address, 2 for a
Adjusts positions of games found_in objects. running at expr2 (+ve: expr2 minutes pass each turn; routine address, 1 for an object number, or 0 otherwise.
NextWord() ve: -expr2 turns take one minute; zero: time stands still).
Returns the next dictionary word in the input stream, StartDaemon(object )
incrementing wn by one. Returns false if the word is not Starts the objects daemon.
in the dictionary, or if the input stream is exhausted.
2 2
Object properties cant_go door_to
Where the value of a property can be a routine, several For a room: the message when the player attempts an For a door object: where it leads. The value can be:
formats are possible (but remember: embedded ] returns impossible exit. The value can be: a string, or a routine false (the default): leads nowhere;
false, standalone ] returns true, ): which outputs a string.
a string: output to explain why door leads nowhere;
property [; statement ; statement ; ... ] capacity a room: the door leads to this room;
For a container or supporter object: the number of a routine which should return: false, a string, a room,
property [; return routine (); ] objects which can be placed in or on it the default is 100. or true to signify leads nowhere without producing
For the player: the number which can be carried any output.
property [; routine (); ]
selfobj has an initial capacity of MAX_CARRIED.
e_to
property routine The value can be: a number, or a routine which returns a See d_to.
number.
each_turn
marks an additive property: such properties in an d_to
Invoked at the end of each turn (after all appropriate
Object definition supplement, rather than supersede, the For a room: a possible exit. The value can be: daemons and timers) whenever the object is in scope. The
same properties in a Class definition (and are dealt with false (the default): not an exit; value can be: a string, or a routine.
first).
a string: output to explain why this is not an exit; found_in
add_to_scope
a room: the exit leads to this room; For an object: the rooms where this object can be found,
For an object: additional objects which follow it in and out
a door object: the exit leads through this door; unless it has the absent attribute. The value can be:
of scope. The value can be: a space-separated list of
objects, or a routine which invokes PlaceInScope() or a routine which should return: false, a string, a room, a a space-separated list of rooms (where this object can be
ScopeWithin() to specify objects. door object, or true to signify not an exit and produce found) or objects (whose locations are tracked by this
no further output. object);
after
daemon a routine which should return: true if this object can be
For an object: receives every action and fake_action
The value is a routine which can be activated by found in the current location, otherwise false.
for which this is the noun.
StartDaemon(object ) and which then runs once each grammar
For a room: receives every action which occurs here.
turn until deactivated by StopDaemon(object ). For an animate or talkable object: the value is a
The value is a routine of structure similar to a switch
describe routine called when the parser knows that this object is
statement, having cases for the appropriate actions (and
For an object: called before the objects description is being addressed, but has yet to test the grammar. The
an optional default as well); it is invoked after the action
has happened, but before the player has been informed. output. For a room: called before the rooms (long) routine should return: false to continue, true to indicate
description is output. that the routine has parsed the entire command, or a
The routine should return: false to continue, telling the
The value is a routine which should return: false to dictionary word ('word ' or 'word ').
player what has happened, or true to stop processing the
action and produce no further output. continue, outputting the usual description, or true to stop in_to
article processing and produce no further output. See d_to.
For an object: the objects indefinite article the default is description initial
automatically a, an or some. The value can be: a For an object: its description (output by Examine). For an object: its description before being picked up.
string, or a routine which outputs a string. For a room: its long description (output by Look). For a room: its description when the player enters the
articles The value can be: a string, or a routine which outputs a room.
For a non-English object: its definite and indefinite string. The value can be: a string, or a routine which outputs a
articles. The value is an array of strings. door_dir string.
before For a compass object (d_obj, e_obj, ...): the direction in inside_description
For an object: receives every action and fake_action which an attempt to move to this object actually leads. For an enterable object: its description, output as part of
for which this is the noun. For a door object: the direction in which this door leads. the room description when the player is inside the object.
For a room: receives every action which occurs here. The value can be: a directional property (d_to, e_to, ...), The value can be: a string, or a routine which outputs a
The value is a routine invoked before the action has or a routine which returns such a property. string.
happened. See after.
3 3
invent number short_name_indef
For an object: the value is a routine for outputting the For an object or room: the value is a general-purpose For a non_English object: the short name when preceded
objects inventory listing, which is called twice. On the first variable freely available for use by the program. A player by an indefinite object. The value can be: a string, or a
call nothing has been output; inventory_stage has the object must provide (but not use) this variable. routine which outputs a string.
value 1, and the routine should return: false to continue nw_to sw_to
or true to stop processing and produce no further output. See d_to. See d_to.
On the second call the objects indefinite article and short
name have been output, but not any subsidiary orders time_left
information; inventory_stage has the value 2, and the For an animate or talkable object: the value is a For a timer object: the value is a variable to hold the
routine should return: false to continue or true to stop routine called to carry out the players orders. The routine number of turns left until this objects timer activated
processing and produce no further output. should return: false to continue, or true to stop and initialised by StartTimer(object ) counts down to
life
processing the action and produce no further output. zero and invokes the objects time_out property.
For an animate object: receives person-to-person out_to time_out
actions (Answer Ask Attack Give Kiss Order Show See d_to. For a timer object: the value is a routine which is run
Tell ThrowAt WakeOther) for which this is the noun. The parse_name when the objects time_left value initialised by
value is a routine of structure similar to a switch For an object: the value is a routine called to parse an StartTimer(object ), and not in the meantime cancelled
statement, having cases for the appropriate actions (and objects name. The routine should return: zero if the text by StopTimer(object ) counts down to zero.
an optional default as well). The routine should return: makes no sense, 1 to cause the parser to resume, or the u_to
false to continue, telling the player what has happened, positive number of words matched. w_to
or true to stop processing the action and produce no plural See d_to.
further output. when_closed
For an object: its plural form, when in the presence of
list_together others like it. The value can be: a string, or a routine when_open
For an object: groups related objects when outputting an which outputs a string. For a container or door object: used when including this
inventory or room contents list. The value can be: react_after
object in a rooms long description. The value can be: a
a number: all objects having this value are grouped; string, or a routine which outputs a string.
For an object: detects nearby actions those which take
a string: all objects having this value are grouped as a place when this object is in scope. The value is a routine when_off
count of the string; when_on
invoked after the action has happened, but before the
a routine which is called twice. On the first call nothing player has been informed. See after. For a switchable object: used when including this object
has been output; inventory_stage has the value 1, and in a rooms long description. The value can be: a string,
react_before
the routine should return: false to continue, or true to or a routine which outputs a string.
For an object: detects nearby actions those which take
stop processing and produce no further output. On the with_key
place when this object is in scope. The value is a routine
second call the list has been output; inventory_stage invoked before the action has happened. See after. For a lockable object: the key object needed to lock
has the value 2, and there is no test on the return value. and unlock the object, or nothing if no key fits.
s_to
n_to
se_to
See d_to. See d_to.
name
short_name
Defines a space-separated list of words which are added to For an object: an alternative or extended short name. The
the Inform dictionary. Each word can be supplied in value can be: a string, or a routine which outputs a string.
apostrophes '...' or quotes "..."; in all other cases only The routine should return: false to continue by
words in apostrophes update the dictionary. outputting the objects real short name (from the head of
For an object: identifies this object. the object definition), or true to stop processing the action
For a room: outputs does not need to be referred to. and produce no further output.
ne_to
See d_to.
4 4
Object attributes pluralname ChooseObjects(object,flag )
absent For an object: is plural. Parser has found ALL or an ambiguous noun phrase and
For a floating object (one with a found_in property, proper decided that object should be excluded (flag is 0), or
which can appear in many rooms): is no longer there. For an object: the short name is a proper noun, therefore included (flag is 1). The routine should return: 0 to let
animate not to be preceded by The or the. this stand, 1 to force inclusion, or 2 to force exclusion. If
flag is 2, the parser is undecided, and the routine should
For an object: is a living creature. scenery return an appropriate score 0..9.
clothing For an object: cant be taken; is not listed in a room DarkToDark()
For an object: can be worn. description.
The player has moved from one dark room to another.
concealed scored
DeathMessage()
For an object: is present but hidden from view. For an object: awards OBJECT_SCORE points when taken
for the first time. For a room: awards ROOM_SCORE points The player has died and deadflag is 3 or more.
container GamePostRoutine()
when visited for the first time.
For an object: other objects can be put in (but not on) it. Called after all actions.
static
door GamePreRoutine()
For an object: cant be taken.
For an object: is a door or bridge between rooms. Called before all actions.
supporter
edible Initialise()
For an object: other objects can be put on (but not in) it.
For an object: can be eaten. Mandatory; note British spelling: called at start. Must
switchable
enterable set location; can return 2 to suppress game banner.
For an object: can be switched off or on.
For an object: can be entered. InScope()
talkable
female Called during parsing.
For an object: can be addressed in object, do this style.
For an animate object: is female. LookRoutine()
transparent
general Called at the end of every Look description.
For a container object: objects inside it are visible.
For an object or room: a general-purpose flag. NewRoom()
visited
light Called when room changes, before description is output.
For a room: is being, or has been, visited by the player.
For an object or room: is giving off light. ParseNoun(object )
workflag
lockable Called to parse the objects name.
Temporary internal flag, also available to the program.
For an object: can be locked; see the with_key property. ParseNumber(byte_array,length )
worn
locked Called to parse a number.
For a clothing object: is being worn.
For an object: cant be opened. ParserError(number )
male Optional entry points Called to handle an error.
For an animate object: is male. These routines, if you supply them, are called when shown. PrintRank()
moved Completes the output of the score.
AfterLife()
For an object: is being, or has been, taken by the player. The player has died. Setting deadflag to 0 resurrects her. PrintTaskName(number )
neuter Prints the name of the task.
AfterPrompt()
For an animate object: is neither male nor female. The > prompt has been output. PrintVerb(addr )
on Called when an unusual verb is printed.
Amusing()
For a switchable object: is switched on. The player has won and AMUSING_PROVIDED is defined. TimePasses()
open Called after every turn.
BeforeParsing()
For a container or door object: is open. The parser has input some text, set up the buffer and parse UnknownVerb()
openable tables, and initialised wn to 1, but done nothing else. Called when an unusual verb is encountered.
For a container or door object: can be opened.
5 5
Group 1 actions SwitchOn SCREW ON, SWITCH ON, TURN ON, Sing SING
Group 1 actions support the meta verbs and debug tools. TWIST ON Sleep NAP, SLEEP
Take CARRY, GET, HOLD, PEEL [OFF], Smell SMELL, SNIFF
Group 2 actions PICK UP, REMOVE, TAKE Sorry SORRY
Transfer CLEAR TO, MOVE TO, PRESS TO, PUSH TO, Squeeze SQUASH, SQUEEZE
Group 2 actions usually work, given the right circumstances.
SHIFT TO, TRANSFER TO
These are the standard actions and their triggering verbs. Strong Various strong swearwords.
Unlock OPEN WITH, UNDO WITH, UNLOCK WITH
Close CLOSE [UP], COVER [UP], SHUT [UP] Swim DIVE, SWIM
VagueGo GO, LEAVE, RUN, WALK
Disrobe DISROBE, DOFF, REMOVE, SHED, Swing SWING [ON]
Wear DON, PUT ON, WEAR
TAKE OFF Taste TASTE
Drop DISCARD, DROP, PUT DOWN, THROW Tell TELL ABOUT
Group 3 actions Think THINK
Eat EAT
Empty EMPTY [OUT] Group 3 actions are by default stubs which output a message ThrowAt THROW AGAINST|AT|ON|ONTO
and stop at the before stage (so there is no after stage).
Tie ATTACH [TO], FASTEN [TO], FIX [TO],
EmptyT EMPTY IN|INTO|ON|ONTO|TO
Enter CROSS, ENTER, GET IN|INTO|ON|ONTO, Answer ANSWER TO, SAY TO, SHOUT TO, SPEAK TO TIE [TO]
GO IN|INSIDE|INTO|THROUGH, Ask ASK ABOUT Touch FEEL, FONDLE, GROPE, TOUCH
LEAVE IN|INSIDE|INTO|THROUGH, AskFor ASK FOR Turn ROTATE, SCREW, TURN, TWIST, UNSCREW
LIE IN|INSIDE|ON, LIE ON TOP OF, Attack ATTACK, BREAK, CRACK, DESTROY, Wait WAIT Z
RUN IN|INSIDE|INTO|THROUGH, FIGHT, HIT, KILL, MURDER, PUNCH, Wake AWAKE[N], WAKE [UP]
SIT IN|INSIDE|ON, SIT ON TOP OF, SMASH, THUMP, TORTURE, WRECK
STAND ON, WALK IN|INSIDE|INTO|THROUGH WakeOther AWAKE[N], WAKE [UP]
Blow BLOW Wave WAVE
Examine CHECK, DESCRIBE, EXAMINE, L[OOK] AT, Burn BURN [WITH], LIGHT [WITH]
READ, WATCH, X WaveHands WAVE
Buy BUY PURCHASE
Exit EXIT, GET OFF|OUT|UP, LEAVE, Yes Y[ES]
Climb CLIMB [OVER|UP], SCALE
OUT[SIDE], STAND [UP]
Consult CONSULT ABOUT|ON, LOOK UP IN,
GetOff GET OFF Fake actions
READ ABOUT IN, READ IN
Give FEED [TO], GIVE [TO], OFFER [TO], LetGo Generated by Remove.
Cut CHOP, CUT, PRUNE, SLICE
PAY [TO] ListMiscellany Outputs a range of inventory messages.
Dig DIG [WITH]
Go GO, LEAVE, RUN, WALK Miscellany Outputs a range of utility messages.
Drink DRINK, SIP, SWALLOW
GoIn CROSS, ENTER, IN[SIDE] NotUnderstood Generated when the parser fails to
Fill FILL
Insert DISCARD IN|INTO, DROP DOWN|IN|INTO, interpret some orders.
INSERT IN|INTO, PUT IN|INSIDE|INTO, Jump HOP, JUMP, SKIP
Order Receives things not handled by orders.
THROW DOWN|IN|INTO JumpOver HOP OVER, JUMP OVER, SKIP OVER
PluralFound Tells the parser that parse_name() has
Inv I[NV], INVENTORY, TAKE INVENTORY Kiss EMBRACE, HUG, KISS identified a plural object.
InvTall I[NV] TALL, INVENTORY TALL Listen HEAR, LISTEN [TO] Prompt Outputs the prompt, normally >.
InvWide I[NV] WIDE, INVENTORY WIDE LookUnder LOOK UNDER Receive Generated by Insert and PutOn.
Lock LOCK WITH Mild Various mild swearwords. TheSame Generated when the parser cant
Look L[OOK] No NO distinguish between two objects.
Open OPEN, UNCOVER, UNDO, UNWRAP Pray PRAY ThrownAt Generated by ThrowAt.
PutOn DISCARD ON|ONTO, DROP ON|ONTO, Pull DRAG PULL
PUT ON|ONTO, THROW ON|ONTO Push CLEAR, MOVE, PRESS, PUSH, SHIFT
Remove GET FROM, REMOVE FROM, TAKE FROM|OFF PushDir CLEAR, MOVE, PRESS, PUSH, SHIFT
Search L[OOK] IN|INSIDE|INTO|THROUGH, SEARCH Rub CLEAN, DUST, POLISH, RUB, SCRUB,
Show DISPLAY [TO], PRESENT [TO], SHOW [TO] SHINE, SWEEP, WIPE
SwitchOff CLOSE OFF, SCREW OFF, SWITCH OFF, Set ADJUST, SET
TURN OFF, TWIST OFF SetTo ADJUST TO, SET TO
6 6

Anda mungkin juga menyukai