!% -~S !% $OMIT_UNUSED_ROUTINES=1 ! The very first lines of the main source code file for a game can ! contain compiler options, like the two lines above. -~S disables ! strict error checking. This is otherwise used in z5 and z8 games by ! default. While useful for debugging, it adds ~10 KB to the story file ! size and it makes the game slower. ! $OMIT_UNUSED_ROUTINES=1 makes the compiler remove all routines which ! aren't used. This can save some space. Constant Story "Test Directions"; Constant Headline "^A sample game which uses PunyInform.^"; ! Uncomment ONE of the two following lines, to show either time or score/turns ! Leaving both commented out makes the library bigger. !Constant STATUSLINE_TIME; Statusline time; Constant STATUSLINE_SCORE; Statusline score; ! Comment out to keep track of score ! The value is what will be shown as the score on statusline in z3 Constant NO_SCORE = 0; ! Customize the statusline in z5+ (will have no effect in z3) !Constant OPTIONAL_SL_NO_SCORE; !Constant OPTIONAL_SL_NO_MOVES; ! Uncomment to add optional features to PunyInform !Constant DEBUG; !Constant CUSTOM_ABBREVIATIONS; !Constant CUSTOM_PLAYER_OBJECT = myPlayerObj; Constant OPTIONAL_NO_DARKNESS; !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; Constant OPTIONAL_EXTENDED_METAVERBS; !Constant OPTIONAL_EXTENDED_VERBSET; !Constant OPTIONAL_PRINT_SCENERY_CONTENTS; !Constant OPTIONAL_SCORED; !Constant OPTIONAL_FULL_SCORE; ! Comment out NO_SCORE when uncommenting this !Constant OPTIONAL_FULL_DIRECTIONS; !Constant OPTIONAL_SIMPLE_DOORS; !Constant OPTIONAL_SHIP_DIRECTIONS; !Constant OPTIONAL_GUESS_MISSING_NOUN; !Constant OPTIONAL_MANUAL_SCOPE; !Constant OPTIONAL_MANUAL_REACTIVE; !Constant OPTIONAL_ORDERED_TIMERS; !Constant OPTIONAL_PROVIDE_UNDO; !Constant OPTIONAL_REACTIVE_PARSE_NAME; !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info ! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED, ! MAX_CARRIED, SACK_OBJECT, etc. Constant INITIAL_LOCATION_VALUE = Library; Include "globals.h"; ! Define your own global variables here, if any ! Define the entry point routines you need here, like Amusing, DarkToDark etc. ! Uncomment to add PunyLib extensions !Include "ext_menu.h"; !Include "ext_flags.h"; !Include "ext_quote_box.h"; !Include "ext_cheap_scenery.h"; Include "puny.h"; ! Uncomment to add PunyLib extensions !Include "ext_waittime.h"; [PrintDirection; if(selected_direction_index == 0 && selected_direction == 0) print "No direction is set.^"; else if(selected_direction_index == 0 || selected_direction == 0) print "selected_direction_index is ", selected_direction_index, " while selected_direction is ", selected_direction, ".^"; else { print "Direction is ",selected_direction_index, " ("; if(selected_direction_index > 0 && selected_direction_index <= DIRECTION_COUNT) print (string) direction_name_array-->selected_direction_index; else print "not a valid direction"; print ")^"; } ]; [ PrintNoun p_name p_noun; print (string) p_name, " is ", p_noun, " ("; if(p_noun ofclass ProperObject || p_noun == Directions) print (name) p_noun; else print "not a proper object"; print ") ^"; ]; Verb 'scan' * noun -> Scan * noun=ADirection 'of' noun -> ScanDirOf * 'north' 'on' -> ScanNorthOn; [ ScanSub; print "Action ##Scan.^"; PrintDirection(); PrintNoun("Noun", noun); PrintNoun("Second", second); ]; [ ScanDirOfSub; print "Action ##ScanDirOf.^"; PrintDirection(); PrintNoun("Noun", noun); PrintNoun("Second", second); ]; [ ScanNorthOnSub; print "Action ##ScanNorthOn.^"; PrintDirection(); PrintNoun("Noun", noun); PrintNoun("Second", second); ]; Class ProperObject; Object Library "The Library" with description "You are in a library."; ProperObject -> House "house" with name 'house', has static; ProperObject -> NStatue "north statue" with name 'north' 'statue', has static; ProperObject -> SStatue "south statue" with name 'south' 'statue', has static; [Initialise; print "^^Try typing:^^ SCAN EAST OF HOUSE (##ScanDirOf)^ SCAN EAST OF NORTH STATUE (##ScanDirOf)^ SCAN NORTH STATUE (##Scan)^ SCAN NORTH ON (##ScanNorthOn)^^"; ];