User:Thijshijsijsjss/Gossamery/Learning ZIL/ZIL Cheatsheet

From XPUB & Lens-Based wiki
< User:Thijshijsijsjss‎ | Gossamery‎ | Learning ZIL
Revision as of 12:12, 2 October 2024 by Thijshijsijsjss (talk | contribs) (Add notes on zil compilation using zilf)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A page with ZIL templates and notes and references

Compiling and running ZIL using zilf

Windows

  1. FIRST TIME ONLY: download zilf into your desired location (e.g. Program Files)
  2. FIRST TIME ONLY: add C:\Program Files\zilf\bin to PATH in system variables (or other path if zilf was not placed into Program Files)
  3. open CMD
  4. enter zilf path/to/my/project.zil
  5. this creates some zap files in the path/to/my folder
  6. enter zapf path/to/my/project.zap
  7. this creates path/to/my/project.z3
  8. now use this z3 file with your z-machine of choice

Templates

Header Code & Go Routine

This must be present in each project

"Name of Game"

<VERSION ZIP>
<CONSTANT RELEASEID 1>

"Main loop"

<CONSTANT GAME-BANNER
"Name of Game | Description of Game | By Your Name Here | 
Year and any other useful info">

<ROUTINE GO ()
    <CRLF> <CRLF>
    <TELL "Opening text, something that sets the scene." CR>
    <INIT-STATUS-LINE>
    <V-VERSION> <CRLF>
    <SETG HERE ,ROOM-A>
    <MOVE ,PLAYER ,HERE>
    <V-LOOK>
    <MAIN-LOOP>>   

<INSERT-FILE "parser"> 

Rooms

<ROOM ROOM-A
    (DESC "Room A")
    (IN ROOMS)
    (LDESC "Description of room that displays first time only, or every time if the game is in Verbose mode.")
    (NORTH TO X)
    (SOUTH TO X)
    (EAST TO X)
    (WEST TO X)
    (FLAGS LIGHTBIT ONBIT)>

Objects

<OBJECT COAT
    (DESC "coat")
    (SYNONYM COAT JACKET)
    (IN PLAYER)
    (FLAGS TAKEBIT WEARBIT WORNBIT)
    (ACTION COAT-R)>

<ROUTINE COAT-R ()
    <COND (<VERB? EXAMINE> <TELL "Nice clean coat." CR>)>>

<OBJECT BALL
    (DESC "ball")
    (SYNONYM BALL)
    (IN ROOM-A)
    (FLAGS TAKEBIT)
    (ACTION CLOAK-R)> 

<ROUTINE CLOAK-R ()
    <COND (<VERB? EXAMINE> <TELL "A nice round ball." CR>)>>