Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Toyshop.inf

Green Cone (lines 456-482)

456  ! >CO  A traditional Inform example object:
457  ! ----------------------------------------------------------------------------
458   
459  Object -> cone "green cone"
460    with name "green" "cone" "emerald" "marzipan",
461         describe
462         [; if (cone has moved)
463                "^A misshapen cone of green marzipan sits here.";
464            "^Nearby is an emerald green cone, one foot high.";
465         ],
466         description "The cone seems to be made of emerald-coloured 
467                      marzipan.",
468         before
469         [; Eat: if (random(100) <= 30)
470                 {   deadflag = 1;
471                     "Unfortunately, you seem to be allergic to almonds.";
472                 }
473                 "You nibble at a corner of the cone.";
474         ],
475         after
476         [; Take: "Taken. (Your hands are smeared with marzipan.)";
477            Drop: cone.description = "The cone is a vague green mess.";
478                  "The cone drops to the floor and sags a little.";
479         ],
480    has  edible;
481   
482  ! ----------------------------------------------------------------------------


Last updated 23 June 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.