!% -~S !% $OMIT_UNUSED_ROUTINES=1 !% $ZCODE_LESS_DICT_DATA=1 Constant Story "Colours"; Constant Headline "^A demonstration of using colours in PunyInform^"; Constant STATUSLINE_SCORE; Statusline score; ! Uncomment to add optional features to PunyInform !Constant DEBUG; Constant OPTIONAL_NO_DARKNESS; !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"; Include "puny.h"; ! Declare the colour constants we need to conveniently switch colours during the game Constant MY_DEFAULT_FG = CLR_CYAN; Constant MY_EMPHASIS_FG = CLR_WHITE; Object Library "The Library" with description [; print "You are "; ChangeFgColour(MY_EMPHASIS_FG); ! This has no effect unless colours are active print "in "; ChangeFgColour(MY_DEFAULT_FG); ! This has no effect unless colours are active "a library."; ]; Object -> Box "box" with name 'box', inside_description "It feels so nice, standing in the box.", has container open openable enterable; [Initialise; #Ifv5; if(HDR_TERPFLAGS->0 & 1) { print "^^Would you like colour? "; if(YesOrNo()) { clr_on = true; clr_fg = MY_DEFAULT_FG; ! Defined in this program, right after including "puny.h" clr_bg = CLR_BLACK; clr_fginput = CLR_YELLOW; ! Don't set this, or set it to CLR_CURRENT, to keep input in same colour as normal text clr_fgstatus = CLR_RED; ! Don't set this, or set it to CLR_CURRENT, to keep statusline in same colour as normal text } ClearScreen(WIN_ALL); } #Endif; print "^^And so the story begins...^^"; ];