This instance will be upgraded to Heptapod 0.17.2 on 2020-12-03 at 14:00 UTC+1 (a few minutes of down time)

Added Library, Examples, and Testing.

Updated ignore lists.
parent 66eae912393e
"Cloak of Darkness main file"
<VERSION ZIP>
<CONSTANT RELEASEID 1>
"Main loop"
<CONSTANT GAME-BANNER
"Cloak of Darkness|
A basic IF demonstration.|
Original game by Roger Firth|
ZIL conversion by Jesse McGrew, Jayson Smith, and Josh Lawrence">
<ROUTINE GO ()
<CRLF> <CRLF>
<TELL "Hurrying through the rainswept November night, you're glad to see the
bright lights of the Opera House. It's surprising that there aren't more
people about but, hey, what do you expect in a cheap demo game...?" CR CR>
<V-VERSION> <CRLF>
<SETG HERE ,FOYER>
<MOVE ,PLAYER ,HERE>
<V-LOOK>
<REPEAT ()
<COND (<PARSER>
<PERFORM ,PRSA ,PRSO ,PRSI>
<APPLY <GETP ,HERE ,P?ACTION> ,M-END>
<OR <META-VERB?> <CLOCKER>>)>
<SETG HERE <LOC ,WINNER>>>>
<INSERT-FILE "parser">
"Objects"
<OBJECT CLOAK
(DESC "cloak")
(SYNONYM CLOAK)
(IN PLAYER)
(FLAGS TAKEBIT WEARBIT WORNBIT)
(ACTION CLOAK-R)>
<ROUTINE CLOAK-R ()
<COND (<VERB? EXAMINE> <TELL "The cloak is unnaturally dark." CR>)>>
<ROOM FOYER
(DESC "Foyer of the Opera House")
(IN ROOMS)
(LDESC "You are standing in a spacious hall, splendidly decorated in red
and gold, with glittering chandeliers overhead. The entrance from
the street is to the north, and there are doorways south and west.")
(SOUTH TO BAR)
(WEST TO CLOAKROOM)
(NORTH SORRY "You've only just arrived, and besides, the weather outside
seems to be getting worse.")
(FLAGS LIGHTBIT)>
<ROOM BAR
(DESC "Foyer Bar")
(IN ROOMS)
(LDESC "The bar, much rougher than you'd have guessed after the opulence
of the foyer to the north, is completely empty.")
(NORTH TO FOYER)
(ACTION BAR-R)>
<GLOBAL DISTURBED 0>
<ROUTINE BAR-R (RARG)
<COND
(<==? .RARG ,M-ENTER>
<COND (<FSET? ,CLOAK ,WORNBIT> <FCLEAR ,BAR ,LIGHTBIT>)
(ELSE <FSET ,BAR ,LIGHTBIT>)>)
(<==? .RARG ,M-BEG>
<COND (<AND <NOT <FSET? ,BAR ,LIGHTBIT>>
<NOT <META-VERB?>>
<NOT <VERB? LOOK>>
<NOT <AND <VERB? WALK> <==? ,PRSO ,P?NORTH>>>>
<TELL "You grope around clumsily in the dark. Better be careful." CR>
<SETG DISTURBED <+ ,DISTURBED 1>>)>)>>
<OBJECT MESSAGE
(DESC "message")
(SYNONYM MESSAGE FLOOR SAWDUST DUST)
(ADJECTIVE SCRAWLED)
(IN BAR)
(FDESC "There seems to be some sort of message scrawled in the sawdust on the floor.")
(ACTION MESSAGE-R)>
<ROUTINE MESSAGE-R ()
<COND (<VERB? EXAMINE>
<TELL "The message simply reads: \"You ">
<COND (<G? ,DISTURBED 1> <TELL "lose.">)
(ELSE <TELL "win.">)>
<TELL "\"" CR>)>
<V-QUIT>>
<ROOM CLOAKROOM
(DESC "Cloakroom")
(IN ROOMS)
(LDESC "The walls of this small room were clearly once lined with hooks,
though now only one remains. The exit is a door to the east.")
(EAST TO FOYER)
(FLAGS LIGHTBIT)>
<OBJECT HOOK
(DESC "small brass hook")
(IN CLOAKROOM)
(SYNONYM HOOK PEG)
(ADJECTIVE SMALL BRASS)
(FDESC "A small brass hook is on the wall.")
(FLAGS CONTBIT SURFACEBIT)>
"EMPTY GAME main file"
<VERSION ZIP>
<CONSTANT RELEASEID 1>
"Main loop"
<CONSTANT GAME-BANNER
"EMPTY GAME|
An interactive fiction by AUTHOR NAME">
<ROUTINE GO ()
<CRLF> <CRLF>
<TELL "INTRODUCTORY TEXT!" CR CR>
<V-VERSION> <CRLF>
<SETG HERE ,STARTROOM>
<MOVE ,PLAYER ,HERE>
<V-LOOK>
<REPEAT ()
<COND (<PARSER>
<PERFORM ,PRSA ,PRSO ,PRSI>
<APPLY <GETP ,HERE ,P?ACTION> ,M-END>
<OR <META-VERB?> <CLOCKER>>)>
<SETG HERE <LOC ,WINNER>>>>
<INSERT-FILE "parser">
"Objects"
<OBJECT STARTROOM
(IN ROOMS)
(DESC "START ROOM")
(FLAGS LIGHTBIT)>
ZILF Library Copyright (C) 2010 Jesse McGrew and Josh Lawrence
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. In the case of a
binary z-code file compiled by the ZILF compiler, the appearance of the
library version number within the text of the introductory title credits of
your game (text that is displayed to a person who plays your z-code file
via a z-code interpreter) is sufficient to satisfy the requirements for
redistribution of said binary z-code file. (By default, using <V-VERSION>
in your game's source code will display the library version number to a
person playing your game on a z-code interpreter.)
* The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The main documentation for ZIL programming is Infocom's "Learning ZIL" manual,
which you can find at
http://www.xlisper.com/zil.pdf
This doc describes the differences between ZILF's library and the description of
ZIL found in "Learning ZIL", including, at the bottom, what is not implemented
yet in ZILF.
-- ZILF has an OPENABLE bit. If an object with CONTBIT also has OPENABLE, then it
can be opened and closed by the player. An object with CONTBIT and OPENBIT but no
OPENABLE flag will be considered always open. An object with just CONTBIT
assigned to it is considered a sealed-off container -- the author can make certain
game events add OPENBIT and/or OPENABLE to it to make it an accessible container.
-- If an object has a TEXT property, that TEXT will show, along with any LDESC,
when the object is EXAMINED. If the object is READ, only the TEXT will be shown.
-- New TEXT-HELD property. If an object has a TEXT-HELD property, the string
associated with it will only be shown if the player is holding the object and
performs a READ on the object (for books, etc).
-- New DEVICEBIT to indicate a device can be turned on and off. ZIL used
LIGHTBIT for this. In ZILF, LIGHTBIT is used solely to indicate something
providing light.
-- "Learning ZIL" describes objects as having a default SIZE and CAPACITY of 5,
if the author does not specify them. If such default containers tested their
CAPACITY against a default object (being inserted)'s SIZE, then all default
containers could only hold 1 default object max (object of SIZE 5 filling the
container's CAPACITY of 5), which seems less than useful. Therefore, in ZILF,
if an container is not assigned a CAPACITY, it will accept an unlimited number
of objects of SIZE 5 or under. Thus an author who does not want to worry about
SIZE and CAPACITY can simply leave them off all objects, and any containers will
always accept any objects. Then for special cases, SIZE and CAPACITY can be
specified (for the very special case of a container that is infinite in capacity,
but only allows objects of a certain size or below, the author can either specify
a very large CAPACITY along with the desired SIZE limit, or custom handle PUT-IN
in the object's ACTION routine).
-- ZILF has the WEIGHT routine, as described in "Learning ZIL", but also a
CONTENTS-WEIGHT, which only adds up the SIZEs of the objects in the chosen container
- not adding the size of the container itself and also not recursing down through
any containers within the primary container.
-- PICK-ONE in early versions of ZIL randomly picked any element from a given table,
and was later replaced by aversion that would randomly cycle through all elements of
the given table before repeating any of them. ZILF offers both. PICK-ONE does the
cyclic 'shuffling' (no repeats til all elements have been displayed once). PICK-ONE-R
is the totally random version (repeats likely). Tables used with PICK-ONE must have
the numeral 2 as their first element. Both PICK-ONE and PICK-ONE-R tables must be LTABLES.
-- The ZIL Manual is a little inconsistent about how a multiple-turn WAIT can/can't be
interrupted. In ZILF, any routine that returns TRUE (whether an I-EVENT, the room's
M-END RARG, whatever) will interrupt a WAIT which is running though a sequence of passed
turns. However, if a routine ends with a RFALSE, WAIT will continue to cycle on to
additional passed turns after the routine. The default number of turns that pass with
WAIT is set by the global STANDARD-WAIT variable.
-- New WAIT-TURNS routine. Pass a number to it, it will pass that number of game turns
in the same fashion as a player-called WAIT.
-- New EDIBLEBIT (not in ZIL manual) for verb EAT
-- COPYT routine is called COPY-TABLE, but functions exactly the same
WHAT'S NOT IMPLEMENTED IN ZILF
---------------------------------
The following are not implemented yet as of v 0.3:
General
- Prompted disambiguation of similarly named objects
- TAKE ALL/DROP ALL
- Player commands with multiple direct objects
- Player commands ending with a preposition (eg TURN OFF LIGHT works -
TURN LIGHT OFF doesn't)
- All mouse and graphic routines
Properties
PLURAL (note this is different from PLURALBIT, which is implemented)
DESCFCN
CONTFCN
GENERIC
SDESC
OWNER
THINGS
ADJACENT
Bits
TRYTAKEBIT
DOORBIT
LOCKEDBIT
FLAMEBIT
BURNBIT
INVISIBLE
SEARCHBIT (ZILF does not use the abitrary level-of-containment limit when searching
through visible & accessible objects)
VEHBIT
RLANDBIT
RWATERBIT
RAIRBIT
KLUDGEBIT
OUTSIDEBIT
INTEGRALBIT
PARTBIT
NALLBIT
DROPBIT
INBIT
Routines
THIS-IS-IT
INIT-STATUS
UPDATE-STATUS
ITALICIZE
UNTOUCHABLE?
WITHIN?
OTHER-SIDE
TOUCHING?
CANT-SEE
SEE-INSIDE?
CAPITAL-NOUN?
FIND-IN
No OOPS
This diff is collapsed.
THINGS TO DO IN THE ZILF VERSION OF CLOAK OF DARKNESS
The poor Cloak of Darkness example is now stuffed with things that
in no way provide an interesting gaming experience, but do provide
many ways to test the ZILF library. Please try these things out,
and email any bugs/issues to jj dot lawrence at gmail dot com.
Note - ZILF-compiled games will not run in Mac Zoom (Andrew Hunter
has been emailed about this), but runs fine in the newest versions
of Spatterlight, Dumbfrotz, Gargoyle, Win Frotz, Unix Frotz and Nfrotz.
SAVE, RESTORE, RESTART, AGAIN and UNDO should all function as expected
WAIT/Z causes 4 turns to pass (you can toggle display of Turn # with DTURN command)
THE FOYER
----------
- Examining the cube should cause 10 game turns to pass
- Examining the painting or card should randomly display a different description each time, not
repeating until all possible descriptions have been shown once (6 for the painting, 3 for the
card)
- Reading the painting should pick from three different signature possibilities to display, in
a 'totally' random fashion - ie, it doesn't guarantee all other possibilities have been shown
before repeating a particular possibility
- Eating the apple should kill you, taking you to a "quit, restore, undo or restart?" query
IQUEUE event tests:
- A "You looked at grime 1 turn ago" message event should fire 1 turn after any EXAMINE GRIME
action
- A "You looked at apple..." message should fire 2 turns after any
EXAMINE APPLE action
- The Foyer room's own routine should report if the above apple event is going fire (saying
"The Foyer routine detects..." - a test of the RUNNING? (as in, is this event running?) routine
- Examining the table should cause an event to fire every turn, until you examine the HOOK in the
Cloakroom, which should dequeue it. Note 'every turn' events do not fire during meta-actions
like INVENTORY.
CLOAKROOM
----------
- You should have to remove the Cloak before traveling west to Hallway to Study
HALLWAY TO STUDY
------------
- Event describing spider should interrupt a wait cycle, ie full 4 turns won't go by
(test by toggling turn # display with DTURN). Example of RTRUE at end of IQUEUE event.
- Examining the SIGN should reveal both its description and its text, reading it should
only reveal its text.
STUDY
----------
- The random event descriptions here (of mouse and scratching sound) should *not* interrupt a wait cycle.
(There are examples of using RFALSE at end of IQUEUE event)
- Has many containers and surfaces to test PUT IN and PUT ON with: jar is an always open container,
wallet is a takeable container with very limited capacity which can be opened and closed, safe is
a non-takeable container that can be opened and closed. Tray and stand are surfaces. Crate is
an always-closed container. The case is a transparent unopenable container holding a muffin that
can be seen but not taken.
- You can use DCONT command to toggle on and off descriptions of objects' sizes and capacities
that will display when a PUT IN action is run
- You can SWITCH/TURN ON and SWITCH/TURN OFF and FLIP the LIGHTSWITCH to control whether the
Closet is lit or not. The flashlight is a device that you can SWITCH/TURN ON and SWITCH/TURN OFF,
provides light when on. The sphere is a transparent unopenable container that holds a firefly
which provides light.
- You should have to hold the book to be able to read it.
Note: TURN OFF FLASHLIGHT works, but TURN FLASHLIGHT OFF doesn't. The syntax VERB OBJ PREPOSITION
is not supported yet - Jesse may make changes to the ZILF parser in the future to implement
this syntax.
GENERAL
--------
IT should refer to the last direct object you used in a command
HE and SHE can be used to refer to Bentley and Stella after you've
used their names in commands at least once.
THEM can be used to reference the grapes (the grapes have PLURALBIT)
The CEILING is a global object that should be refrenceable in every room
DARKNESS is an abstract (GENERIC in ZIL terms) object that you can THINK ABOUT.
The RUG is a GLOBAL-LOCAL (scenery in multiple rooms) object that is in both the Foyer and the Bar.
SPECIAL TEST COMMANDS
----------------------
DROB OBJ - OBJ must be in scope. Removes all objects contained in OBJ from play (test of ROB routine)
DSEND OBJ TO OBJ - OBJs must be in scope. Moves all objects contained in OBJ to the second OBJ
(another test of ROB routine)
DOBJL OBJ - OBJ must be in scope. Lists the contents of OBJ
DVIS - Reports on the current visibility of the BILL and GRIME objects (test of VISIBLE? routine)
DMETALOC OBJ - OBJ must be in scope. Reports on the ultimate location of OBJ, which will
either be a room name or false if OBJ is a global object, etc. Also reports on the
meta-location of the grime object (grime does not have to be in scope). Test by nesting
OBJ and/or grime within multiple containers to make sure the correct room is reported.
(test of META-LOC routine)
DACCESS OBJ - OBJ must be in scope. Reports if OBJ is currently accessible by the player
(globals and local-globals return false, as they're scenery). (Test of ACCESSIBLE? routine)
DHELD OBJ IN OBJ - OBJs must be in scope. Reports if the first OBJ is contained by the
second OBJ, and also reports if the first OBJ is contained in the Foyer. (test of HELD? routine)
DHELDP OBJ - OBJ must be in scope. Reports if the OBJ is held by the player, and if the
BILL object (which doesn't have to be in scope) is held by the player. (another HELD? test)
DLIGHT - will toggle on/off status of flashlight, even in darkness
DTURN - toggles reporting of the turn #. Use when testing WAIT, looking at the cube, etc.
DCONT - toggles reporting of size and capacity of objects in the PUT-IN routine. For example,
PUT BOOK IN JAR could report "book of size 5 can't fit, since current weight of jar's contents
is 5 and jar's capacity is 6"
"99 Bottles of Beer sample for ZILF"
<ROUTINE GO () <SING 99>>
<ROUTINE SING (N)
<REPEAT ()
<BOTTLES .N>
<PRINTI " of beer on the wall,|">
<BOTTLES .N>
<PRINTI " of beer,|Take one down, pass it around,|">
<COND
(<DLESS? N 1> <PRINTR "No more bottles of beer on the wall!">)
(ELSE <BOTTLES .N> <PRINTI " of beer on the wall!||">)>>>
;"Macro version"
<DEFMAC BOTTLES ('N)
<FORM PROG '()
<FORM PRINTN .N>
<FORM PRINTI " bottle">
<FORM COND <LIST <FORM N==? .N 1> '<PRINTC !\s>>>>>
;"Routine version"
;<ROUTINE BOTTLES (N)
<PRINTN .N>
<PRINTI " bottle">
<COND (<N==? .N 1> <PRINTC !\s>)>
<RTRUE>>
This diff is collapsed.
"Hello World sample for ZILF"
<ROUTINE GO ()
<PRINTI "Hello, world!">
<CRLF>>
\ No newline at end of file
"Name and age sample for ZILF"
<VERSION ZIP>
<CONSTANT RELEASEID 1>
"We need an object for the V3 status line."
<ROOM NOWHERE
(DESC "Nowhere")>
<GLOBAL HERE NOWHERE>
<GLOBAL SCORE 500>
<GLOBAL TURNS 1>
<CONSTANT READBUF-SIZE 100>
<GLOBAL READBUF <ITABLE NONE 100>>
<GLOBAL LEXBUF <ITABLE 59 (LEXV) 0 #BYTE 0 #BYTE 0>>
<CONSTANT NAMEBUF-SIZE 20>
<GLOBAL NAMEBUF <ITABLE NONE 20>>
<GLOBAL BIRTHYEAR 0>
<GLOBAL CURYEAR 0>
<DEFMAC TELL ("ARGS" A "AUX" O)
<SET O <MAPF ,LIST
<FUNCTION ("AUX" I)
<COND (<EMPTY? .A> <MAPSTOP>)>
<SET I <NTH .A 1>>
<SET A <REST .A>>
<COND
(<TYPE? .I STRING>
<COND
(<LENGTH? .I 0>
<MAPRET>)
(<LENGTH? .I 1>
<FORM PRINTC <NTH .I 1>>)
(ELSE
<FORM PRINTI .I>)>)
(<==? .I CR>
<FORM CRLF>)
(<==? .I N>
<SET I <NTH .A 1>>
<SET A <REST .A>>
<FORM PRINTN .I>)
(<==? .I BUF>
<SET I <NTH .A 1>>
<SET A <REST .A>>
<FORM PRINTBUF .I>)
(ELSE
<FORM PRINT .I>)>>>>
<COND
(<LENGTH? .O 0>
<>)
(<LENGTH? .O 1>
<NTH .O 1>)
(ELSE
<FORM PROG '() !.O>)>>
<ROUTINE GO ()
<TELL "Hi! What is your name?" CR>
<READLINE>
<COPYBUF ,READBUF ,NAMEBUF ,NAMEBUF-SIZE>
<TELL "What year were you born in?" CR>
<SETG BIRTHYEAR <READNUM>>
<TELL "And what year is it now?" CR>
<SETG CURYEAR <READNUM>>
<TELL "Nice to meet you, " BUF ,NAMEBUF "! You must be about "
N <- ,CURYEAR ,BIRTHYEAR> " by now!" CR>>
<ROUTINE READLINE ()
<PRINTI "> ">
<PUTB ,READBUF 0 ,READBUF-SIZE>
<READ ,READBUF ,LEXBUF>
<COND (<==? <GETB ,READBUF 0> 0>
<TELL "I beg your pardon?" CR>
<AGAIN>)>
<REPEAT ((I 1))
<COND (<OR <==? .I ,READBUF-SIZE> <ZERO? <GETB ,READBUF .I>>>
<PUTB ,READBUF 0 <- .I 1>>
<RETURN>)>
<SET I <+ .I 1>>>
<RTRUE>>
<ROUTINE COPYBUF (SRC DEST MAX)
<REPEAT ((I 0) (LEN <+ <GETB .SRC 0> 1>))
<PUTB .DEST .I <GETB .SRC .I>>
<SET I <+ .I 1>>
<COND (<EQUAL? .I .MAX .LEN> <RETURN>)>>>
<ROUTINE PRINTBUF (BUF "AUX" (I 1) (LEN <GETB .BUF 0>))
<REPEAT ()
<PRINTC <GETB .BUF .I>>
<COND (<L? .I .LEN> <SET I <+ .I 1>>)
(ELSE <RETURN>)>>>
<ROUTINE READNUM ("AUX" LEN (OK <>) VAL)
<READLINE>
<SET LEN <GETB ,READBUF 0>>
<SET VAL 0>
<REPEAT ((I 0) CH)
<COND (<IGRTR? I .LEN>
<RETURN>)>
<SET CH <GETB ,READBUF .I>>
<COND (<OR <L? .CH !\0> <G? .CH !\9>>
<SET OK <>>
<RETURN>)>
<SET OK T>
<SET VAL <+ <* .VAL 10> <- .CH !\0>>>>
<COND (<NOT .OK>
<TELL "That isn't a number!" CR>
<AGAIN>)>
.VAL>
\ No newline at end of file
<VERSION EZIP>
<VERSION XZIP>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment