├── .gitignore ├── tests ├── testsound.cmd ├── test-flags.cmd ├── testsound.txt ├── largegame.cmd ├── test-adjectives.cmd ├── test2.cmd ├── test-concealed.cmd ├── minimal-provideundo.cmd ├── test-gprheld.cmd ├── test-grammar.cmd ├── thirdnoun.cmd ├── test-issue73.cmd ├── test-consultfrom.cmd ├── show_content.cmd ├── test-type.cmd ├── test-beforeparsing.cmd ├── test-chooseobjectsfinal.cmd ├── test-visibility.cmd ├── test-chooseobjects.cmd ├── thirdnoun.txt ├── minimal-waittime.cmd ├── test-issue75.cmd ├── containers.cmd ├── largegame.txt ├── test-panels.cmd ├── test-bottles.cmd ├── test-adjectives.txt ├── test2.txt ├── test5.cmd ├── test-grammar.txt ├── test-gprheld.txt ├── test-numbers.cmd ├── test3.cmd ├── test-concealed.txt ├── test6.cmd ├── cloak.cmd ├── test-issue63.cmd ├── minimal-provideundo.z5.txt ├── test-printcontents.cmd ├── minimal-provideundo.txt ├── test-supporter.cmd ├── getallfrom.cmd ├── test-score.cmd ├── test-directions.cmd ├── test-unknownverb.cmd ├── test-issue85.cmd ├── test-fullscore.cmd ├── test-testbench.cmd ├── test-grammarproperty.cmd ├── test-issue73.txt ├── test-updatescope.cmd ├── test-consultfrom.txt ├── ruletest.cmd ├── test-inputaction.cmd ├── test-type.txt ├── test-consult.cmd ├── test-issue107.cmd ├── test-beforeparsing.txt ├── test-actors.cmd ├── show_content.txt ├── test-allbut.cmd ├── test-issue64.cmd ├── minimal-waittime.txt ├── test-chooseobjects.txt ├── test-flags.txt ├── test-visibility.txt ├── test4.cmd ├── test-issue75.txt ├── test-bottles.txt ├── test-chooseobjectsfinal.txt ├── test5.txt ├── test3.txt ├── grabifnotheld.cmd ├── test-cheapscenery.cmd ├── test-issue103.cmd ├── containers.txt ├── test-concealed.inf ├── indistiguishable.cmd ├── test6.txt ├── test-numbers.txt ├── test-parsetoken.cmd ├── test1.cmd ├── test-grammarproperty.txt ├── getallfrom.txt ├── Makefile ├── test-issue85.txt ├── test-directions.txt ├── test-issue103.txt ├── test-panels.txt ├── test-issue63.txt ├── cloak.txt ├── test2.inf ├── test-allbut.txt ├── test-supporter.txt ├── test-score.txt ├── test-unknownverb.txt ├── test-consult.txt ├── test-issue107.txt ├── test-inputaction.txt ├── test-chooseobjectsfinal.inf ├── test-issue64.txt ├── test-grammar.inf ├── test-parser.cmd ├── test-actors.txt ├── test-fullscore.txt ├── test-issue73.inf ├── show_content.inf ├── test-bottles.inf ├── test-issue75.inf ├── test-issue103.inf ├── test-numbers.inf ├── test-consultfrom.inf ├── test-inputaction.inf ├── test-testbench.txt ├── grabifnotheld.txt ├── test4.txt ├── test-cheapscenery.txt ├── test-printcontents.txt ├── getallfrom.inf ├── test-issue64.inf ├── test-gprheld.inf ├── test-allbut.inf ├── compile_all.rb ├── test-beforeparsing.inf ├── test5.inf ├── test-chooseobjects.inf ├── test-updatescope.inf ├── test-consult.inf ├── containers.inf ├── minimal-provideundo.inf ├── test-issue85.inf ├── runtests.rb ├── test3.inf ├── test-parsetoken.txt ├── test-score.inf ├── minimal-waittime.inf ├── test-updatescope.txt ├── ruletest.inf ├── thirdnoun.inf ├── test-fullscore.inf ├── test-adjectives.inf ├── test-issue107.inf ├── test-issue63.inf ├── test6.inf ├── test-printcontents.inf ├── test-type.inf ├── test1.txt ├── test-grammarproperty.inf └── test-actors.inf ├── documentation ├── technical │ ├── custom.tex │ ├── Makefile │ ├── custom.yaml │ └── dictionary_and_grammar.txt ├── qr │ ├── convert.bat │ └── PunyInformQuickRef_v6.3.odt ├── techreport.pdf ├── manual_v6_3.pdf ├── getting-started.pdf ├── game-authors-guide.pdf ├── PunyInformQuickRef_v6.3.pdf ├── screenshots │ └── simplegame.png └── guides │ ├── getting-started-pic1.png │ ├── getting-started-pic2.png │ ├── getting-started-pic4.png │ ├── getting-started-pic5.png │ ├── getting-started-pic6.png │ └── Makefile ├── .vimrc ├── lib └── .vimrc ├── LICENSE └── howto ├── show_content.inf ├── pushdir.inf ├── colours.inf ├── custom_directions.inf └── adjectives.inf /.gitignore: -------------------------------------------------------------------------------- 1 | *.z? 2 | *.Z? 3 | -------------------------------------------------------------------------------- /tests/testsound.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | quit 4 | yes 5 | 6 | -------------------------------------------------------------------------------- /tests/test-flags.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | listen 5 | quit 6 | yes 7 | 8 | -------------------------------------------------------------------------------- /tests/testsound.txt: -------------------------------------------------------------------------------- 1 | 2 | > quit 3 | Are you sure you want to quit? yes 4 | 5 | -------------------------------------------------------------------------------- /documentation/technical/custom.tex: -------------------------------------------------------------------------------- 1 | \usepackage{longtable}\setlength{\LTleft}{2em} 2 | -------------------------------------------------------------------------------- /tests/largegame.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | get all 4 | drop all 5 | quit 6 | yes 7 | 8 | -------------------------------------------------------------------------------- /tests/test-adjectives.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | say test 5 | quit 6 | yes 7 | 8 | -------------------------------------------------------------------------------- /tests/test2.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | put weight under table 4 | quit 5 | yes 6 | 7 | -------------------------------------------------------------------------------- /tests/test-concealed.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | look 4 | open door 5 | quit 6 | yes 7 | 8 | -------------------------------------------------------------------------------- /tests/minimal-provideundo.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | i 4 | undo 5 | score 6 | quit 7 | yes 8 | 9 | -------------------------------------------------------------------------------- /tests/test-gprheld.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | porter shirt 4 | porter rock 5 | quit 6 | yes 7 | 8 | -------------------------------------------------------------------------------- /tests/test-grammar.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | open apple 4 | close apple 5 | quit 6 | yes 7 | 8 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | " Project specific settings for punyinform 2 | set autoindent noexpandtab tabstop=4 shiftwidth=4 3 | -------------------------------------------------------------------------------- /tests/thirdnoun.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | install battery on mounting with toolbox 4 | quit 5 | yes 6 | 7 | -------------------------------------------------------------------------------- /documentation/qr/convert.bat: -------------------------------------------------------------------------------- 1 | set name=PunyInformQuickRef_v6.3 2 | 3 | pandoc -t gfm %name%.odt -o %name%.md 4 | -------------------------------------------------------------------------------- /lib/.vimrc: -------------------------------------------------------------------------------- 1 | " Project specific settings for punyinform 2 | set autoindent noexpandtab tabstop=4 shiftwidth=4 3 | -------------------------------------------------------------------------------- /tests/test-issue73.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | give julia apple 4 | give apple julia 5 | i 6 | quit 7 | yes 8 | 9 | -------------------------------------------------------------------------------- /documentation/techreport.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/techreport.pdf -------------------------------------------------------------------------------- /documentation/manual_v6_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/manual_v6_3.pdf -------------------------------------------------------------------------------- /tests/test-consultfrom.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | say hello 4 | say halloween 5 | say hello hello 6 | quit 7 | yes 8 | 9 | -------------------------------------------------------------------------------- /documentation/getting-started.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/getting-started.pdf -------------------------------------------------------------------------------- /tests/show_content.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | enter table 4 | get fork 5 | drop fork 6 | look 7 | quit 8 | yes 9 | 10 | -------------------------------------------------------------------------------- /tests/test-type.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | type1 box 5 | type2 box 6 | type3 box in sdas 7 | quit 8 | yes 9 | 10 | -------------------------------------------------------------------------------- /documentation/game-authors-guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/game-authors-guide.pdf -------------------------------------------------------------------------------- /tests/test-beforeparsing.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | i 4 | take all slowly 5 | take all 6 | slowly i 7 | quit 8 | yes 9 | 10 | -------------------------------------------------------------------------------- /tests/test-chooseobjectsfinal.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | l 5 | take ball from box 6 | i 7 | look 8 | quit 9 | yes 10 | 11 | -------------------------------------------------------------------------------- /tests/test-visibility.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | turn torch on 5 | drop torch 6 | n 7 | s 8 | n 9 | quit 10 | yes 11 | 12 | -------------------------------------------------------------------------------- /documentation/PunyInformQuickRef_v6.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/PunyInformQuickRef_v6.3.pdf -------------------------------------------------------------------------------- /documentation/screenshots/simplegame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/screenshots/simplegame.png -------------------------------------------------------------------------------- /tests/test-chooseobjects.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | eat black 4 | drop all 5 | take black 6 | rod 7 | take all 8 | quit 9 | yes 10 | 11 | -------------------------------------------------------------------------------- /documentation/guides/getting-started-pic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/guides/getting-started-pic1.png -------------------------------------------------------------------------------- /documentation/guides/getting-started-pic2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/guides/getting-started-pic2.png -------------------------------------------------------------------------------- /documentation/guides/getting-started-pic4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/guides/getting-started-pic4.png -------------------------------------------------------------------------------- /documentation/guides/getting-started-pic5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/guides/getting-started-pic5.png -------------------------------------------------------------------------------- /documentation/guides/getting-started-pic6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/guides/getting-started-pic6.png -------------------------------------------------------------------------------- /documentation/qr/PunyInformQuickRef_v6.3.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johanberntsson/PunyInform/HEAD/documentation/qr/PunyInformQuickRef_v6.3.odt -------------------------------------------------------------------------------- /tests/thirdnoun.txt: -------------------------------------------------------------------------------- 1 | > install battery on mounting with toolbox 2 | installing with the toolbox 3 | 4 | > quit 5 | Are you sure you want to quit? yes 6 | 7 | -------------------------------------------------------------------------------- /tests/minimal-waittime.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | wait until 1 4 | wait for ten minutes 5 | wait for one hour 6 | wait until 3:05 7 | quit 8 | yes 9 | 10 | -------------------------------------------------------------------------------- /tests/test-issue75.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | x useless 4 | x scenery 5 | x useless scenery 6 | put apple in box 7 | take box 8 | i 9 | quit 10 | yes 11 | 12 | -------------------------------------------------------------------------------- /tests/containers.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | wait sasfas 4 | wait until 12:05 5 | wait until xyzzy 6 | wait xyzzy 7 | wait two 8 | wait 9 | quit 10 | yes 11 | 12 | -------------------------------------------------------------------------------- /tests/largegame.txt: -------------------------------------------------------------------------------- 1 | 2 | > get all 3 | candle: Taken. 4 | 5 | > drop all 6 | candle: Dropped. 7 | 8 | > quit 9 | Are you sure you want to quit? yes 10 | 11 | -------------------------------------------------------------------------------- /tests/test-panels.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | examine control panels 5 | examine navigation panel 6 | g 7 | x control xyzzy 8 | cargo 9 | quit 10 | yes 11 | 12 | -------------------------------------------------------------------------------- /tests/test-bottles.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | look 4 | take all cans 5 | give cans to girl 6 | give all cans to girl 7 | give can to girl 8 | quit 9 | yes 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/test-adjectives.txt: -------------------------------------------------------------------------------- 1 | 2 | > say test 3 | I think you wanted to say "say something to someone". Please try again. 4 | 5 | > quit 6 | Are you sure you want to quit? yes 7 | 8 | -------------------------------------------------------------------------------- /tests/test2.txt: -------------------------------------------------------------------------------- 1 | > put weight under table 2 | (first taking the lead weight) 3 | The lead weight is too heavy to lift. 4 | 5 | > quit 6 | Are you sure you want to quit? yes 7 | 8 | -------------------------------------------------------------------------------- /tests/test5.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | take ball 4 | e 5 | drop all 6 | x ball 7 | x chair 8 | take all 9 | w 10 | w 11 | take ball 12 | take table 13 | i 14 | quit 15 | yes 16 | 17 | -------------------------------------------------------------------------------- /tests/test-grammar.txt: -------------------------------------------------------------------------------- 1 | 2 | > open apple 3 | You can't open that. 4 | 5 | > close apple 6 | I don't understand that sentence. 7 | 8 | > quit 9 | Are you sure you want to quit? yes 10 | 11 | -------------------------------------------------------------------------------- /tests/test-gprheld.txt: -------------------------------------------------------------------------------- 1 | 2 | > porter shirt 3 | (first taking the shirt) 4 | You are now wearing the shirt. 5 | 6 | > porter rock 7 | Taken. 8 | 9 | > quit 10 | Are you sure you want to quit? yes 11 | 12 | -------------------------------------------------------------------------------- /tests/test-numbers.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | push 2 4 | push two 5 | push second button 6 | s 7 | x 1 8 | x one 9 | x 2 10 | take one 11 | take two 12 | press 1 13 | press 2 14 | quit 15 | yes 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/test3.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | ask ladder about me 4 | ask john about me 5 | put john on box 6 | open box 7 | take ladder 8 | drop ladder 9 | take ladder and red from box 10 | quit 11 | yes 12 | 13 | -------------------------------------------------------------------------------- /tests/test-concealed.txt: -------------------------------------------------------------------------------- 1 | Room 1 2 | There are two concealed doors here, one purple and one cyan. 3 | 4 | > open door 5 | You can't see any such thing. 6 | 7 | > quit 8 | Are you sure you want to quit? yes 9 | 10 | -------------------------------------------------------------------------------- /tests/test6.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | what is samarkand 4 | what is a grue 5 | what is the long count 6 | what is punyinform 7 | restart 8 | no 9 | restart me 10 | restart switch 11 | score 12 | quit 13 | yes 14 | 15 | -------------------------------------------------------------------------------- /tests/cloak.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | examine west 4 | push west 5 | push west west 6 | go west 7 | remove hook 8 | e 9 | west 10 | take off cloak 11 | put cloak on hook 12 | e 13 | s 14 | x floor 15 | quit 16 | yes 17 | 18 | -------------------------------------------------------------------------------- /tests/test-issue63.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | open coffre 4 | blanc 5 | look 6 | i 7 | drop coat 8 | x bench 9 | stone 10 | s 11 | x bench 12 | x wooden bench 13 | n 14 | sit on bench 15 | wooden 16 | quit 17 | yes 18 | 19 | -------------------------------------------------------------------------------- /tests/minimal-provideundo.z5.txt: -------------------------------------------------------------------------------- 1 | 2 | > i 3 | You are empty handed. 4 | 5 | > undo 6 | Previous turn undone. 7 | 8 | > score 9 | There is no score in this game. 10 | 11 | > quit 12 | Are you sure you want to quit? yes 13 | 14 | -------------------------------------------------------------------------------- /tests/test-printcontents.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | look 4 | get all 5 | i wide 6 | i tall 7 | fillall 8 | i wide 9 | i tall 10 | put bucket in jar 11 | i wide 12 | i tall 13 | put all on table 14 | look 15 | quit 16 | yes 17 | 18 | -------------------------------------------------------------------------------- /tests/minimal-provideundo.txt: -------------------------------------------------------------------------------- 1 | 2 | > i 3 | You are empty handed. 4 | 5 | > undo 6 | That is not a verb I recognize. 7 | 8 | > score 9 | There is no score in this game. 10 | 11 | > quit 12 | Are you sure you want to quit? yes 13 | 14 | -------------------------------------------------------------------------------- /tests/test-supporter.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | look 4 | get tray 5 | i 6 | i tall 7 | put tray in jar 8 | get jar 9 | put tray in jar 10 | open jar 11 | put tray in jar 12 | i 13 | i wide 14 | get spoon 15 | i 16 | quit 17 | yes 18 | 19 | -------------------------------------------------------------------------------- /tests/getallfrom.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | get all but box 4 | get all from bag 5 | drop all 6 | get all rock 7 | drop all 8 | s 9 | get all but box 10 | get all from bag 11 | drop all 12 | n 13 | n 14 | get all from bag 15 | quit 16 | yes 17 | 18 | -------------------------------------------------------------------------------- /tests/test-score.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | take point 4 | drop point 5 | take all 6 | open box 7 | put all in box 8 | restart 9 | yes 10 | take point 11 | open box 12 | put point in box 13 | take poison 14 | eat poison 15 | quit 16 | yes 17 | 18 | -------------------------------------------------------------------------------- /tests/test-directions.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | x north statue 4 | x statue 5 | north 6 | scan north statue 7 | scan east of north statue 8 | scan north on 9 | take all but e 10 | take s and e 11 | push e w 12 | unlock west with up 13 | quit 14 | yes 15 | 16 | -------------------------------------------------------------------------------- /tests/test-unknownverb.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | xcfdf blue 4 | xyzzy blue 5 | open coffre 6 | blanc 7 | look 8 | i 9 | drop coat 10 | x bench 11 | stone 12 | s 13 | x bench 14 | x wooden bench 15 | n 16 | sit on bench 17 | wooden 18 | quit 19 | yes 20 | 21 | -------------------------------------------------------------------------------- /tests/test-issue85.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | push apple to box 4 | push banana to box 5 | push lemon to box 6 | l 7 | i 8 | take banana 9 | empty box 10 | give apple to indians 11 | give apple to john 12 | ask indians for me 13 | ask john for me 14 | quit 15 | yes 16 | 17 | -------------------------------------------------------------------------------- /tests/test-fullscore.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | take point 4 | drop point 5 | take all 6 | open box 7 | put all in box 8 | restart 9 | yes 10 | take point 11 | open box 12 | score 13 | full score 14 | put point in box 15 | take poison 16 | eat poison 17 | quit 18 | yes 19 | 20 | -------------------------------------------------------------------------------- /tests/test-testbench.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | get books and dial 5 | get dial and books 6 | get books and dial 7 | restart 8 | yes 9 | get blue and all books but blue 10 | open box 11 | put book in box 12 | i 13 | take book from box 14 | brown 15 | quit 16 | yes 17 | 18 | -------------------------------------------------------------------------------- /tests/test-grammarproperty.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | john, take aim 4 | john, take take aim 5 | john, hello 6 | john, take me 7 | john, jump 8 | john, open apple 9 | john, close apple 10 | john, close off apple 11 | john, eat apple 12 | john, drink apple 13 | quit 14 | yes 15 | 16 | -------------------------------------------------------------------------------- /tests/test-issue73.txt: -------------------------------------------------------------------------------- 1 | > give julia apple 2 | (first taking the apple) 3 | julia doesn't seem interested. 4 | 5 | > give apple julia 6 | julia doesn't seem interested. 7 | 8 | > i 9 | You're carrying a apple. 10 | 11 | > quit 12 | Are you sure you want to quit? yes 13 | 14 | -------------------------------------------------------------------------------- /tests/test-updatescope.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | linda, examine the remote object 5 | linda, examine me 6 | bob, examine linda 7 | e 8 | w 9 | x me 10 | bob, x me 11 | bob, give me box 12 | ask bob about box 13 | ask bob for box 14 | take box 15 | drop it 16 | quit 17 | yes 18 | 19 | -------------------------------------------------------------------------------- /documentation/technical/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | sed 's/^# /\\newpage\n# /g' techreport.md > techreport2.md 3 | pandoc --metadata-file=custom.yaml --toc -V documentclass=report --from=markdown+multiline_tables -H custom.tex techreport2.md -o techreport.pdf 4 | rm techreport2.md 5 | mv techreport.pdf .. 6 | -------------------------------------------------------------------------------- /tests/test-consultfrom.txt: -------------------------------------------------------------------------------- 1 | 2 | > say hello 3 | consult_words = 1 4 | consult_from = 2 5 | 6 | > say halloween 7 | consult_words = 1 8 | consult_from = 2 9 | 10 | > say hello hello 11 | consult_words = 2 12 | consult_from = 2 13 | 14 | > quit 15 | Are you sure you want to quit? yes 16 | 17 | -------------------------------------------------------------------------------- /tests/ruletest.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | n 4 | jhn, hello 5 | john, hello 6 | s 7 | jhn, hello 8 | john, hello 9 | john, open xyzzy 10 | john, open in on 11 | john, get cube 12 | john, get red cube 13 | john, examine gun 14 | john, help me 15 | john, say dragon master to me 16 | examine gun 17 | quit 18 | yes 19 | 20 | -------------------------------------------------------------------------------- /tests/test-inputaction.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | get all 4 | drop all 5 | get book 6 | get ball 7 | i tall 8 | drop all 9 | eat book 10 | i 11 | drop all 12 | x ball 13 | eat ball 14 | put ball in box 15 | get ball 16 | drop ball 17 | get it 18 | i 19 | drop all 20 | put book in box 21 | i 22 | quit 23 | yes 24 | 25 | -------------------------------------------------------------------------------- /tests/test-type.txt: -------------------------------------------------------------------------------- 1 | 2 | > type1 box 3 | I think you wanted to say "type1 something into something". Please try again. 4 | 5 | > type2 box 6 | I think you wanted to say "type2 something into something". Please try again. 7 | 8 | > type3 box in sdas 9 | 10 | > quit 11 | Are you sure you want to quit? yes 12 | 13 | -------------------------------------------------------------------------------- /tests/test-consult.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | consult book about ghosts 4 | read about ghosts in book 5 | read ghosts in book 6 | ask john about ghosts 7 | answer ghosts to john 8 | consult book about apple 9 | read about apple in book 10 | read apple in book 11 | ask john about apple 12 | answer apple to john 13 | quit 14 | yes 15 | 16 | -------------------------------------------------------------------------------- /tests/test-issue107.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | 4 | again 5 | take all 6 | drop all 7 | take child 8 | take george 9 | ask george to look 10 | ask george about me 11 | ask george to do something 12 | eat apple 13 | eat apple 14 | eat george 15 | unlock door with key 16 | red 17 | drop all 18 | take blue key 19 | unlock door with key 20 | quit 21 | yes 22 | 23 | -------------------------------------------------------------------------------- /documentation/guides/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | pandoc -V documentclass=report -V colorlinks=true -V linkcolor=red -V urlcolor=blue --from=markdown+multiline_tables game-authors-guide.md -o ../game-authors-guide.pdf 3 | pandoc -V documentclass=article -V colorlinks=true -V linkcolor=red -V urlcolor=blue --from=markdown+multiline_tables getting-started.md -o ../getting-started.pdf 4 | -------------------------------------------------------------------------------- /tests/test-beforeparsing.txt: -------------------------------------------------------------------------------- 1 | > i 2 | You are empty handed. 3 | 4 | > take all slowly 5 | battery: Taken. 6 | mounting: Taken. 7 | toolbox: Taken. 8 | 9 | > take all 10 | There are no things available that match "take all". 11 | 12 | > slowly i 13 | You're carrying a toolbox, a mounting and a battery. 14 | 15 | > quit 16 | Are you sure you want to quit? yes 17 | 18 | -------------------------------------------------------------------------------- /tests/test-actors.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | 4 | again 5 | take all 6 | drop all 7 | take child 8 | take george 9 | ask george to look 10 | ask george about me 11 | ask george to do something 12 | eat apple 13 | eat apple 14 | eat george 15 | unlock door with key 16 | red 17 | drop all 18 | take blue key 19 | unlock door with key 20 | george, look 21 | child, look 22 | quit 23 | yes 24 | 25 | -------------------------------------------------------------------------------- /tests/show_content.txt: -------------------------------------------------------------------------------- 1 | 2 | > enter table 3 | You enter the table. 4 | 5 | > get fork 6 | Taken. 7 | 8 | > drop fork 9 | Dropped. 10 | 11 | > look 12 | 13 | White Room (on the table) 14 | You are in a large white room. 15 | 16 | There is a beautiful table in the middle of the room. 17 | 18 | On the table you can see a fork and a plate. 19 | 20 | > quit 21 | Are you sure you want to quit? yes 22 | 23 | -------------------------------------------------------------------------------- /tests/test-allbut.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | put me in box 4 | take battery 5 | put all in sack 6 | take battery 7 | put me and battery in sack 8 | take battery 9 | put me in sack 10 | look 11 | get out 12 | take battery 13 | drop battery 14 | remove all but battery 15 | wear trousers 16 | x them 17 | remove all but trousers 18 | drop all 19 | take battery.s.n 20 | drop all 21 | take battery.s 22 | quit 23 | yes 24 | 25 | -------------------------------------------------------------------------------- /tests/test-issue64.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | give it to him 4 | give apple to him 5 | give it 6 | give him 7 | x apple 8 | x bob 9 | give it to him 10 | put apple on apple 11 | put apple in apple 12 | search bush 13 | i 14 | drop all 15 | look 16 | i 17 | take all 18 | take pineapple 19 | drop all 20 | i 21 | take pineapple 22 | i 23 | restore 24 | sdsda 25 | eat apple 26 | restore 27 | dasdas 28 | quit 29 | yes 30 | 31 | -------------------------------------------------------------------------------- /tests/minimal-waittime.txt: -------------------------------------------------------------------------------- 1 | 2 | > wait until 1 3 | (tomorrow) 4 | 5 | Time passes. 6 | The time is now 0 minutes past 1. 7 | 8 | > wait for ten minutes 9 | Time passes. 10 | The time is now 10 minutes past 1. 11 | 12 | > wait for one hour 13 | Time passes. 14 | The time is now 10 minutes past 2. 15 | 16 | > wait until 3:05 17 | Time passes. 18 | The time is now 5 minutes past 3. 19 | 20 | > quit 21 | Are you sure you want to quit? yes 22 | 23 | -------------------------------------------------------------------------------- /tests/test-chooseobjects.txt: -------------------------------------------------------------------------------- 1 | 2 | > eat black 3 | (first taking the black cake) 4 | You decide to leave it for later. 5 | 6 | > drop all 7 | black cake: Dropped. 8 | 9 | > take black 10 | Do you mean the black cake or the black rod? 11 | 12 | > rod 13 | Taken. 14 | 15 | > take all 16 | direction: That's hardly portable. 17 | black cake: Taken. 18 | shrubbery: That's hardly portable. 19 | 20 | > quit 21 | Are you sure you want to quit? yes 22 | 23 | -------------------------------------------------------------------------------- /tests/test-flags.txt: -------------------------------------------------------------------------------- 1 | 2 | > listen 3 | Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass 4 | Pass Pass Pass Pass Pass Pass Pass Pass Pass 5 | [Flags error #1: Tried to use flag 101, but the highest flag number is 100] 6 | Pass 7 | FlagValue 32 is 1 8 | FlagValue -32 is 0 9 | FlagValue 33 is 0 10 | FlagValue -33 is 1 11 | yes! yes! yes! yes! yes! yes! yes! yes! yes! yes! 12 | 13 | > quit 14 | Are you sure you want to quit? yes 15 | 16 | -------------------------------------------------------------------------------- /tests/test-visibility.txt: -------------------------------------------------------------------------------- 1 | 2 | > turn torch on 3 | You switch the torch on. 4 | The Library 5 | You are in a library. 6 | 7 | > drop torch 8 | Dropped. 9 | 10 | > n 11 | 12 | *** OnEnterDarkness *** called. 13 | Darkness 14 | It is pitch dark here! 15 | 16 | > s 17 | The Library 18 | 19 | You can see a torch (providing light) here. 20 | 21 | > n 22 | 23 | *** OnEnterDarkness *** called. 24 | Darkness 25 | It is pitch dark here! 26 | 27 | > quit 28 | Are you sure you want to quit? yes 29 | 30 | -------------------------------------------------------------------------------- /tests/test4.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | steal 4 | put me on table then get off 5 | throw ball at air 6 | small red 7 | throw ball at air 8 | throw green ball at air 9 | drop green 10 | take all balls 11 | take red cube 12 | s 13 | put balls in red box 14 | put red cube in transparent 15 | put transparent box in red box 16 | close red box then get transparent box 17 | open red box 18 | take red box 19 | n 20 | put green into box 21 | red 22 | put all cubes in box 23 | red 24 | i 25 | quit 26 | yes 27 | 28 | -------------------------------------------------------------------------------- /tests/test-issue75.txt: -------------------------------------------------------------------------------- 1 | 2 | > x useless 3 | You don't need to refer to "useless" in this game. 4 | 5 | > x scenery 6 | You don't need to refer to "scenery" in this game. 7 | 8 | > x useless scenery 9 | You don't need to refer to "useless" in this game. 10 | 11 | > put apple in box 12 | You can't see any such thing. 13 | 14 | > take box 15 | Why did you pick up the box? 16 | 17 | > i 18 | You're carrying a box (which is open but empty). 19 | 20 | > quit 21 | Are you sure you want to quit? yes 22 | 23 | -------------------------------------------------------------------------------- /tests/test-bottles.txt: -------------------------------------------------------------------------------- 1 | 2 | > look 3 | Room 4 | You are in a room. 5 | 6 | You can see a girl here. 7 | 8 | > take all cans 9 | green can: You already have it. 10 | brown can: You already have it. 11 | 12 | > give cans to girl 13 | You can't use multiple objects with that verb. 14 | 15 | > give all cans to girl 16 | You can't use multiple objects with that verb. 17 | 18 | > give can to girl 19 | Do you mean the green can or the brown can? 20 | 21 | > quit 22 | Are you sure you want to quit? yes 23 | 24 | -------------------------------------------------------------------------------- /tests/test-chooseobjectsfinal.txt: -------------------------------------------------------------------------------- 1 | 2 | > l 3 | The Pub 4 | You are in a pub. 5 | 6 | You can see a table (on which is a red ball) and a box (which contains a green 7 | ball) here. 8 | 9 | > take ball from box 10 | Removed. 11 | 12 | > i 13 | You're carrying a green ball and a pink ball. 14 | 15 | > look 16 | The Pub 17 | You are in a pub. 18 | 19 | You can see a table (on which is a red ball) and a box (which is open but empty) 20 | here. 21 | 22 | > quit 23 | Are you sure you want to quit? yes 24 | 25 | -------------------------------------------------------------------------------- /tests/test5.txt: -------------------------------------------------------------------------------- 1 | > take ball 2 | Taken. 3 | 4 | > e 5 | Darkness 6 | It is pitch dark here! 7 | 8 | > drop all 9 | ball: Dropped. 10 | 11 | > x ball 12 | But it's dark. 13 | 14 | > x chair 15 | You can't see any such thing. 16 | 17 | > take all 18 | ball: Taken. 19 | 20 | > w 21 | Lit Room 22 | 23 | > w 24 | Darkness 25 | It is pitch dark here! 26 | 27 | > take ball 28 | You can't see any such thing. 29 | 30 | > take table 31 | Taken. 32 | 33 | > i 34 | You're carrying a table and a ball. 35 | 36 | > quit 37 | Are you sure you want to quit? yes 38 | 39 | -------------------------------------------------------------------------------- /tests/test3.txt: -------------------------------------------------------------------------------- 1 | 2 | > ask ladder about me 3 | You can only do that to something animate. 4 | 5 | > ask john about me 6 | There is no reply. 7 | 8 | > put john on box 9 | (first taking John) 10 | I don't suppose John would care for that. 11 | 12 | > open box 13 | You open the box, revealing a red book. 14 | 15 | > take ladder 16 | Taken. 17 | 18 | > drop ladder 19 | Dropped. 20 | 21 | > take ladder and red from box 22 | ladder: But the ladder isn't there now. 23 | red book: Yay, got rid of the red book! 24 | 25 | > quit 26 | Are you sure you want to quit? yes 27 | 28 | -------------------------------------------------------------------------------- /tests/grabifnotheld.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | pry box with gizmo 4 | i 5 | drop all 6 | throw gizmo at box 7 | i 8 | drop all 9 | insert gizmo in box 10 | i 11 | drop all 12 | transfer gizmo to box 13 | i 14 | drop all 15 | put on gizmo 16 | i 17 | drop all 18 | empty box 19 | i 20 | look 21 | s 22 | what is samarkand 23 | what is book 24 | what is green book 25 | what is green 26 | what is sdasfafaf 27 | take green 28 | what is green 29 | what is green book 30 | show green 31 | show green to sally 32 | show sally green 33 | show green to blue 34 | show green blue 35 | quit 36 | yes 37 | 38 | -------------------------------------------------------------------------------- /tests/test-cheapscenery.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | x volume 5 | get old book 6 | x paper 7 | push papers 8 | x them 9 | x the big library 10 | push the library 11 | x air 12 | get air 13 | x atmosphere 14 | pull walls 15 | x ceiling 16 | push ceiling 17 | x it 18 | x pushpull button 19 | x light 20 | push pushpull button 21 | pull pushpull button 22 | turn on switch 23 | x light 24 | push pushpull button 25 | pull pushpull button 26 | e 27 | x it 28 | x book 29 | get the single book 30 | push table 31 | x tables 32 | x room 33 | turn reading room 34 | x air 35 | push air 36 | quit 37 | yes 38 | 39 | -------------------------------------------------------------------------------- /tests/test-issue103.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | enter 4 | exit 5 | wear hat 6 | i 7 | take off hat 8 | take off hat 9 | remove hat 10 | drop hat 11 | take off hat 12 | remove hat 13 | quit 14 | yes 15 | 16 | -------------------------------------------------------------------------------- /tests/containers.txt: -------------------------------------------------------------------------------- 1 | 2 | > wait sasfas 3 | I didn't understand that number. 4 | 5 | > wait until 12:05 6 | Time passes. 7 | The time is: 0:0 8 | The time is: 0:1 9 | The time is: 0:2 10 | The time is: 0:3 11 | The time is: 0:4 12 | Let's go! 13 | 14 | > wait until xyzzy 15 | I only understood you as far as "wait until" but then you lost me. 16 | 17 | > wait xyzzy 18 | I didn't understand that number. 19 | 20 | > wait two 21 | Time passes. 22 | The time is: 0:5 23 | The time is: 0:6 24 | Let's go! 25 | 26 | > wait 27 | Let's go! 28 | The time is: 0:7 29 | 30 | > quit 31 | Are you sure you want to quit? yes 32 | 33 | -------------------------------------------------------------------------------- /tests/test-concealed.inf: -------------------------------------------------------------------------------- 1 | Constant OPTIONAL_EXTENDED_METAVERBS; 2 | Constant INITIAL_LOCATION_VALUE = Room1; 3 | 4 | Include "globals"; 5 | Include "puny"; 6 | 7 | Object Room1 "Room 1" 8 | with 9 | description "There are two concealed doors here, one purple and one cyan.", 10 | has light; 11 | 12 | Object -> PurpleDoor "purple door" 13 | with 14 | name 'purple' 'door', 15 | description "Very purple.", 16 | has openable lockable locked concealed; 17 | 18 | Object -> CyanDoor "cyan door" 19 | with 20 | name 'cyan' 'door', 21 | description "Very cyan.", 22 | has openable lockable locked concealed; 23 | 24 | Constant Initialise = 0; 25 | -------------------------------------------------------------------------------- /tests/indistiguishable.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | look 4 | drop two darts 5 | take a dart 6 | take 5 kg bell 7 | drop all 8 | take two gold 9 | i 10 | drop all 11 | take two coins 12 | i 13 | drop all 14 | look 15 | x coin 16 | silver 17 | x coins 18 | gold 19 | take silver 20 | take silver coins 21 | take gold coin 22 | take coins 23 | x dart 24 | x darts 25 | search dart 26 | search darts 27 | get darts 28 | throw dart at board 29 | look 30 | throw dart at board 31 | look 32 | throw dart at board 33 | look 34 | take all darts 35 | look 36 | put all in box 37 | close box 38 | drop 5 coin 39 | get 5 coin 40 | get coin 41 | s 42 | push 2 43 | push two 44 | push second button 45 | s 46 | x 1 47 | x 2 48 | quit 49 | yes 50 | 51 | 52 | -------------------------------------------------------------------------------- /tests/test6.txt: -------------------------------------------------------------------------------- 1 | 2 | > what is samarkand 3 | Samarkand is a city in south-eastern Uzbekistan. 4 | 5 | > what is a grue 6 | Don't tell me you don't know. 7 | 8 | > what is the long count 9 | The Long Count is the great Mayan cycle of time, which began in 3114 BC and will 10 | finish with the world's end in 2012 AD. 11 | 12 | > what is punyinform 13 | At the moment, even the simplest questions confuse you. 14 | 15 | > restart 16 | Are you sure you want to restart? no 17 | 18 | > restart me 19 | You're not something you can switch. 20 | 21 | > restart switch 22 | You switch the light switch on. 23 | 24 | > score 25 | You have so far scored 0 out of a possible 0, in 5 turns. 26 | 27 | > quit 28 | Are you sure you want to quit? yes 29 | 30 | -------------------------------------------------------------------------------- /tests/test-numbers.txt: -------------------------------------------------------------------------------- 1 | 2 | > push 2 3 | Something happens here. 4 | 5 | > push two 6 | Something happens here. 7 | 8 | > push second button 9 | Something happens here. 10 | 11 | > s 12 | Note Room 13 | You are in the button room. 14 | 15 | You can see a step one and a step two here. 16 | 17 | > x 1 18 | There is nothing special about the step one. 19 | 20 | > x one 21 | There is nothing special about the step one. 22 | 23 | > x 2 24 | There is nothing special about the step two. 25 | 26 | > take one 27 | step one: That's fixed in place. 28 | 29 | > take two 30 | step two: That's fixed in place. 31 | 32 | > press 1 33 | That's fixed in place. 34 | 35 | > press 2 36 | That's fixed in place. 37 | 38 | > quit 39 | Are you sure you want to quit? yes 40 | 41 | -------------------------------------------------------------------------------- /tests/test-parsetoken.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | . 4 | .. 5 | , 6 | 7 | x john 8 | x beautiful 9 | x the beautiful john 10 | scan1 paper 11 | scan1 paper and paperclip 12 | scan1 paper with me 13 | scan1 all 14 | scan2 paper 15 | scan2 paper and paperclip 16 | scan2 all 17 | scan3 paper 18 | scan3 paper here 19 | scan3 john here 20 | scan3 john 21 | scan4 paper 22 | scan4 paper here 23 | scan4 john here 24 | scan4 john 25 | bang 100 26 | wow asdsadas 27 | wow john 28 | wow apple 29 | bang xyzzy 30 | yeah 31 | s 32 | x egg 33 | x yolk 34 | x yummy 35 | x yummy egg 36 | x yummy yolk 37 | x the egg 38 | x the yummy egg 39 | x apple 40 | x apricot 41 | x banana 42 | take apricot and egg 43 | take banana and egg 44 | take apple. go north 45 | s 46 | take banana. go north 47 | quit 48 | yes 49 | 50 | -------------------------------------------------------------------------------- /tests/test1.cmd: -------------------------------------------------------------------------------- 1 | transcript 2 | 3 | i.i 4 | take red 5 | i 6 | take red 7 | red 8 | take red 9 | ball 10 | drop all 11 | take all red 12 | take blue ball 13 | take blue cube 14 | take blue ball and blue cube 15 | drop all 16 | get ball 17 | red 18 | get all balls 19 | get cubes 20 | drop black cube 21 | drop cubes 22 | drop cubes 23 | get black ball 24 | s 25 | put all balls but the red one in the red box 26 | put all in transparent 27 | get all balls from transparent 28 | get all from transparent 29 | drop red ball 30 | get it 31 | get all from red box 32 | drop all 33 | get all boxes 34 | n 35 | put all on the table 36 | put transparent box in red box 37 | enter transparent box 38 | enter red box 39 | enter table 40 | enter transparent box 41 | enter red box 42 | enter transparent box 43 | enter table 44 | exit 45 | exit 46 | exit 47 | quit 48 | yes 49 | 50 | -------------------------------------------------------------------------------- /tests/test-grammarproperty.txt: -------------------------------------------------------------------------------- 1 | 2 | > john, take aim 3 | grammar 3 0 4 | "Okay, I'm aiming." 5 | 6 | > john, take take aim 7 | grammar 3 0 8 | answer words 3 from 3 9 | There is no reply. 10 | 11 | > john, hello 12 | grammar 3 0 13 | answer words 1 from 3 14 | There is no reply. 15 | 16 | > john, take me 17 | grammar 3 0 18 | order ##Take 19 | John has better things to do. 20 | 21 | > john, jump 22 | grammar 3 1 23 | I have nothing 24 | 25 | > john, open apple 26 | grammar 3 0 27 | answer words 2 from 3 28 | There is no reply. 29 | 30 | > john, close apple 31 | grammar 3 0 32 | Why do you want me to close the apple. 33 | 34 | > john, close off apple 35 | grammar 3 0 36 | I switch off the apple. 37 | 38 | > john, eat apple 39 | grammar 3 0 40 | I eat 41 | 42 | > john, drink apple 43 | grammar 3 0 44 | answer words 2 from 3 45 | There is no reply. 46 | 47 | > quit 48 | Are you sure you want to quit? yes 49 | 50 | -------------------------------------------------------------------------------- /tests/getallfrom.txt: -------------------------------------------------------------------------------- 1 | 2 | > get all but box 3 | There are no things available that match "get all but box". 4 | 5 | > get all from bag 6 | rock: Removed. 7 | 8 | > drop all 9 | rock: Dropped. 10 | 11 | > get all rock 12 | Taken. 13 | 14 | > drop all 15 | rock: Dropped. 16 | 17 | > s 18 | Static box 19 | The room with the static box and static bag. Exits n 20 | 21 | There's a box here. In the box is a bag (which contains a rock). 22 | 23 | > get all but box 24 | There are no things available that match "get all but box". 25 | 26 | > get all from bag 27 | rock: Removed. 28 | 29 | > drop all 30 | rock: Dropped. 31 | 32 | > n 33 | Normal box 34 | 35 | There's a box here. In the box is a bag (which is empty). 36 | 37 | You can also see a rock here. 38 | 39 | > n 40 | Concealed box 41 | The room with the concealed box. Exits s 42 | 43 | > get all from bag 44 | rock: Removed. 45 | 46 | > quit 47 | Are you sure you want to quit? yes 48 | 49 | -------------------------------------------------------------------------------- /documentation/technical/custom.yaml: -------------------------------------------------------------------------------- 1 | title: PunyInform 2 | toc: true 3 | include-before: | 4 | **PunyInform** 5 | 6 | A fast and compact library for writing text adventure games for the Z-machine running on 8-bit computers as well as other platforms. 7 | 8 |   9 | 10 |   11 | 12 | PunyInform was conceived and designed by Johan Berntsson and Fredrik Ramsberg. Coding by Johan Berntsson, Fredrik Ramsberg, Pablo Martinez and Tomas Öberg. Includes code from the Inform 6 standard library, by Graham Nelson. Thanks to Stefan Vogt, Jason Compton, John Wilson, Hugo Labrande, Richard Fairweather, Adam Sommerfield, auraes and Hannesss for issue reporting, advice, testing, code contributions and promotion. Thanks to David Kinder and Andrew Plotkin for helping out with compiler issues and sharing their deep knowledge of the compiler. Huge thanks to Graham Nelson for creating the Inform 6 compiler and library in the first place. 13 | 14 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | all: runtests 2 | 3 | runtests: 4 | ruby runtests.rb 5 | 6 | inform: 7 | inform -v8 -D test-bottles.inf 8 | frotz test-bottles.z8 9 | 10 | test-numbers: 11 | inform +../lib -v3 test-numbers.inf 12 | frotz test-numbers.z3 13 | 14 | test-bottles5: 15 | inform +../lib -v5 test-bottles.inf 16 | frotz test-bottles.z5 17 | 18 | test-unknownverb: 19 | inform +../lib -v3 test-unknownverb.inf 20 | frotz test-unknownverb.z3 21 | 22 | indistiguishable: 23 | inform +../lib -v3 indistiguishable.inf 24 | frotz indistiguishable.z3 25 | 26 | large3: 27 | inform +../lib -v3 largegame.inf 28 | frotz largegame.z3 29 | 30 | large5: 31 | inform +../lib -v5 largegame.inf 32 | frotz largegame.z5 33 | 34 | test-chooseobjectsfinal: 35 | inform +../lib -v5 -s -S -D test-chooseobjectsfinal.inf 36 | frotz test-chooseobjectsfinal.z5 37 | 38 | test-panels: 39 | inform +../lib -v3 -s test-panels.inf 40 | frotz test-panels.z3 41 | 42 | clean: 43 | rm -f *z3 *z5 *z8 *scr *output *messages 44 | -------------------------------------------------------------------------------- /tests/test-issue85.txt: -------------------------------------------------------------------------------- 1 | 2 | > push apple to box 3 | taking apple 4 | Apples are verboten 5 | 6 | > push banana to box 7 | taking banana 8 | You put the banana into the box. 9 | 10 | > push lemon to box 11 | taking lemon 12 | You put the lemon into the box. 13 | 14 | > l 15 | The Library 16 | You are in a library. 17 | 18 | You can see a box (which contains a lemon and a banana), some Apache Indians and 19 | John here. 20 | 21 | > i 22 | You're carrying a apple. 23 | 24 | > take banana 25 | taking banana 26 | It seems to be stuck inside the box. 27 | 28 | > empty box 29 | lemon: taking lemon 30 | Dropped. 31 | banana: taking banana 32 | It seems to be stuck inside the box. 33 | 34 | > give apple to indians 35 | The Apache Indians don't seem interested. 36 | 37 | > give apple to john 38 | John doesn't seem interested. 39 | 40 | > ask indians for me 41 | The Apache Indians have better things to do. 42 | 43 | > ask john for me 44 | John has better things to do. 45 | 46 | > quit 47 | Are you sure you want to quit? yes 48 | 49 | -------------------------------------------------------------------------------- /tests/test-directions.txt: -------------------------------------------------------------------------------- 1 | 2 | > x north statue 3 | There is nothing special about the north statue. 4 | 5 | > x statue 6 | Do you mean the north statue or the south statue? 7 | 8 | > north 9 | There is nothing special about the north statue. 10 | 11 | > scan north statue 12 | Action ##Scan. 13 | No direction is set. 14 | Noun is 10 (north statue) 15 | Second is 0 (not a proper object) 16 | 17 | > scan east of north statue 18 | Action ##ScanDirOf. 19 | Direction is 3 (east) 20 | Noun is 5 (east) 21 | Second is 10 (north statue) 22 | 23 | > scan north on 24 | Action ##ScanNorthOn. 25 | No direction is set. 26 | Noun is 0 (not a proper object) 27 | Second is 0 (not a proper object) 28 | 29 | > take all but e 30 | There are no things available that match "take all but e". 31 | 32 | > take s and e 33 | You can't see any such thing. 34 | 35 | > push e w 36 | You can't use multiple directions. 37 | 38 | > unlock west with up 39 | You can't use multiple directions. 40 | 41 | > quit 42 | Are you sure you want to quit? yes 43 | 44 | -------------------------------------------------------------------------------- /tests/test-issue103.txt: -------------------------------------------------------------------------------- 1 | 2 | > enter 3 | Restroom 4 | You are in a restroom. 5 | 6 | > exit 7 | The Library 8 | 9 | You can see a hat here. 10 | 11 | > wear hat 12 | (first taking the hat) 13 | You are now wearing the hat. 14 | 15 | > i 16 | You're carrying a hat (worn). 17 | 18 | > take off hat 19 | You take off the hat. 20 | 21 | > take off hat 22 | You're not wearing the hat. 23 | 24 | > remove hat 25 | You already have it. 26 | 27 | > drop hat 28 | Dropped. 29 | 30 | > take off hat 31 | You're not wearing the hat. 32 | 33 | > remove hat 34 | Taken. 35 | 36 | > quit 37 | Are you sure you want to quit? yes 38 | 39 | -------------------------------------------------------------------------------- /tests/test-panels.txt: -------------------------------------------------------------------------------- 1 | 2 | > examine control panels 3 | I only understood you as far as "examine control" but then you lost me. 4 | 5 | > examine navigation panel 6 | You're only a sailor, not a navigator, so you don't understand what the controls 7 | on the navigation panel are used for. However, you can see that the sonar shows 8 | that the ship is only a few miles off the coast. With the engines off, the ship 9 | will drift to shore within a few hours and the deadly chlorine gas could 10 | potentially kill hundreds of people. 11 | 12 | > g 13 | You're only a sailor, not a navigator, so you don't understand what the controls 14 | on the navigation panel are used for. However, you can see that the sonar shows 15 | that the ship is only a few miles off the coast. With the engines off, the ship 16 | will drift to shore within a few hours and the deadly chlorine gas could 17 | potentially kill hundreds of people. 18 | 19 | > x control xyzzy 20 | I only understood you as far as "x control" but then you lost me. 21 | 22 | > cargo 23 | That is not a verb I recognize. 24 | 25 | > quit 26 | Are you sure you want to quit? yes 27 | 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Fredrik Ramsberg and Johan Berntsson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/test-issue63.txt: -------------------------------------------------------------------------------- 1 | 2 | > open coffre 3 | Do you mean the coffre noir or the coffre blanc? 4 | 5 | > blanc 6 | You open the coffre blanc, revealing nothing. 7 | 8 | > look 9 | Park 10 | You are in a park. There is a wooden bench and a stone bench here. You can go 11 | south. 12 | 13 | You can see a blue coat, a coffre noir (which is closed) and a coffre blanc 14 | (which is open but empty) here. 15 | 16 | > i 17 | You're carrying a red coat. 18 | 19 | > drop coat 20 | Dropped. 21 | 22 | > x bench 23 | Do you mean the wooden bench or the stone bench? 24 | 25 | > stone 26 | a stone bench 27 | 28 | > s 29 | Room 30 | You are in a room. There is a wooden bench here and a park to the north. 31 | 32 | You can see a stone bench here. 33 | 34 | > x bench 35 | a stone bench 36 | 37 | > x wooden bench 38 | a wooden bench 39 | 40 | > n 41 | Park 42 | 43 | You can see a red coat, a blue coat, a coffre noir (which is closed) and a 44 | coffre blanc (which is open but empty) here. 45 | 46 | > sit on bench 47 | Do you mean the wooden bench or the stone bench? 48 | 49 | > wooden 50 | You enter the wooden bench. 51 | 52 | > quit 53 | Are you sure you want to quit? yes 54 | 55 | -------------------------------------------------------------------------------- /tests/cloak.txt: -------------------------------------------------------------------------------- 1 | 2 | > examine west 3 | A pretty statue of Medusa. 4 | 5 | > push west 6 | Better leave the statue alone! 7 | 8 | > push west west 9 | You try to push the statue west, but to no avail! 10 | 11 | > go west 12 | Cloakroom 13 | The walls of this small room were clearly once lined with hooks, though now only 14 | one remains. The exit is a door to the east. 15 | 16 | > remove hook 17 | That's hardly portable. 18 | 19 | > e 20 | Foyer of the Opera House 21 | 22 | > west 23 | Cloakroom 24 | 25 | > take off cloak 26 | You take off the velvet cloak. 27 | 28 | > put cloak on hook 29 | You put the velvet cloak on the small brass hook. 30 | 31 | [The score has just gone up by 1 point.] 32 | 33 | > e 34 | Foyer of the Opera House 35 | 36 | > s 37 | Foyer bar 38 | The bar, much rougher than you'd have guessed after the opulence of the foyer to 39 | the north, is completely empty. There seems to be some sort of message scrawled 40 | in the sawdust on the floor. 41 | 42 | > x floor 43 | The message, neatly marked in the sawdust, reads... 44 | [The score has just gone up by 1 point.] 45 | 46 | 47 | *** You have won *** 48 | 49 | In that game you scored 2 out of a possible 2, in 12 turns. 50 | 51 | Would you like to RESTART, RESTORE or QUIT? quit 52 | 53 | -------------------------------------------------------------------------------- /tests/test2.inf: -------------------------------------------------------------------------------- 1 | ! This test checks issue 21. "held" grammar 2 | ! https://github.com/johanberntsson/PunyInform/issues/21 3 | 4 | Constant Story "Minimal"; 5 | Constant Headline "^A sample game which uses PunyInform.^"; 6 | 7 | Constant INITIAL_LOCATION_VALUE = example_room; 8 | 9 | Constant OPTIONAL_EXTENDED_METAVERBS; 10 | !Constant DEBUG_PARSEANDPERFORM; 11 | !Constant DEBUG_PARSEPATTERN; 12 | !Constant DEBUG_PARSETOKEN; 13 | !Constant DEBUG_PARSENOUNPHRASE; 14 | !Constant DEBUG_GETNEXTNOUN; 15 | !Constant DEBUG_SCOPE; 16 | Include "globals.h"; 17 | Include "puny.h"; 18 | 19 | Object example_room "Example Room" 20 | with description "You are in an example room, for test purposes.", 21 | has light; 22 | 23 | Object weight "lead weight" example_room 24 | with name 'lead' 'weight', 25 | before [; 26 | Take: print_ret (The) self, " is too heavy to lift."; 27 | ] 28 | ; 29 | 30 | Object table "table" example_room 31 | with name 'table'; 32 | 33 | [Initialise; 34 | return 2; 35 | ]; 36 | 37 | !Verb 'place' = 'put'; 38 | 39 | Extend 'put' 40 | * held 'under' noun -> PutUnder; 41 | 42 | [PutUnderSub; 43 | remove noun; 44 | if (AfterRoutines()) return; 45 | "You put ", (the) noun, " under ", (the) second, ".^^", (The) noun, " suddenly vanishes!"; 46 | ]; 47 | -------------------------------------------------------------------------------- /tests/test-allbut.txt: -------------------------------------------------------------------------------- 1 | 2 | > put me in box 3 | Not a good idea 4 | 5 | > take battery 6 | Taken. 7 | 8 | > put all in sack 9 | battery: You put the battery into the sack. 10 | 11 | > take battery 12 | Taken. 13 | 14 | > put me and battery in sack 15 | yourself: You enter the sack. 16 | battery: You put the battery into the sack. 17 | 18 | > take battery 19 | Taken. 20 | 21 | > put me in sack 22 | But you are already there! 23 | 24 | > look 25 | Lit Room (in the sack) 26 | You are in a brightly lit room. 27 | 28 | You can see some trousers and a box (which is empty) here. 29 | 30 | > get out 31 | You leave the sack. 32 | 33 | > take battery 34 | You already have it. 35 | 36 | > drop battery 37 | Dropped. 38 | 39 | > remove all but battery 40 | trousers: Taken. 41 | 42 | > wear trousers 43 | You are now wearing the trousers. 44 | 45 | > x them 46 | There is nothing special about the trousers. 47 | 48 | > remove all but trousers 49 | battery: Taken. 50 | 51 | > drop all 52 | battery: Dropped. 53 | 54 | > take battery.s.n 55 | Taken. 56 | 57 | Another Room 58 | You are the other room. 59 | 60 | Lit Room 61 | 62 | You can see a box (which is empty) and a sack (which is empty) here. 63 | 64 | > drop all 65 | battery: Dropped. 66 | 67 | > take battery.s 68 | Taken. 69 | 70 | Another Room 71 | 72 | > quit 73 | Are you sure you want to quit? yes 74 | 75 | -------------------------------------------------------------------------------- /tests/test-supporter.txt: -------------------------------------------------------------------------------- 1 | 2 | > look 3 | The Library 4 | You are in a library. 5 | 6 | You can see a tray (on which are a plate, a bell jar (which is closed and 7 | contains a head of celery) and a spoon) here. 8 | 9 | > get tray 10 | Taken. 11 | 12 | > i 13 | You're carrying a tray (on which are a plate, a bell jar (which is closed and 14 | contains a head of celery) and a spoon). 15 | 16 | > i tall 17 | You're carrying: 18 | a tray 19 | a plate 20 | a bell jar (which is closed) 21 | a head of celery 22 | a spoon 23 | 24 | > put tray in jar 25 | You can't put something inside itself. 26 | 27 | > get jar 28 | Taken. 29 | 30 | > put tray in jar 31 | You can't, since the bell jar is closed. 32 | 33 | > open jar 34 | You open the bell jar. 35 | 36 | > put tray in jar 37 | You put the tray into the bell jar. 38 | 39 | > i 40 | You're carrying: 41 | a bell jar (which is open) 42 | a tray 43 | a plate 44 | a spoon 45 | a head of celery 46 | 47 | > i wide 48 | You're carrying a bell jar (which is open and contains a tray (on which are a 49 | plate and a spoon) and a head of celery). 50 | 51 | > get spoon 52 | Taken. 53 | 54 | > i 55 | You're carrying a spoon and a bell jar (which is open and contains a tray (on 56 | which is a plate) and a head of celery). 57 | 58 | > quit 59 | Are you sure you want to quit? yes 60 | 61 | -------------------------------------------------------------------------------- /tests/test-score.txt: -------------------------------------------------------------------------------- 1 | 2 | > take point 3 | Taken. 4 | 5 | > drop point 6 | Dropped. 7 | 8 | > take all 9 | one point: Taken. 10 | poison: Taken. 11 | toy: Taken. 12 | torch: Taken. 13 | 14 | > open box 15 | You open the box, revealing nothing. 16 | 17 | > put all in box 18 | torch: You put the torch into the box. 19 | toy: You put the toy into the box. 20 | poison: You put the poison into the box. 21 | one point: You put the one point into the box. 22 | 23 | [The score has just gone up by 4 points.] 24 | 25 | 26 | *** You have won *** 27 | 28 | In that game you scored 4 out of a possible 4, in 5 turns. 29 | 30 | Would you like to RESTART, RESTORE or QUIT? restart 31 | 32 | 33 | The testsuite is open for business! 34 | 35 | 36 | Parser test 37 | 38 | Lit Room 39 | You are in a brightly lit room. 40 | 41 | You can see a box (which is closed), a poison, a one point, a toy and a torch 42 | here. 43 | 44 | > yes 45 | That is not a verb I recognize. 46 | 47 | > take point 48 | Taken. 49 | 50 | > open box 51 | You open the box, revealing nothing. 52 | 53 | > put point in box 54 | You put the one point into the box. 55 | 56 | [The score has just gone up by 1 point.] 57 | 58 | > take poison 59 | Taken. 60 | 61 | > eat poison 62 | AAAargh! 63 | 64 | 65 | *** You have died *** 66 | 67 | In that game you scored 1 out of a possible 4, in 5 turns. 68 | 69 | Would you like to RESTART, RESTORE or QUIT? quit 70 | -------------------------------------------------------------------------------- /tests/test-unknownverb.txt: -------------------------------------------------------------------------------- 1 | 2 | > xcfdf blue 3 | UnknownVerb 'xcfdf': not xyzzy, leaving unknown 4 | That is not a verb I recognize. 5 | 6 | > xyzzy blue 7 | UnknownVerb 'xyzzy': got xyzzy changing it to 'examine' 8 | This is a blue coat. 9 | 10 | > open coffre 11 | Do you mean the coffre noir or the coffre blanc? 12 | 13 | > blanc 14 | You open the coffre blanc, revealing nothing. 15 | 16 | > look 17 | Park 18 | You are in a park. There is a wooden bench and a stone bench here. You can go 19 | south. 20 | 21 | You can see a blue coat, a coffre noir (which is closed) and a coffre blanc 22 | (which is open but empty) here. 23 | 24 | > i 25 | You're carrying a red coat. 26 | 27 | > drop coat 28 | Dropped. 29 | 30 | > x bench 31 | Do you mean the wooden bench or the stone bench? 32 | 33 | > stone 34 | a stone bench 35 | 36 | > s 37 | UnknownVerb 's': not xyzzy, leaving unknown 38 | Room 39 | You are in a room. There is a wooden bench here and a park to the north. 40 | 41 | You can see a stone bench here. 42 | 43 | > x bench 44 | a stone bench 45 | 46 | > x wooden bench 47 | a wooden bench 48 | 49 | > n 50 | UnknownVerb 'n': not xyzzy, leaving unknown 51 | Park 52 | 53 | You can see a red coat, a blue coat, a coffre noir (which is closed) and a 54 | coffre blanc (which is open but empty) here. 55 | 56 | > sit on bench 57 | Do you mean the wooden bench or the stone bench? 58 | 59 | > wooden 60 | You enter the wooden bench. 61 | 62 | > quit 63 | Are you sure you want to quit? yes 64 | 65 | -------------------------------------------------------------------------------- /tests/test-consult.txt: -------------------------------------------------------------------------------- 1 | 2 | > consult book about ghosts 3 | special_number = 0 4 | consult_words = 1 5 | consult_from = 4 6 | You discover nothing of interest in the book. 7 | 8 | > read about ghosts in book 9 | special_number = 0 10 | consult_words = 1 11 | consult_from = 3 12 | You discover nothing of interest in the book. 13 | 14 | > read ghosts in book 15 | special_number = 0 16 | consult_words = 1 17 | consult_from = 2 18 | You discover nothing of interest in the book. 19 | 20 | > ask john about ghosts 21 | ??? 22 | special_number = 0 23 | consult_words = 1 24 | consult_from = 4 25 | John ignores your question. 26 | 27 | > answer ghosts to john 28 | ??? 29 | special_number = 0 30 | consult_words = 1 31 | consult_from = 2 32 | no answer. 33 | 34 | > consult book about apple 35 | special_number = 0 36 | consult_words = 1 37 | consult_from = 4 38 | You discover nothing of interest in the book. 39 | 40 | > read about apple in book 41 | special_number = 0 42 | consult_words = 1 43 | consult_from = 3 44 | You discover nothing of interest in the book. 45 | 46 | > read apple in book 47 | special_number = 0 48 | consult_words = 1 49 | consult_from = 2 50 | You discover nothing of interest in the book. 51 | 52 | > ask john about apple 53 | apple 54 | special_number = 0 55 | consult_words = 1 56 | consult_from = 4 57 | John ignores your question. 58 | 59 | > answer apple to john 60 | apple 61 | special_number = 0 62 | consult_words = 1 63 | consult_from = 2 64 | no answer. 65 | 66 | > quit 67 | Are you sure you want to quit? yes 68 | 69 | -------------------------------------------------------------------------------- /tests/test-issue107.txt: -------------------------------------------------------------------------------- 1 | 2 | > 3 | Come again? 4 | 5 | > again 6 | You can hardly repeat that. 7 | 8 | > take all 9 | apple: Taken. 10 | red key: Taken. 11 | blue key: Taken. 12 | child: Taken. 13 | 14 | > drop all 15 | child: Dropped. 16 | blue key: Dropped. 17 | red key: Dropped. 18 | apple: Dropped. 19 | 20 | > take child 21 | Taken. 22 | 23 | > take george 24 | before: George/13 nothing/0 25 | I don't suppose George would care for that. 26 | 27 | > ask george to look 28 | orders: nothing/0 nothing/0 29 | orders look 30 | life: nothing/0 nothing/0 31 | George has better things to do. 32 | 33 | > ask george about me 34 | before: George/13 /1 35 | ask 36 | life: George/13 /1 37 | Life Ask 38 | There is no reply. 39 | 40 | > ask george to do something 41 | orders: George/13 /1 42 | orders askto 4 2 43 | before: George/13 George/13 44 | life: George/13 George/13 45 | Life 46 | Life Answer 47 | There is no reply. 48 | 49 | > eat apple 50 | (first taking the apple) 51 | That's plainly inedible. 52 | 53 | > eat apple 54 | That's plainly inedible. 55 | 56 | > eat george 57 | before: George/13 nothing/0 58 | I don't suppose George would care for that. 59 | 60 | > unlock door with key 61 | Do you mean the red key or the blue key? 62 | 63 | > red 64 | (first taking the red key) 65 | The red key doesn't seem to fit the lock. 66 | 67 | > drop all 68 | red key: Dropped. 69 | apple: Dropped. 70 | child: Dropped. 71 | 72 | > take blue key 73 | Taken. 74 | 75 | > unlock door with key 76 | You unlock the door. 77 | 78 | > quit 79 | Are you sure you want to quit? yes 80 | 81 | -------------------------------------------------------------------------------- /tests/test-inputaction.txt: -------------------------------------------------------------------------------- 1 | 2 | > get all 3 | box: Taken. 4 | ball: (You decide to pick up the book as well) 5 | Taken. 6 | Taken. 7 | book: You can't deliberately pick it up. Trying to eat it should make you pick 8 | it up though! 9 | 10 | > drop all 11 | ball: Dropped. 12 | book: Dropped. 13 | box: Dropped. 14 | 15 | > get book 16 | You can't deliberately pick it up. Trying to eat it should make you pick it up 17 | though! 18 | 19 | > get ball 20 | (You decide to pick up the book as well) 21 | Taken. 22 | Taken. 23 | 24 | > i tall 25 | You're carrying: 26 | a ball 27 | a book 28 | 29 | > drop all 30 | ball: Dropped. 31 | book: Dropped. 32 | 33 | > eat book 34 | (first taking the book) 35 | That's plainly inedible. 36 | 37 | > i 38 | You're carrying: 39 | a book 40 | 41 | > drop all 42 | book: Dropped. 43 | 44 | > x ball 45 | This ball can be picked up, but not with an implicit action. 46 | 47 | > eat ball 48 | (first taking the ball) 49 | The ball can't be picked up with an implicit action! 50 | 51 | > put ball in box 52 | (first taking the ball) 53 | The ball can't be picked up with an implicit action! 54 | 55 | > get ball 56 | (You decide to pick up the book as well) 57 | Taken. 58 | Taken. 59 | 60 | > drop ball 61 | Dropped. 62 | 63 | > get it 64 | Taken. 65 | 66 | > i 67 | You're carrying: 68 | a ball 69 | a book 70 | 71 | > drop all 72 | ball: Dropped. 73 | book: Dropped. 74 | 75 | > put book in box 76 | (first taking the book) 77 | You can't deliberately pick it up. Trying to eat it should make you pick it up 78 | though! 79 | 80 | > i 81 | You are empty handed. 82 | 83 | > quit 84 | Are you sure you want to quit? yes 85 | 86 | -------------------------------------------------------------------------------- /tests/test-chooseobjectsfinal.inf: -------------------------------------------------------------------------------- 1 | Constant Story "ChooseObjectsFinal demo"; 2 | Constant Headline "^A sample game which uses PunyInform.^"; 3 | Constant OPTIONAL_EXTENDED_METAVERBS; 4 | Constant INITIAL_LOCATION_VALUE = Pub; 5 | Constant DEBUG; 6 | !Constant DEBUG_PARSEANDPERFORM; 7 | !Constant DEBUG_PARSEPATTERN; 8 | !Constant DEBUG_PARSETOKEN; 9 | !Constant DEBUG_PARSENOUNPHRASE; 10 | !Constant DEBUG_GETNEXTNOUN; 11 | !Constant DEBUG_SCOPE; 12 | 13 | 14 | include "globals"; 15 | 16 | [ ChooseObjectsFinal p_arr p_len _i _o; 17 | print "*** ChooseObjectsFinal, action is ",(DebugAction) action,", object count is ", p_len, ": ^"; 18 | for(_i = 0: _i < p_len: _i++) { 19 | _o = p_arr-->_i; 20 | print " Object# ", _o, ": ", (the) _o; 21 | if(parent(_o)) 22 | print " in ",(the) parent(_o); 23 | new_line; 24 | } 25 | "*** End of list"; 26 | ]; 27 | 28 | include "puny"; 29 | 30 | Object Pub "The Pub" 31 | with 32 | description "You are in a pub." 33 | has light; 34 | 35 | Object -> Table "table" 36 | with name 'table' 37 | has supporter; 38 | 39 | Object -> -> RedBall "red ball" 40 | with 41 | name 'red' 'ball'; 42 | 43 | Object -> Box "box" 44 | with 45 | name 'box', 46 | inside_description "It feels so nice, standing in the box.", 47 | has container open openable enterable; 48 | 49 | Object -> -> GreenBall "green ball" 50 | with 51 | name 'green' 'ball'; 52 | 53 | Object PinkBall "pink ball" 54 | with 55 | name 'pink' 'ball'; 56 | 57 | 58 | [Initialise; 59 | move PinkBall to player; 60 | "This game shows which objects ChooseObjectsFinal gets to choose from."; 61 | ]; 62 | -------------------------------------------------------------------------------- /tests/test-issue64.txt: -------------------------------------------------------------------------------- 1 | 2 | > give it to him 3 | I don't know what "it" refers to. 4 | 5 | > give apple to him 6 | (first taking the apple) 7 | I don't know what "him" refers to. 8 | 9 | > give it 10 | I think you wanted to say "give apple to someone". Please try again. 11 | 12 | > give him 13 | I don't know what "him" refers to. 14 | 15 | > x apple 16 | There is nothing special about the apple. 17 | 18 | > x bob 19 | There is nothing special about Bob. 20 | 21 | > give it to him 22 | Bob doesn't seem interested. 23 | 24 | > put apple on apple 25 | You can't put something on itself. 26 | 27 | > put apple in apple 28 | You can't put something inside itself. 29 | 30 | > search bush 31 | You find a pineapple. You take it. 32 | 33 | > i 34 | You're carrying a pineapple and a apple. 35 | 36 | > drop all 37 | pineapple: Dropped. 38 | apple: Dropped. 39 | 40 | > look 41 | Room 42 | You are in a room. 43 | 44 | You can see a apple, a banana, Bob and a bush here. 45 | 46 | > i 47 | You are empty handed. 48 | 49 | > take all 50 | apple: Taken. 51 | banana: Taken. 52 | bush: Taken. 53 | 54 | > take pineapple 55 | Taken. 56 | 57 | > drop all 58 | pineapple: Dropped. 59 | bush: Dropped. 60 | banana: Dropped. 61 | apple: Dropped. 62 | 63 | > i 64 | You are empty handed. 65 | 66 | > take pineapple 67 | Taken. 68 | 69 | > i 70 | You're carrying a pineapple. 71 | 72 | > restore 73 | Enter a file name. 74 | Default is "test-issue64.qzl": sdsda 75 | Failed restore. 76 | 77 | > eat apple 78 | (first taking the apple) 79 | You eat the apple. Not bad. 80 | 81 | 82 | *** You have won *** 83 | 84 | In that game you scored 0 out of a possible 0, in 17 turns. 85 | 86 | Would you like to RESTART, RESTORE or QUIT? restore 87 | Enter a file name. 88 | Default is "sdsda.qzl": dasdas 89 | Failed restore. 90 | 91 | Would you like to RESTART, RESTORE or QUIT? quit 92 | 93 | -------------------------------------------------------------------------------- /tests/test-grammar.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Room; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | !Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | #Ifndef USEINFORM; 45 | Include "puny.h"; 46 | #EndIf; 47 | 48 | ! Uncomment to add PunyLib extensions 49 | !Include "ext_menu.h"; 50 | !Include "ext_flags.h"; 51 | !Include "ext_quote_box.h"; 52 | !Include "ext_cheap_scenery.h"; 53 | 54 | 55 | #Ifdef USEINFORM; 56 | Include "Grammar"; 57 | #Endif; 58 | 59 | Extend 'close' replace; 60 | 61 | Object Room "Room" 62 | with description "You are in a room.", 63 | has light; 64 | 65 | Object -> apple "apple" 66 | with name 'apple', 67 | has edible; 68 | 69 | [ Initialise; 70 | #IfDef USEINFORM; 71 | location=INITIAL_LOCATION_VALUE; 72 | #EndIf; 73 | ]; 74 | 75 | -------------------------------------------------------------------------------- /tests/test-parser.cmd: -------------------------------------------------------------------------------- 1 | 2 | transcript 3 | 4 | john, take torch and sweater 5 | say test 6 | say test to john 7 | feed door with torch 8 | feed sweater with ladder 9 | feed sweater with ladder 10 | drop all 11 | look north 12 | x north 13 | open 14 | sit ladder 15 | look at ladder 16 | look ladder 17 | again me 18 | n 19 | again 20 | again me 21 | put sweater in s 22 | empty sweater 23 | drop sweater 24 | put ladder on ladder 25 | put ladder in ladder 26 | john, take all 27 | go n 28 | go sweater 29 | go 30 | get 31 | x orb 32 | frob it 33 | x ladder 34 | frob ladder 35 | frob it 36 | pronouns 37 | get ladder and 38 | kiss ladder 39 | open it 40 | type abc on ladder 41 | type abc into ladder 42 | close close door 43 | open close door 44 | i.i 45 | open torch and ladder 46 | i blue 47 | open all 48 | put all 49 | take torch. 50 | put all 51 | take torch and john 52 | open box 53 | get all from box 54 | i 55 | put all 56 | put all except 57 | put all except in box 58 | put all except book in box 59 | take all from box 60 | put all except red book in box 61 | i 62 | drop all 63 | get red book, xyzzy and torch 64 | get xyzzy and torch 65 | get xyzzy 66 | x green 67 | get green 68 | read green 69 | purloin pink book 70 | i 71 | take book 72 | drop pink 73 | take all 74 | push dsdasdsa 75 | oops john 76 | g 77 | push john 78 | s 79 | drop all 80 | take car and east 81 | get blue and all books 82 | drop all 83 | get blue book and all books but blue 84 | drop all 85 | take books 86 | drop all 87 | take pinkish 88 | drop all 89 | get blue and blue and blue 90 | get blue and blue 91 | get blue 92 | take book 93 | n 94 | take bag 95 | put sweater in bag 96 | i 97 | i tall 98 | i wide 99 | drop all 100 | feed 101 | feed john 102 | feed ladder 103 | x torch 104 | x torch now 105 | x torch torch now 106 | quit 107 | yes 108 | 109 | -------------------------------------------------------------------------------- /tests/test-actors.txt: -------------------------------------------------------------------------------- 1 | 2 | > 3 | Come again? 4 | 5 | > again 6 | You can hardly repeat that. 7 | 8 | > take all 9 | apple: Taken. 10 | red key: Taken. 11 | blue key: Taken. 12 | child: Taken. 13 | 14 | > drop all 15 | child: Dropped. 16 | blue key: Dropped. 17 | red key: Dropped. 18 | apple: Dropped. 19 | 20 | > take child 21 | Taken. 22 | 23 | > take george 24 | before: George/13 nothing/0 25 | I don't suppose George would care for that. 26 | 27 | > ask george to look 28 | George orders: nothing/0 nothing/0 29 | orders look 30 | George life: nothing/0 nothing/0 31 | George has better things to do. 32 | 33 | > ask george about me 34 | before: George/13 /1 35 | ask 36 | George life: George/13 /1 37 | Life Ask 38 | There is no reply. 39 | 40 | > ask george to do something 41 | George orders: George/13 /1 42 | orders askto 4 2 43 | before: George/13 George/13 44 | George life: George/13 George/13 45 | Life 46 | Life Answer 47 | There is no reply. 48 | 49 | > eat apple 50 | (first taking the apple) 51 | That's plainly inedible. 52 | 53 | > eat apple 54 | That's plainly inedible. 55 | 56 | > eat george 57 | before: George/13 nothing/0 58 | I don't suppose George would care for that. 59 | 60 | > unlock door with key 61 | Do you mean the red key or the blue key? 62 | 63 | > red 64 | (first taking the red key) 65 | The red key doesn't seem to fit the lock. 66 | 67 | > drop all 68 | red key: Dropped. 69 | apple: Dropped. 70 | child: Dropped. 71 | 72 | > take blue key 73 | Taken. 74 | 75 | > unlock door with key 76 | You unlock the door. 77 | 78 | > george, look 79 | George orders: nothing/0 nothing/0 80 | orders look 81 | George life: nothing/0 nothing/0 82 | George has better things to do. 83 | 84 | > child, look 85 | Child orders: nothing/0 nothing/0 86 | life: nothing/0 nothing/0 87 | The child has better things to do. 88 | 89 | > quit 90 | Are you sure you want to quit? yes 91 | 92 | -------------------------------------------------------------------------------- /tests/test-fullscore.txt: -------------------------------------------------------------------------------- 1 | 2 | > take point 3 | Taken. 4 | 5 | [The score has just gone up by 1 point.] 6 | 7 | > drop point 8 | Dropped. 9 | 10 | > take all 11 | one point: Taken. 12 | poison: Taken. 13 | toy: Taken. 14 | torch: Taken. 15 | 16 | > open box 17 | You open the box, revealing nothing. 18 | 19 | [The score has just gone up by 3 points.] 20 | 21 | > put all in box 22 | torch: You put the torch into the box. 23 | toy: You put the toy into the box. 24 | poison: You put the poison into the box. 25 | one point: You put the one point into the box. 26 | 27 | [The score has just gone up by 4 points.] 28 | 29 | 30 | *** You have won *** 31 | 32 | In that game you scored 8 out of a possible 7, in 5 turns. 33 | 34 | Would you like to RESTART, RESTORE, give the FULL score for that game or QUIT? 35 | restart 36 | 37 | 38 | The testsuite is open for business! 39 | 40 | 41 | Parser test 42 | 43 | Lit Room 44 | You are in a brightly lit room. 45 | 46 | You can see a box (which is closed), a poison, a one point, a toy and a torch 47 | here. 48 | 49 | > yes 50 | That is not a verb I recognize. 51 | 52 | > take point 53 | Taken. 54 | 55 | [The score has just gone up by 1 point.] 56 | 57 | > open box 58 | You open the box, revealing nothing. 59 | 60 | [The score has just gone up by 3 points.] 61 | 62 | > score 63 | You have so far scored 4 out of a possible 7, in 2 turns. 64 | 65 | > full score 66 | 67 | The score is made up as follows: 68 | 3 opening the box 69 | 1 finding sundry items 70 | 71 | 4 total (out of 7) 72 | 73 | > put point in box 74 | You put the one point into the box. 75 | 76 | [The score has just gone up by 1 point.] 77 | 78 | > take poison 79 | Taken. 80 | 81 | > eat poison 82 | AAAargh! 83 | 84 | 85 | *** You have died *** 86 | 87 | In that game you scored 5 out of a possible 7, in 5 turns. 88 | 89 | Would you like to RESTART, RESTORE, give the FULL score for that game or QUIT? 90 | quit 91 | -------------------------------------------------------------------------------- /tests/test-issue73.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Room; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | !Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | #Ifndef USEINFORM; 45 | Include "puny.h"; 46 | #EndIf; 47 | 48 | ! Uncomment to add PunyLib extensions 49 | !Include "ext_menu.h"; 50 | !Include "ext_flags.h"; 51 | !Include "ext_quote_box.h"; 52 | !Include "ext_cheap_scenery.h"; 53 | 54 | 55 | #Ifdef USEINFORM; 56 | Include "Grammar"; 57 | #Endif; 58 | 59 | Extend 'give' replace 60 | * held creature -> Give 61 | * creature held -> Give reverse; 62 | 63 | Object Room "Room" 64 | with description "You are in a room.", 65 | has light; 66 | 67 | Object -> julia "julia" 68 | with name 'julia', 69 | has animate female proper; 70 | 71 | Object -> apple "apple" 72 | with name 'apple', 73 | has edible; 74 | 75 | [ Initialise; 76 | #IfDef USEINFORM; 77 | location=INITIAL_LOCATION_VALUE; 78 | #EndIf; 79 | ]; 80 | 81 | -------------------------------------------------------------------------------- /tests/show_content.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | 4 | Constant Story "Show Contents"; 5 | Constant Headline "^A PunyInform code sample.^"; 6 | 7 | Constant INITIAL_LOCATION_VALUE = WhiteRoom; 8 | Constant OPTIONAL_EXTENDED_METAVERBS; 9 | 10 | Include "globals.h"; 11 | 12 | Include "puny.h"; 13 | 14 | Object WhiteRoom "White Room" 15 | with 16 | description "You are in a large white room.", 17 | has light; 18 | 19 | Object -> Table "table" 20 | with 21 | name 'table', 22 | description [; 23 | print "It's a nice sturdy table."; 24 | self.show_contents(); 25 | @new_line; 26 | ], 27 | initial [; 28 | print "There is a beautiful table in the middle of the room."; 29 | ! If the player is on the table, PunyInform will 30 | ! show the contents automatically. Otherwise, we 31 | ! do it! 32 | if(~~IndirectlyContains(self, player)) self.show_contents(); 33 | @new_line; 34 | ], 35 | ! show_contents is an individual property - it could 36 | ! have been called anything. We just picked a 37 | ! descriptive name. 38 | show_contents [; 39 | ! PrintContents returns true if it printed 40 | ! anything, false if not. 41 | if(PrintContents(" On the table you can see ", self)) print "."; 42 | ], 43 | has static supporter enterable; 44 | 45 | 46 | Object -> -> plate "plate" 47 | with 48 | name 'plate' 49 | has supporter; 50 | 51 | Object -> -> fork "fork" 52 | with 53 | name 'fork'; 54 | 55 | [Initialise; 56 | print "^^A supporter or container in PunyInform is normally 57 | included in the room description, and if there is 58 | something in/on it, this is also printed. However, if 59 | you give your supporter or container a paragraph of its 60 | own using any of the properties initial, when_open, 61 | when_closed or describe, the contents of the object will 62 | not be printed. This game shows how to make the object 63 | print its contents in the room description. Also, it 64 | shows how to make the object print its contents when the 65 | player examines the object.^^"; 66 | ]; 67 | -------------------------------------------------------------------------------- /howto/show_content.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Show Contents"; 6 | Constant Headline "^A PunyInform code sample.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | Constant INITIAL_LOCATION_VALUE = WhiteRoom; 11 | 12 | Include "globals.h"; 13 | 14 | Include "puny.h"; 15 | 16 | Object WhiteRoom "White Room" 17 | with 18 | description "You are in a large white room.", 19 | has light; 20 | 21 | Object -> Table "table" 22 | with 23 | name 'table', 24 | description [; 25 | print "It's a nice sturdy table."; 26 | self.show_contents(); 27 | @new_line; 28 | ], 29 | initial [; 30 | print "There is a beautiful table in the middle of the room."; 31 | ! If the player is on the table, PunyInform will show the contents 32 | ! automatically. Otherwise, we do it! 33 | if(~~IndirectlyContains(self, player)) self.show_contents(); 34 | @new_line; 35 | ], 36 | ! show_contents is an individual property - it could have been called 37 | ! anything. We just picked a descriptive name. 38 | show_contents [; 39 | ! PrintContents returns true if it printed anything, false if not. 40 | if(PrintContents(" On the table you can see ", self)) print "."; 41 | ], 42 | has static supporter enterable; 43 | 44 | 45 | Object -> -> plate "plate" 46 | with 47 | name 'plate' 48 | has supporter; 49 | 50 | Object -> -> fork "fork" 51 | with 52 | name 'fork'; 53 | 54 | [Initialise; 55 | print "^^A supporter or container in PunyInform is normally included in the 56 | room description, and if there is something in/on it, this is also 57 | printed. However, if you give your supporter or container a paragraph of 58 | its own using any of the properties initial, when_open, when_closed 59 | or describe, the contents of the object will not be printed. This game 60 | shows how to make the object print its contents in the room description. 61 | Also, it shows how to make the object print its contents when the 62 | player examines the object.^^"; 63 | ]; 64 | -------------------------------------------------------------------------------- /tests/test-bottles.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Cans"; 10 | Constant Headline "^A sample game which uses PunyInform.^"; 11 | 12 | Constant STATUSLINE_SCORE; Statusline score; 13 | 14 | Constant NO_SCORE = 0; 15 | 16 | !Constant DEBUG; ! Provides debug verbs for both Inform and PunyInform 17 | !Constant DEBUG_PARSEANDPERFORM; 18 | !Constant DEBUG_PARSEPATTERN; 19 | !Constant DEBUG_PARSETOKEN; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | 23 | ! Uncomment to add optional features to PunyInform 24 | Constant RUNTIME_ERRORS = 2; ! 0, 1 or 2. 0 = smallest file, 2 = most info 25 | 26 | Constant OPTIONAL_LIST_TOGETHER; 27 | Constant OPTIONAL_LANGUAGE_NUMBER; ! Use this to have list_together print numbers using words 28 | Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; ! Cheaper to add when OPTIONAL_LANGUAGE_NUMBER is defined 29 | 30 | Constant OPTIONAL_EXTENDED_METAVERBS; 31 | Constant OPTIONAL_EXTENDED_VERBSET; 32 | Constant OPTIONAL_FLEXIBLE_INVENTORY; 33 | 34 | Constant INITIAL_LOCATION_VALUE = Room; 35 | 36 | #Ifdef USEINFORM; 37 | Include "Parser"; 38 | Include "VerbLib"; 39 | #IfNot; 40 | Include "globals.h"; 41 | #EndIf; 42 | 43 | #Ifndef USEINFORM; 44 | Include "puny.h"; 45 | #EndIf; 46 | 47 | #Ifdef USEINFORM; 48 | Include "Grammar"; 49 | #Endif; 50 | 51 | Object Room "Room" 52 | with 53 | description "You are in a room." 54 | has light; 55 | 56 | Object -> Girl "girl" 57 | with 58 | name 'girl', 59 | has animate female; 60 | 61 | Object -> GreenCan "green can" 62 | with 63 | name 'green' 'can' 'cans//p', 64 | description "The green can is empty.", 65 | has open; 66 | 67 | Object -> BrownCan "brown can" 68 | with 69 | name 'brown' 'can' 'cans//p', 70 | description "The brown can is empty.", 71 | has open; 72 | 73 | [Initialise; 74 | #IfDef USEINFORM; 75 | location=INITIAL_LOCATION_VALUE;; 76 | #EndIf; 77 | move BrownCan to player; 78 | move GreenCan to player; 79 | ]; 80 | -------------------------------------------------------------------------------- /tests/test-issue75.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Library; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | #Ifndef USEINFORM; 45 | Include "puny.h"; 46 | #EndIf; 47 | 48 | ! Uncomment to add PunyLib extensions 49 | !Include "ext_menu.h"; 50 | !Include "ext_flags.h"; 51 | !Include "ext_quote_box.h"; 52 | !Include "ext_cheap_scenery.h"; 53 | 54 | 55 | #Ifdef USEINFORM; 56 | Include "Grammar"; 57 | #Endif; 58 | 59 | Object Library "The Library" 60 | with 61 | name 'scenery' 'useless', 62 | description "You are in a library." 63 | has light; 64 | 65 | Object -> Box "box" 66 | with name 'box', 67 | after [; 68 | Take, Remove: 69 | if(self hasnt moved) "Why did you pick up the box?"; 70 | ], 71 | has container open openable; 72 | 73 | Object apple "apple" 74 | with name 'apple', 75 | has edible; 76 | 77 | 78 | [ Initialise; 79 | #IfDef USEINFORM; 80 | location=INITIAL_LOCATION_VALUE; 81 | #EndIf; 82 | ]; 83 | 84 | -------------------------------------------------------------------------------- /tests/test-issue103.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Library; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | Constant OPTIONAL_EXTENDED_VERBSET; 31 | Constant OPTIONAL_NO_DARKNESS; 32 | !Constant OPTIONAL_FULL_SCORE; 33 | !Constant OPTIONAL_FULL_DIRECTIONS; 34 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 35 | !Constant OPTIONAL_MANUAL_SCOPE; 36 | !Constant RUNTIME_ERRORS = 0; 37 | 38 | #Ifdef USEINFORM; 39 | Include "Parser"; 40 | Include "VerbLib"; 41 | #IfNot; 42 | Include "globals.h"; 43 | #EndIf; 44 | 45 | #Ifndef USEINFORM; 46 | Include "puny.h"; 47 | #EndIf; 48 | 49 | ! Uncomment to add PunyLib extensions 50 | !Include "ext_menu.h"; 51 | !Include "ext_flags.h"; 52 | !Include "ext_quote_box.h"; 53 | !Include "ext_cheap_scenery.h"; 54 | 55 | 56 | #Ifdef USEINFORM; 57 | Include "Grammar"; 58 | #Endif; 59 | 60 | Object Library "The Library" 61 | with 62 | name 'library', 63 | description "You are in a library.", 64 | in_to RestRoom 65 | ; 66 | 67 | Object -> Hat "hat" 68 | with 69 | name 'hat', 70 | has clothing; 71 | 72 | Object Restroom "Restroom" 73 | with 74 | name 'scenery' 'useless', 75 | description "You are in a restroom.", 76 | out_to Library 77 | ; 78 | 79 | 80 | [ Initialise; 81 | #IfDef USEINFORM; 82 | location=INITIAL_LOCATION_VALUE; 83 | #EndIf; 84 | ]; 85 | 86 | -------------------------------------------------------------------------------- /tests/test-numbers.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Numbers"; 6 | Constant Headline "^A sample game which uses PunyInform.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | Constant NO_SCORE = 0; 11 | 12 | !Constant DEBUG; ! Provides debug verbs for both Inform and PunyInform 13 | !Constant DEBUG_PARSEANDPERFORM; 14 | !Constant DEBUG_PARSEPATTERN; 15 | !Constant DEBUG_PARSETOKEN; 16 | !Constant DEBUG_GETNEXTNOUN; 17 | !Constant DEBUG_PARSENOUNPHRASE; 18 | 19 | ! Uncomment to add optional features to PunyInform 20 | Constant RUNTIME_ERRORS = 2; ! 0, 1 or 2. 0 = smallest file, 2 = most info 21 | 22 | Constant OPTIONAL_LIST_TOGETHER; 23 | Constant OPTIONAL_LANGUAGE_NUMBER; ! Use this to have list_together print numbers using words 24 | Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; ! Cheaper to add when OPTIONAL_LANGUAGE_NUMBER is defined 25 | 26 | Constant OPTIONAL_EXTENDED_METAVERBS; 27 | Constant OPTIONAL_EXTENDED_VERBSET; 28 | Constant OPTIONAL_FLEXIBLE_INVENTORY; 29 | 30 | Constant INITIAL_LOCATION_VALUE = ButtonRoom; 31 | 32 | Include "globals.h"; 33 | 34 | ![ ChooseObjectsFinal p_arr p_len; p_arr = p_len; ]; 35 | 36 | Include "puny.h"; 37 | 38 | Object ButtonRoom "Button Room Pub" 39 | with 40 | description "You are in the button room.", 41 | s_to NoteRoom, 42 | has light; 43 | 44 | Object -> Button "button" 45 | with 46 | name '2//' 'two' 'second' 'button', 47 | description "It's a button with the number '2' on it. ", 48 | before [; 49 | push: 50 | "Something happens here. "; 51 | ], 52 | has static; 53 | 54 | Object NoteRoom "Note Room" 55 | with 56 | description "You are in the button room.", 57 | n_to ButtonRoom, 58 | has light; 59 | 60 | Object -> ws_one "step one" 61 | with 62 | name 'one' '1//' 'step', 63 | has static; 64 | 65 | Object -> ws_two "step two" 66 | with 67 | name 'two' '2//' 'step', 68 | has static; 69 | 70 | 71 | [Initialise; ! i; 72 | print "^^Indistinguishable item are listed together in this demo. Things to try:^ 73 | INVENTORY TALL^ 74 | INVENTORY WIDE^ 75 | GET COIN^ 76 | EXAMINE DARTS^ 77 | ^^"; 78 | ]; 79 | -------------------------------------------------------------------------------- /howto/pushdir.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "PushDir demo"; 6 | Constant Headline "^A sample game which uses PunyInform.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | ! Uncomment to add optional features to PunyInform 11 | Constant DEBUG; 12 | Constant OPTIONAL_NO_DARKNESS; 13 | 14 | Constant INITIAL_LOCATION_VALUE = Street; 15 | 16 | Include "globals.h"; 17 | 18 | Include "puny.h"; 19 | 20 | Verb 'start' 21 | * noun -> SwitchOn; 22 | 23 | Object Street "Street" 24 | with 25 | description "You are in the street outside your house. The lawn is to the south. The square is to the east.", 26 | s_to Lawn, 27 | e_to Square; 28 | 29 | Object -> Gokart "go-kart" 30 | with 31 | name 'gokart' 'go-kart' 'kart', 32 | invent [; 33 | if(inventory_stage == 2) 34 | print " (broken)"; 35 | ], 36 | ! describe [; rtrue; ], 37 | before [ dirobj; 38 | Take, Remove: 39 | "You can't be serious."; 40 | SwitchOn: 41 | "It won't start."; 42 | Push, Pull, Turn: 43 | "You can move the kart with ~PUSH KART EAST~"; 44 | PushDir: 45 | ! Make sure the player isn't in/on anything 46 | if(player notin location) 47 | "You'd have to be on your own feet to do that."; 48 | 49 | ! First define where this item can't be pushed 50 | if(location == Street && selected_direction == s_to) 51 | "It would just mess up the grass!"; 52 | 53 | ! Now try to walk in this direction, and move the object 54 | ! there as well. It's okay that we may not be able to go there. 55 | dirobj = DirPropToFakeObj(selected_direction); 56 | ; 57 | move self to real_location; 58 | rtrue; 59 | ], 60 | has container open enterable switchable; 61 | 62 | Object Lawn "Lawn" 63 | with 64 | description "You are on your well-kept lawn. You wouldn't want to have 65 | a go-kart on this lawn. The street lies to the north.", 66 | n_to Street; 67 | 68 | Object Square "Workshop" 69 | with 70 | description "You're in the workshop. The street lies to the west.", 71 | w_to Street; 72 | 73 | [Initialise; 74 | print "^^You need to get your go-kart out of the way. How about pushing it 75 | east, to the workshop?^^"; 76 | ]; 77 | -------------------------------------------------------------------------------- /tests/test-consultfrom.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; #Endif; 7 | 8 | Constant Story "Parser test"; 9 | Constant Headline "^A parser test suite for PunyInform.^"; 10 | Serial "200827"; 11 | Constant INITIAL_LOCATION_VALUE = Library; 12 | 13 | ! Uncomment to show time instead of score/turns 14 | !Statusline time; 15 | 16 | !Constant DEBUG; 17 | !Constant DEBUG_PARSEANDPERFORM; 18 | !Constant DEBUG_PARSEPATTERN; 19 | !Constant DEBUG_PARSETOKEN; 20 | !Constant DEBUG_PARSENOUNPHRASE; 21 | !Constant DEBUG_GETNEXTNOUN; 22 | !Constant DEBUG_SCOPE; 23 | 24 | ! Uncomment to add optional features to PunyLib 25 | !Constant DEBUG; 26 | !Constant CUSTOM_ABBREVIATIONS; 27 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 28 | Constant OPTIONAL_EXTENDED_METAVERBS; 29 | !Constant OPTIONAL_EXTENDED_VERBSET; 30 | !Constant OPTIONAL_FULL_SCORE; 31 | !Constant OPTIONAL_FULL_DIRECTIONS; 32 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 33 | !Constant OPTIONAL_MANUAL_SCOPE; 34 | !Constant RUNTIME_ERRORS = 0; 35 | 36 | #Ifdef USEINFORM; 37 | Include "Parser"; 38 | Include "VerbLib"; 39 | #IfNot; 40 | Include "globals.h"; 41 | #EndIf; 42 | #Ifndef USEINFORM; 43 | Include "puny.h"; 44 | #EndIf; 45 | Extend only 'say' first 46 | * topic -> Say; 47 | [ SaySub; 48 | print "consult_words = ", consult_words, "^"; 49 | print "consult_from = ", consult_from, "^"; 50 | !print "~"; 51 | !i = consult_from; 52 | !print (toCapital)i++; 53 | !while (i < consult_from + consult_words) 54 | ! print " ", (toLower)i++; 55 | !print ".~^^"; 56 | !if (AfterRoutines()) 57 | ! return; 58 | !"Nothing happens."; 59 | ]; 60 | ! Uncomment to add PunyLib extensions 61 | !Include "ext_menu.h"; 62 | !Include "ext_flags.h"; 63 | !Include "ext_quote_box.h"; 64 | !Include "ext_cheap_scenery.h"; 65 | 66 | 67 | Object Library "The Library" 68 | with description "You are in a library." has light; 69 | 70 | Object -> Box "box" 71 | with name 'box', 72 | has container open openable; 73 | 74 | Object apple "apple" 75 | with name 'apple', 76 | has edible; 77 | 78 | 79 | [ Initialise; 80 | #IfDef USEINFORM; 81 | location=INITIAL_LOCATION_VALUE; 82 | #EndIf; 83 | ]; 84 | 85 | -------------------------------------------------------------------------------- /tests/test-inputaction.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Minimal"; 6 | Constant Headline "^A sample game which uses PunyInform.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | Constant NO_SCORE = 0; 11 | 12 | 13 | ! Uncomment to add optional features to PunyInform 14 | !Constant DEBUG; 15 | Constant OPTIONAL_NO_DARKNESS; 16 | Constant OPTIONAL_EXTENDED_METAVERBS; 17 | Constant OPTIONAL_EXTENDED_VERBSET; 18 | Constant OPTIONAL_FLEXIBLE_INVENTORY; 19 | !Constant OPTIONAL_PROVIDE_UNDO; 20 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 21 | 22 | Constant INITIAL_LOCATION_VALUE = Library; 23 | 24 | Include "globals.h"; 25 | 26 | Include "puny.h"; 27 | 28 | Object Library "The Library" 29 | with 30 | description "You are in a library."; 31 | 32 | Object -> Box "box" 33 | with 34 | name 'box', 35 | inside_description "It feels so nice, standing in the box.", 36 | has container open openable enterable; 37 | 38 | 39 | Object -> Ball "ball" 40 | with 41 | name 'ball', 42 | description "This ball can be picked up, but not with an implicit action.", 43 | before [; 44 | Take, Remove: 45 | if(input_action ~= action) 46 | "The ball can't be picked up with an implicit action!"; 47 | if(Book in location) { 48 | print "(You decide to pick up the book as well)^"; 49 | ; 50 | } 51 | ]; 52 | 53 | Object -> Book "book" 54 | with 55 | name 'book', 56 | description "This book can only be picked up when a HELD token makes the parser try to pick it up, OR when you pick up 57 | the ball and the book is in location.", 58 | before [; 59 | Take, Remove: 60 | if(input_action == ##Take && input_noun == Ball) 61 | rfalse; ! Allow action 62 | if(action_to_be < 0) ! This is not the parser performing an implicit Take 63 | "You can't deliberately pick it up. Trying to eat it should make you pick it up though!"; 64 | ]; 65 | 66 | Object -> Button "button" 67 | with 68 | name 'button', 69 | description "Pushing this button makes you try to pick up the book.", 70 | before [; 71 | Push: 72 | <>; 73 | ], 74 | has static; 75 | 76 | 77 | 78 | [Initialise; 79 | print "^^And so the story begins...^^"; 80 | ]; 81 | -------------------------------------------------------------------------------- /tests/test-testbench.txt: -------------------------------------------------------------------------------- 1 | 2 | > get books and dial 3 | blue book: The blue book starts ticking... 4 | green book: John says, "Oh no! That's mine!" 5 | pink book: You dared taking the pink book. Bravo! 6 | dial: That's fixed in place. 7 | 8 | > get dial and books 9 | dial: That's fixed in place. 10 | green book: John says, "Oh no! That's mine!" 11 | 12 | The blue book ticks loudly. 13 | 14 | > get books and dial 15 | green book: John says, "Oh no! That's mine!" 16 | dial: That's fixed in place. 17 | 18 | The blue book ticks loudly. 19 | 20 | > restart 21 | Are you sure you want to restart? yes 22 | 23 | 24 | tried out. Don't expect much of a game here. Currently, you can win by putting 25 | stuff in the box, or lose by checking out the sun by the river or by pushing 26 | John around. 27 | 28 | Testbench 29 | 30 | Huge library 31 | You are in an old and deserted library. There is an exit leading south and a 32 | toilet to the east. 33 | 34 | There's a black dial on the wall. 35 | 36 | A blue book is standing on a shelf. Looking at the blue book makes you dizzy. 37 | 38 | An old and torn green book is here. 39 | 40 | You can also see a light switch, a sweater, an aquarium (which is open but 41 | empty), a box (which is closed), a shelf (on which are a pair of boots), a 42 | ladder (on which is a sticker), John, an infinite bag (which is open but empty), 43 | that stupid old pink book and an electric torch (Ugly as sin) here. 44 | 45 | > get blue and all books but blue 46 | blue book: The blue book starts ticking... 47 | green book: John says, "Oh no! That's mine!" 48 | pink book: You dared taking the pink book. Bravo! 49 | 50 | > open box 51 | You open the box, revealing a red book and a brown book. 52 | 53 | The blue book ticks loudly. 54 | 55 | [The score has just gone up by 3 points.] 56 | 57 | > put book in box 58 | Do you mean the pink book or the blue book? 59 | 60 | > i 61 | You're carrying that stupid old pink book and a blue book (providing light). 62 | 63 | The blue book ticks loudly. 64 | 65 | > take book from box 66 | Do you mean the red book or the brown book? 67 | 68 | > brown 69 | Yay, got rid of the brown book! 70 | 71 | The box goes BOOM. 72 | 73 | The blue book ticks loudly. 74 | 75 | [The score has just gone down by 1 point.] 76 | 77 | > quit 78 | You ain't no quitter eh? yes 79 | 80 | -------------------------------------------------------------------------------- /tests/grabifnotheld.txt: -------------------------------------------------------------------------------- 1 | 2 | > pry box with gizmo 3 | (first taking gizmo) 4 | You can't unlock that. 5 | 6 | > i 7 | You're carrying gizmo. 8 | 9 | > drop all 10 | gizmo: Dropped. 11 | 12 | > throw gizmo at box 13 | (first taking gizmo) 14 | Futile. 15 | 16 | > i 17 | You're carrying gizmo. 18 | 19 | > drop all 20 | gizmo: Dropped. 21 | 22 | > insert gizmo in box 23 | (first taking gizmo) 24 | You put gizmo into box. 25 | 26 | > i 27 | You are empty handed. 28 | 29 | > drop all 30 | You are not carrying anything. 31 | 32 | > transfer gizmo to box 33 | Already there. 34 | 35 | > i 36 | You are empty handed. 37 | 38 | > drop all 39 | You are not carrying anything. 40 | 41 | > put on gizmo 42 | (first taking gizmo) 43 | You can't wear that. 44 | 45 | > i 46 | You're carrying gizmo. 47 | 48 | > drop all 49 | gizmo: Dropped. 50 | 51 | > empty box 52 | dust: Dropped. 53 | 54 | > i 55 | You are empty handed. 56 | 57 | > look 58 | Lit Room 59 | You are in a brightly lit room. 60 | 61 | You can see a dust, gizmo and box (which is empty) here. 62 | 63 | > s 64 | Another Room 65 | You are in a brightly lit room. 66 | 67 | You can see a green book, a blue book and Sally here. 68 | 69 | > what is samarkand 70 | Samarkand is a city in south-eastern Uzbekistan. 71 | 72 | > what is book 73 | At the moment, even the simplest questions confuse you. 74 | 75 | > what is green book 76 | At the moment, even the simplest questions confuse you. 77 | 78 | > what is green 79 | At the moment, even the simplest questions confuse you. 80 | 81 | > what is sdasfafaf 82 | At the moment, even the simplest questions confuse you. 83 | 84 | > take green 85 | Taken. 86 | 87 | > what is green 88 | At the moment, even the simplest questions confuse you. 89 | 90 | > what is green book 91 | At the moment, even the simplest questions confuse you. 92 | 93 | > show green 94 | (assuming to Sally) 95 | Sally doesn't seem interested. 96 | 97 | > show green to sally 98 | Sally doesn't seem interested. 99 | 100 | > show sally green 101 | Sally doesn't seem interested. 102 | 103 | > show green to blue 104 | You can only do that to something animate. 105 | 106 | > show green blue 107 | I only understood you as far as "show green" but then you lost me. 108 | 109 | > quit 110 | Are you sure you want to quit? yes 111 | 112 | -------------------------------------------------------------------------------- /tests/test4.txt: -------------------------------------------------------------------------------- 1 | 2 | > steal 3 | I think you wanted to say "steal something". Please try again. 4 | 5 | > put me on table then get off 6 | You enter the table. 7 | 8 | You leave the table. 9 | 10 | > throw ball at air 11 | Do you mean the small blue ball, the small red ball or the small green ball? 12 | 13 | > small red 14 | (first taking the small red ball) 15 | Futile. 16 | 17 | > throw ball at air 18 | Futile. 19 | 20 | > throw green ball at air 21 | (first taking the small green ball) 22 | Futile. 23 | 24 | > drop green 25 | Dropped. 26 | 27 | > take all balls 28 | small green ball: Taken. 29 | small blue ball: Taken. 30 | 31 | > take red cube 32 | Taken. 33 | 34 | > s 35 | White Room 36 | It's all white. The ball room lies to the north. 37 | 38 | You can see a red box (which is open but empty) and a transparent box (which is 39 | open but empty) here. 40 | 41 | > put balls in red box 42 | small blue ball: You put the small blue ball into the red box. 43 | small green ball: You put the small green ball into the red box. 44 | small red ball: You put the small red ball into the red box. 45 | 46 | > put red cube in transparent 47 | You put the red cube into the transparent box. 48 | 49 | > put transparent box in red box 50 | (first taking the transparent box) 51 | You put the transparent box into the red box. 52 | 53 | > close red box then get transparent box 54 | You close the red box. 55 | 56 | You can't see any such thing. 57 | 58 | > open red box 59 | You open the red box, revealing a transparent box (which is open and contains a 60 | red cube), a small red ball, a small green ball and a small blue ball. 61 | 62 | > take red box 63 | Taken. 64 | 65 | > n 66 | Ball Room 67 | 68 | There is a blue table in the middle of the room. 69 | 70 | You can also see a black cube here. 71 | 72 | > put green into box 73 | Do you mean the red box or the transparent box? 74 | 75 | > red 76 | Already there. 77 | 78 | > put all cubes in box 79 | Do you mean the red box or the transparent box? 80 | 81 | > red 82 | red cube: (first taking the red cube) 83 | You put the red cube into the red box. 84 | black cube: (first taking the black cube) 85 | You put the black cube into the red box. 86 | 87 | > i 88 | You're carrying a red box (which contains a black cube, a red cube, a 89 | transparent box (which is open but empty), a small red ball, a small green ball 90 | and a small blue ball). 91 | 92 | > quit 93 | Are you sure you want to quit? yes 94 | 95 | -------------------------------------------------------------------------------- /tests/test-cheapscenery.txt: -------------------------------------------------------------------------------- 1 | 2 | > x volume 3 | You're not interested in reading. 4 | 5 | > get old book 6 | Leave the books to the people who care about them. 7 | 8 | > x paper 9 | The papers are all dusty. 10 | 11 | > push papers 12 | Leave them papers or walls alone! 13 | 14 | > x them 15 | The papers are all dusty. 16 | 17 | > x the big library 18 | It's truly glorious. 19 | 20 | > push the library 21 | The library is super-important. Better not mess with it. 22 | 23 | > x air 24 | The air is oh so thin here. 25 | 26 | > get air 27 | You need the air to breathe, that's all. 28 | 29 | > x atmosphere 30 | There's a really nice atmosphere to the place. 31 | 32 | > pull walls 33 | Leave them papers or walls alone! 34 | 35 | > x ceiling 36 | The ceiling is quite high up. 37 | 38 | > push ceiling 39 | There's no way you could reach it! 40 | 41 | > x it 42 | The ceiling is quite high up. 43 | 44 | > x pushpull button 45 | Just a pretty button. 46 | 47 | > x light 48 | You can't see any such thing. 49 | 50 | > push pushpull button 51 | There's a really nice atmosphere to the place. 52 | 53 | > pull pushpull button 54 | The papers are all dusty. 55 | 56 | > turn on switch 57 | You switch the switch on. 58 | 59 | > x light 60 | It's like real sunlight. 61 | 62 | > push pushpull button 63 | It's like real sunlight. 64 | 65 | > pull pushpull button 66 | The papers are all dusty. 67 | 68 | > e 69 | Reading Room 70 | This is the reading room. The air feels different here. There's a single book 71 | sitting on one of the tables. You can examine or try to take the tables, the 72 | reading room, the air, the atmosphere, the walls and the ceiling. The library 73 | lies west. 74 | 75 | > x it 76 | I don't know what "it" refers to. 77 | 78 | > x book 79 | It's the classic "Gone With the Wind" by Margaret Mitchell. 80 | 81 | > get the single book 82 | Leave the books to the people who care about them. 83 | 84 | > push table 85 | You decide it's better to leave the tables where they are. 86 | 87 | > x tables 88 | Quite sturdy. 89 | 90 | > x room 91 | It's a very peaceful place. 92 | 93 | > turn reading room 94 | Remember you're in a library. There's no need to touch everything. 95 | 96 | > x air 97 | The air is thicker here than in the library. 98 | 99 | > push air 100 | You need the air to breathe, that's all. 101 | 102 | > quit 103 | Are you sure you want to quit? yes 104 | 105 | -------------------------------------------------------------------------------- /tests/test-printcontents.txt: -------------------------------------------------------------------------------- 1 | 2 | > look 3 | The Library 4 | You are in a library. 5 | 6 | A beautiful table stands in the middle of the room. 7 | 8 | You can also see a chest (which is open but empty), a book, a glass jar (which 9 | is open but empty), a peach, a bucket (which is empty), some garbage, a glass 10 | bowl (which is empty) and an onion here. 11 | 12 | > get all 13 | chest: Taken. 14 | book: Taken. 15 | glass jar: Taken. 16 | peach: Taken. 17 | bucket: Taken. 18 | garbage: Taken. 19 | glass bowl: Taken. 20 | onion: Taken. 21 | 22 | > i wide 23 | You're carrying an onion, a glass bowl (which is empty), some garbage, a bucket 24 | (which is empty), a peach, a glass jar (which is open but empty), a book and a 25 | chest (which is open but empty). 26 | 27 | > i tall 28 | You're carrying: 29 | an onion 30 | a glass bowl (which is empty) 31 | some garbage 32 | a bucket (which is empty) 33 | a peach 34 | a glass jar (which is open but empty) 35 | a book 36 | a chest (which is open but empty) 37 | 38 | > fillall 39 | You move stuff into stuff! 40 | 41 | > i wide 42 | You're carrying a glass bowl (which contains an onion), a bucket (which contains 43 | some garbage), a glass jar (which is open and contains a peach) and a chest 44 | (which contains a book). 45 | 46 | > i tall 47 | You're carrying: 48 | a glass bowl 49 | an onion 50 | a bucket 51 | some garbage 52 | a glass jar (which is open) 53 | a peach 54 | a chest 55 | a book 56 | 57 | > put bucket in jar 58 | You put the bucket into the glass jar. 59 | 60 | > i wide 61 | You're carrying a glass bowl (which contains an onion), a glass jar (which is 62 | open and contains a bucket (which contains some garbage) and a peach) and a 63 | chest (which contains a book). 64 | 65 | > i tall 66 | You're carrying: 67 | a glass bowl 68 | an onion 69 | a glass jar (which is open) 70 | a bucket 71 | some garbage 72 | a peach 73 | a chest 74 | a book 75 | 76 | > put all on table 77 | glass bowl: You put the glass bowl on the table. 78 | glass jar: You put the glass jar on the table. 79 | chest: You put the chest on the table. 80 | 81 | > look 82 | The Library 83 | You are in a library. 84 | 85 | A beautiful table stands in the middle of the room. On the table are a chest 86 | (which contains a book), a glass jar (which is open and contains a bucket (which 87 | contains some garbage) and a peach) and a glass bowl (which contains an onion). 88 | 89 | > quit 90 | Are you sure you want to quit? yes 91 | 92 | -------------------------------------------------------------------------------- /tests/getallfrom.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | 4 | #Iftrue (#version_number == 8); 5 | Constant USEINFORM; 6 | #Endif; 7 | 8 | Constant Story "Get All From"; 9 | Constant Headline "^A sample game which uses PunyInform.^"; 10 | 11 | #IfnDef USEINFORM; 12 | Constant INITIAL_LOCATION_VALUE = Room1; 13 | Constant OPTIONAL_EXTENDED_METAVERBS; 14 | 15 | Include "globals.h"; 16 | 17 | Include "puny.h"; 18 | #IfNot; 19 | Include "Parser"; 20 | Include "VerbLib"; 21 | #EndIf; 22 | 23 | Object Room2 "Concealed box" 24 | with 25 | description "The room with the concealed box. Exits s", 26 | s_to Room1, 27 | has light; 28 | 29 | Object -> Box2 "box" 30 | with 31 | initial [; 32 | print "There's a box here. "; 33 | #Ifndef USEINFORM; 34 | if(PrintContents("In the box is ", self)) print "."; 35 | #EndIf; 36 | ""; 37 | ], 38 | name 'box', 39 | has open container concealed; 40 | 41 | Object -> -> Bag2 "bag" 42 | with 43 | name 'bag', 44 | has open container; 45 | 46 | Object -> -> -> Rock2 "rock" 47 | with 48 | name 'rock'; 49 | 50 | Object Room3 "Static box" 51 | with 52 | description "The room with the static box and static bag. Exits n", 53 | n_to Room1, 54 | has light; 55 | 56 | Object -> Box3 "box" 57 | with 58 | initial [; 59 | print "There's a box here. "; 60 | #Ifndef USEINFORM; 61 | if(PrintContents("In the box is ", self)) print "."; 62 | #EndIf; 63 | ""; 64 | ], 65 | name 'box', 66 | has open container static; 67 | 68 | Object -> -> Bag3 "bag" 69 | with 70 | name 'bag', 71 | has open container static; 72 | 73 | Object -> -> -> Rock3 "rock" 74 | with 75 | name 'rock'; 76 | 77 | Object Room1 "Normal box" 78 | with 79 | number 0, 80 | description "The room with the normal box. Exits n, s", 81 | n_to Room2, 82 | s_to Room3, 83 | has light; 84 | 85 | Object -> Box1 "box" 86 | with 87 | initial [; 88 | print "There's a box here. "; 89 | #Ifndef USEINFORM; 90 | if(PrintContents("In the box is ", self)) print "."; 91 | #EndIf; 92 | ""; 93 | ], 94 | name 'box', 95 | has open container; 96 | 97 | Object -> -> Bag1 "bag" 98 | with 99 | name 'bag', 100 | has open container; 101 | 102 | Object -> -> -> Rock1 "rock" 103 | with 104 | name 'rock'; 105 | 106 | [Initialise; 107 | location = Room1; 108 | print "^^try 'get all from bag'^^"; 109 | ]; 110 | 111 | #Ifdef USEINFORM; 112 | Include "Grammar"; 113 | #Endif; 114 | 115 | -------------------------------------------------------------------------------- /howto/colours.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Colours"; 6 | Constant Headline "^A demonstration of using colours in PunyInform^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | ! Uncomment to add optional features to PunyInform 11 | !Constant DEBUG; 12 | Constant OPTIONAL_NO_DARKNESS; 13 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 14 | 15 | ! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED, 16 | ! MAX_CARRIED, SACK_OBJECT, etc. 17 | 18 | Constant INITIAL_LOCATION_VALUE = Library; 19 | 20 | Include "globals.h"; 21 | 22 | #Ifv5; 23 | Replace RestartSub; 24 | #Endif; 25 | 26 | Include "puny.h"; 27 | 28 | #Ifv5; 29 | ! Make sure we go back to the default colours, as a workaround 30 | ! for a bug in some interpreters, where the background doesn't 31 | ! automatically revert to its default colour on restart. 32 | [ RestartSub; 33 | PrintMsg(MSG_RESTART_CONFIRM); 34 | if(YesOrNo()) { 35 | @set_colour CLR_DEFAULT CLR_DEFAULT; 36 | ClearScreen(WIN_ALL); 37 | @restart; 38 | return MSG_RESTART_FAILED; 39 | } 40 | ]; 41 | #Endif; 42 | 43 | ! Declare the colour constants we need to conveniently switch colours during the game 44 | Constant MY_DEFAULT_FG = CLR_CYAN; 45 | Constant MY_EMPHASIS_FG = CLR_WHITE; 46 | 47 | Object Library "The Library" 48 | with 49 | description [; 50 | print "You are "; 51 | ChangeFgColour(MY_EMPHASIS_FG); ! This has no effect unless colours are active 52 | print "in "; 53 | ChangeFgColour(MY_DEFAULT_FG); ! This has no effect unless colours are active 54 | "a library."; 55 | ]; 56 | 57 | Object -> Box "box" 58 | with 59 | name 'box', 60 | inside_description "It feels so nice, standing in the box.", 61 | has container open openable enterable; 62 | 63 | [Initialise ozmoo_colours; 64 | #Ifv5; 65 | if(OzmooColoursAvailable()) 66 | ozmoo_colours = true; 67 | if(HDR_TERPFLAGS->0 & 1) { 68 | print "^^Would you like colour? "; 69 | if(YesOrNo()) { 70 | clr_on = true; 71 | clr_fg = MY_DEFAULT_FG; ! Defined in this program, right after including "puny.h" 72 | clr_bg = CLR_BLACK; 73 | if(ozmoo_colours) 74 | clr_fginput = CLR_OZMOO_LIGHT_GREEN; ! We choose to use one of the 8 extra colours in Ozmoo 75 | else 76 | clr_fginput = CLR_YELLOW; ! Don't set this, or set it to CLR_CURRENT, to keep input in same colour as normal text 77 | clr_fgstatus = CLR_RED; ! Don't set this, or set it to CLR_CURRENT, to keep statusline in same colour as normal text 78 | } 79 | ClearScreen(WIN_ALL); 80 | } 81 | #Ifnot; 82 | ozmoo_colours = false; 83 | #Endif; 84 | print "^^And so the story begins...^^"; 85 | ]; 86 | -------------------------------------------------------------------------------- /tests/test-issue64.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Room; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | !Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | #Ifndef USEINFORM; 45 | Include "puny.h"; 46 | #EndIf; 47 | 48 | ! Uncomment to add PunyLib extensions 49 | !Include "ext_menu.h"; 50 | !Include "ext_flags.h"; 51 | !Include "ext_quote_box.h"; 52 | !Include "ext_cheap_scenery.h"; 53 | 54 | 55 | #Ifdef USEINFORM; 56 | Include "Grammar"; 57 | #Endif; 58 | 59 | Object Room "Room" 60 | with description "You are in a room.", 61 | s_to Room2, 62 | has light; 63 | 64 | Object Room2 "Room 2" 65 | with description "You are in another room.", 66 | n_to Room, 67 | has light; 68 | 69 | Object apple "apple" Room 70 | with name 'apple', 71 | Before [; eat: deadflag = 2; ], 72 | has edible; 73 | 74 | Object banana "banana" Room 75 | with name 'banana', 76 | has edible; 77 | 78 | Object orange "orange" Room2 79 | with name 'orange', 80 | has edible; 81 | 82 | Object bob "Bob" Room 83 | with name 'bob' has animate proper; 84 | 85 | Object bush "bush" Room 86 | with 87 | name 'bush', 88 | Before [; 89 | Search: 90 | move pineapple to player; 91 | !give apple ~concealed; 92 | "You find a pineapple. You take it."; 93 | ], 94 | has; 95 | 96 | Object pineapple "pineapple" 97 | with name 'pineapple', has concealed; 98 | 99 | [ Initialise; 100 | #IfDef USEINFORM; 101 | location=INITIAL_LOCATION_VALUE; 102 | #EndIf; 103 | ]; 104 | 105 | -------------------------------------------------------------------------------- /tests/test-gprheld.inf: -------------------------------------------------------------------------------- 1 | ! Testing what is/SopeWithin and custom meta 2 | ! 3 | #Iftrue (#version_number == 8); 4 | Constant USEINFORM; 5 | #Endif; 6 | 7 | Constant Story "Parser test"; 8 | Constant Headline "^A parser test suite for PunyInform.^"; 9 | Serial "200827"; 10 | Constant INITIAL_LOCATION_VALUE = LitRoom; 11 | 12 | ! Uncomment to show time instead of score/turns 13 | !Statusline time; 14 | 15 | !Constant DEBUG; 16 | !Constant DEBUG_PARSEANDPERFORM; 17 | !Constant DEBUG_PARSEPATTERN; 18 | !Constant DEBUG_PARSETOKEN; 19 | !Constant DEBUG_PARSENOUNPHRASE; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_SCOPE; 22 | 23 | ! Uncomment to add optional features to PunyLib 24 | !Constant DEBUG; 25 | !Constant CUSTOM_ABBREVIATIONS; 26 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 27 | Constant OPTIONAL_EXTENDED_METAVERBS; 28 | !Constant OPTIONAL_EXTENDED_VERBSET; 29 | !Constant OPTIONAL_FULL_SCORE; 30 | !Constant OPTIONAL_FULL_DIRECTIONS; 31 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 32 | !Constant OPTIONAL_MANUAL_SCOPE; 33 | !Constant RUNTIME_ERRORS = 0; 34 | 35 | #Ifdef USEINFORM; 36 | Include "Parser"; 37 | Include "VerbLib"; 38 | #IfNot; 39 | Include "globals.h"; 40 | #EndIf; 41 | 42 | #Ifndef USEINFORM; 43 | Include "puny.h"; 44 | #EndIf; 45 | 46 | ! Uncomment to add PunyLib extensions 47 | !Include "ext_menu.h"; 48 | !Include "ext_flags.h"; 49 | !Include "ext_quote_box.h"; 50 | !Include "ext_cheap_scenery.h"; 51 | 52 | #Ifdef USEINFORM; 53 | Include "Grammar"; 54 | #Endif; 55 | 56 | ! see https://intfiction.org/t/a-heldclothing-token/69982/4 57 | 58 | #Ifdef USEINFORM; 59 | [ ClothingWithTake tmp_wn obj; 60 | tmp_wn = wn; 61 | obj = ParseToken(ELEMENTARY_TT, NOUN_TOKEN); 62 | if (obj && obj ofclass Object && obj has clothing) { 63 | wn = tmp_wn; 64 | return GPR_HELD; 65 | } 66 | return GPR_FAIL; 67 | ]; 68 | #IfNot; 69 | [ ClothingWithTake tmp_wn obj; 70 | tmp_wn = wn; 71 | obj = ParseToken(TT_OBJECT, NOUN_OBJECT); 72 | if (obj && obj ofclass Object && obj has clothing) { 73 | wn = tmp_wn; 74 | return GPR_HELD; 75 | } 76 | return GPR_FAIL; 77 | ]; 78 | #Endif; 79 | 80 | Verb 'porter' 81 | * ClothingWithTake -> Wear 82 | * noun -> Take; 83 | 84 | Object LitRoom "Lit Room" 85 | with 86 | description [; 87 | print "You are in a brightly lit room.^"; 88 | ], 89 | has light; 90 | 91 | Object -> Shirt "shirt" 92 | with 93 | name 'shirt', 94 | has clothing; 95 | 96 | Object -> Rock "rock" 97 | with 98 | name 'rock'; 99 | 100 | [Initialise; 101 | print "^^Try ~porter shirt~^^"; 102 | #IfDef USEINFORM; 103 | location=INITIAL_LOCATION_VALUE;; 104 | #EndIf; 105 | ]; 106 | 107 | 108 | -------------------------------------------------------------------------------- /tests/test-allbut.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = LitRoom; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | !Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | #Ifndef USEINFORM; 45 | Include "puny.h"; 46 | #EndIf; 47 | 48 | ! Uncomment to add PunyLib extensions 49 | !Include "ext_menu.h"; 50 | !Include "ext_flags.h"; 51 | !Include "ext_quote_box.h"; 52 | !Include "ext_cheap_scenery.h"; 53 | 54 | 55 | ! -- testing third noun 56 | ! See: https://www.inform-fiction.org/manual/html/sa6.html#ans91 57 | 58 | #Ifdef USEINFORM; 59 | Include "Grammar"; 60 | #Endif; 61 | 62 | Object AnotherRoom "Another Room" 63 | with 64 | description [; 65 | print "You are the other room.^"; 66 | ], 67 | n_to LitRoom, 68 | has light; 69 | 70 | Object LitRoom "Lit Room" 71 | with 72 | description [; 73 | print "You are in a brightly lit room.^"; 74 | ], 75 | s_to AnotherRoom, 76 | has light; 77 | 78 | Object -> Battery "battery" 79 | with 80 | name 'battery'; 81 | 82 | Object -> Trousers "trousers" 83 | with 84 | name 'trousers' 85 | has clothing pluralname; 86 | 87 | Object -> Box "box" 88 | with 89 | name 'box', 90 | before [; 91 | Enter: "Not a good idea"; 92 | ], 93 | has open container static enterable; 94 | 95 | Object -> Sack "sack" 96 | with 97 | name 'sack', 98 | has open container static enterable; 99 | 100 | [Initialise; 101 | print "^^The testsuite is open for business!^^"; 102 | print "If you drop the ball in the dark room it will still be in scope.^"; 103 | #IfDef USEINFORM; 104 | location=INITIAL_LOCATION_VALUE; 105 | #EndIf; 106 | ]; 107 | 108 | 109 | -------------------------------------------------------------------------------- /tests/compile_all.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $inform_compiler = "inform" 3 | $is_windows = (ENV['OS'] == 'Windows_NT') 4 | 5 | $SPECIFIC_FILES = [ 6 | "../minimal.inf", 7 | "../cloak.inf", 8 | "../library_of_horror.inf", 9 | "../testbench.inf", 10 | ]; 11 | 12 | class CompilationError < StandardError 13 | def initialize(msg="Compilation error or warning.") 14 | super(msg) 15 | end 16 | end 17 | 18 | def checkforfailures() 19 | if $num_tests_failed > 0 then 20 | puts "\n#{$num_tests_failed}/#{$num_tests} TESTS FAILED!" 21 | exit 22 | end 23 | end 24 | 25 | def runtest(filename, version, inform_args) 26 | basename = File.basename(filename, ".inf") 27 | out_name = basename + "_test.z#{version}" 28 | inform_cmd = $inform_compiler + " +. +../lib -v#{version} #{inform_args} #{filename} #{out_name}" 29 | 30 | # if $is_windows then 31 | # else 32 | # end 33 | 34 | print "#{filename}: " 35 | begin 36 | result = %x[#{inform_cmd}] 37 | if result =~ /\(no output\)|Warning|Error/ 38 | puts "COMPILER OUTPUT: " 39 | puts result 40 | raise CompilationError 41 | end 42 | File.delete(out_name) 43 | $num_tests += 1 44 | puts "compiled" 45 | return nil 46 | rescue Errno::ENOENT 47 | puts "Failed to find a specified file or directory" 48 | exit 49 | rescue CompilationError 50 | puts "Compilation error or warning!" 51 | exit 52 | end 53 | end 54 | 55 | if ARGV.length > 0 then 56 | $inform_compiler = ARGV[0] 57 | end 58 | $num_tests = 0 59 | $num_tests_failed = 0 60 | 61 | puts "==================" 62 | puts "Testing v3 release" 63 | puts "==================" 64 | $SPECIFIC_FILES.each { |filename| runtest filename, 3, "" } 65 | Dir["../howto/*.inf"].sort.each { |filename| runtest filename, 3, "" } 66 | Dir["*.inf"].sort.each { |filename| runtest filename, 3, "" } 67 | 68 | puts "\n==================" 69 | puts "Testing v3 debug" 70 | puts "==================" 71 | $SPECIFIC_FILES.each { |filename| runtest filename, 3, "-D" } 72 | Dir["../howto/*.inf"].sort.each { |filename| runtest filename, 3, "-D" } 73 | Dir["*.inf"].sort.each { |filename| runtest filename, 3, "-D" } 74 | 75 | puts "\n==================" 76 | puts "Testing v5 release" 77 | puts "==================" 78 | $SPECIFIC_FILES.each { |filename| runtest filename, 5, "" } 79 | Dir["../howto/*.inf"].sort.each { |filename| runtest filename, 5, "" } 80 | Dir["*.inf"].sort.each { |filename| runtest filename, 5, "" } 81 | 82 | puts "\n==================" 83 | puts "Testing v5 debug" 84 | puts "==================" 85 | $SPECIFIC_FILES.each { |filename| runtest filename, 3, "-D" } 86 | Dir["../howto/*.inf"].sort.each { |filename| runtest filename, 5, "-D" } 87 | Dir["*.inf"].sort.each { |filename| runtest filename, 5, "-D" } 88 | 89 | puts "\nALL PROGRAMS COULD BE COMPILED WITHOUT WARNINGS OR ERRORS" 90 | -------------------------------------------------------------------------------- /howto/custom_directions.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Custom Directions"; 6 | Constant Headline "^A sample game which uses PunyInform.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | Constant NO_SCORE = 0; 10 | 11 | ! Uncomment to add optional features to PunyInform 12 | !Constant DEBUG; 13 | Constant OPTIONAL_NO_DARKNESS; 14 | !Constant OPTIONAL_FULL_DIRECTIONS; 15 | !Constant OPTIONAL_SHIP_DIRECTIONS; 16 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 17 | 18 | Constant INITIAL_LOCATION_VALUE = Field; 19 | 20 | Include "globals.h"; 21 | 22 | Include "puny.h"; 23 | 24 | Object Field "Field" 25 | with 26 | n_to Street, 27 | u_to Hill, 28 | description "You are in a field, surrounded by hills. A steep path 29 | leads up. A street lies hubwards."; 30 | 31 | Object Hill "Hill" 32 | with 33 | d_to Field, 34 | description "You're up in the clouds. You can't see the ground below. 35 | A steep path leads down."; 36 | 37 | Object Street "Street" 38 | with 39 | w_to TurnwiseStreet, 40 | e_to WiddershinsStreet, 41 | s_to Field, 42 | description "You are in a street, which stretches turnwise and 43 | widdershins from here. A field lies rimwards."; 44 | 45 | Object TurnwiseStreet "Turnwise Street" 46 | with e_to Street, 47 | description "This is a turning circle. The street continues widdershins."; 48 | 49 | Object WiddershinsStreet "Widdershins Street" 50 | with w_to Street, 51 | description "The street ends here at a brick wall. You can go back 52 | turnwise."; 53 | 54 | Array custom_dir_name_array static --> "direction" "hubwards" "rimwards" 55 | "widdershins" "turnwise" "up" "down" "in" "out"; 56 | 57 | [ DirShortName; 58 | print (string) custom_dir_name_array-->selected_direction_index; 59 | rtrue; 60 | ]; 61 | 62 | [ DirParseName _i _w; 63 | _w = WordValue(wn); 64 | switch(_w) { 65 | 'hubwards', 'h//': _i = 1; 66 | 'rimwards', 'r//': _i = 2; 67 | 'widdershins', 'w//': _i = 3; 68 | 'turnwise', 't//': _i = 4; 69 | 'up', 'u//': _i = 5; 70 | 'down', 'd//', 'floor', 'ground': _i = 6; 71 | 'in': _i = 7; 72 | 'out': _i = 8; 73 | } 74 | if(_i == 0) return 0; ! No direction was matched 75 | 76 | ! A match was found 77 | selected_direction_index = _i; 78 | selected_direction = direction_properties_array -> selected_direction_index; 79 | return 1; 80 | ]; 81 | 82 | [Initialise; 83 | lookmode = 2; ! Verbose room descriptions every time 84 | Directions.short_name = DirShortName; 85 | Directions.parse_name = DirParseName; 86 | print "^^In this game, the directions N, S, E, W have been replaced with 87 | HUBWARDS, RIMWARDS, WIDDERSHINS, TURNWISE, while keeping 88 | UP, DOWN, IN and OUT.^^ 89 | We could of course have decreased or increased the number of 90 | directions, using new properties for any extra directions.^^"; 91 | ]; 92 | -------------------------------------------------------------------------------- /tests/test-beforeparsing.inf: -------------------------------------------------------------------------------- 1 | ! Testing what is/SopeWithin and custom meta 2 | ! 3 | #Iftrue (#version_number == 8); 4 | Constant USEINFORM; 5 | #Endif; 6 | 7 | 8 | Constant Story "Parser test"; 9 | Constant Headline "^A parser test suite for PunyInform.^"; 10 | Serial "200827"; 11 | Constant INITIAL_LOCATION_VALUE = LitRoom; 12 | 13 | ! Uncomment to show time instead of score/turns 14 | !Statusline time; 15 | 16 | !Constant DEBUG; 17 | !Constant DEBUG_PARSEANDPERFORM; 18 | !Constant DEBUG_PARSEPATTERN; 19 | !Constant DEBUG_PARSETOKEN; 20 | !Constant DEBUG_PARSENOUNPHRASE; 21 | !Constant DEBUG_GETNEXTNOUN; 22 | !Constant DEBUG_SCOPE; 23 | 24 | ! Uncomment to add optional features to PunyLib 25 | Constant DEBUG; 26 | !Constant CUSTOM_ABBREVIATIONS; 27 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 28 | Constant OPTIONAL_EXTENDED_METAVERBS; 29 | !Constant OPTIONAL_EXTENDED_VERBSET; 30 | !Constant OPTIONAL_FULL_SCORE; 31 | !Constant OPTIONAL_FULL_DIRECTIONS; 32 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 33 | !Constant OPTIONAL_MANUAL_SCOPE; 34 | !Constant RUNTIME_ERRORS = 0; 35 | 36 | #Ifdef USEINFORM; 37 | Include "Parser"; 38 | Include "VerbLib"; 39 | #IfNot; 40 | Include "globals.h"; 41 | #EndIf; 42 | 43 | ! -- testing BeforeParsing 44 | [ BeforeParsing _i _j; 45 | ! remove some adverbs from parse before trying to parse the input 46 | !_PrintParseArray(parse); 47 | for(_i = 0, _j = 0 : _i < parse -> 1 : _i++) { 48 | ! skip (continue) if adverbs such as slowly found 49 | if((parse + 2 + _i * 4) --> 0 == 'slowly') { 50 | !print "skipped slowly^"; 51 | continue; 52 | } 53 | if(_i ~= _j) { 54 | (parse + 2 + _j * 4) --> 0 = (parse + 2 + _i * 4) --> 0; 55 | (parse + 2 + _j * 4) --> 1 = (parse + 2 + _i * 4) --> 1; 56 | } 57 | _j = _j + 1; 58 | } 59 | parse -> 1 = _j; 60 | !_PrintParseArray(parse); 61 | ]; 62 | 63 | 64 | #Ifndef USEINFORM; 65 | Include "puny.h"; 66 | #EndIf; 67 | 68 | ! Uncomment to add PunyLib extensions 69 | !Include "ext_menu.h"; 70 | !Include "ext_flags.h"; 71 | !Include "ext_quote_box.h"; 72 | !Include "ext_cheap_scenery.h"; 73 | 74 | 75 | Object LitRoom "Lit Room" 76 | with 77 | description [; 78 | print "You are in a brightly lit room.^"; 79 | ], 80 | has light; 81 | 82 | Object -> Battery "battery" 83 | with 84 | name 'battery'; 85 | 86 | Object -> Mounting "mounting" 87 | with 88 | name 'mounting'; 89 | 90 | Object -> Toolbox "toolbox" 91 | with 92 | name 'toolbox'; 93 | 94 | [Initialise; 95 | print "^^The testsuite is open for business!^^"; 96 | print "If you drop the ball in the dark room it will still be in scope.^"; 97 | 98 | #IfDef USEINFORM; 99 | location=INITIAL_LOCATION_VALUE;; 100 | #EndIf; 101 | ]; 102 | 103 | 104 | -------------------------------------------------------------------------------- /tests/test5.inf: -------------------------------------------------------------------------------- 1 | ! this is a test of basic manipulation of multiple objects (balls etc) 2 | ! Bugs fixed/investigated using this test file 3 | ! - "drop cubes" when carrying no balls 4 | ! 5 | ! 6 | #Iftrue (#version_number == 8); 7 | Constant USEINFORM; 8 | #Endif; 9 | 10 | Constant Story "Parser test"; 11 | Constant Headline "^A parser test suite for PunyInform.^"; 12 | Serial "200827"; 13 | Constant INITIAL_LOCATION_VALUE = LitRoom; 14 | 15 | ! Uncomment to show time instead of score/turns 16 | !Statusline time; 17 | 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | [ InScope person i; 45 | if (person == player && location == thedark) { 46 | objectloop (i in parent(player)) { 47 | if (i has moved) { 48 | PlaceInScope(i); 49 | } 50 | } 51 | } 52 | if (person == player && real_location == DarkRoom2 ) { 53 | PlaceInScope(Table); 54 | rtrue; 55 | } 56 | rfalse; 57 | ]; 58 | 59 | 60 | ! Uncomment to add PunyLib extensions 61 | !Include "ext_menu.h"; 62 | !Include "ext_flags.h"; 63 | !Include "ext_quote_box.h"; 64 | !Include "ext_cheap_scenery.h"; 65 | 66 | #Ifndef USEINFORM; 67 | Include "puny.h"; 68 | #EndIf; 69 | 70 | Object LitRoom "Lit Room" 71 | with 72 | description [; 73 | print "You are in a brightly lit room. Dark doorway leads west and east."; 74 | ], 75 | e_to DarkRoom1, 76 | w_to DarkRoom2 77 | has light; 78 | 79 | Object -> Ball "ball" 80 | with 81 | name 'ball'; 82 | 83 | 84 | Object DarkRoom1 "Dark Room" 85 | with 86 | description "Light falls in from the doorway to the west.", 87 | w_to LitRoom; 88 | 89 | Object -> Chair "chair" 90 | with 91 | name 'chair'; 92 | 93 | Object DarkRoom2 "Dark Room" 94 | with 95 | description "Light falls in from the doorway to the east.", 96 | e_to LitRoom; 97 | 98 | Object -> Table "table" 99 | with 100 | name 'table'; 101 | 102 | [Initialise; 103 | print "^^The testsuite is open for business!^^"; 104 | print "If you drop the ball in the dark room it will still be in scope.^"; 105 | #IfDef USEINFORM; 106 | location=LitRoom; 107 | #EndIf; 108 | ]; 109 | 110 | #Ifdef USEINFORM; 111 | Include "Grammar"; 112 | #Endif; 113 | 114 | -------------------------------------------------------------------------------- /tests/test-chooseobjects.inf: -------------------------------------------------------------------------------- 1 | #Iftrue (#version_number == 8); 2 | Constant USEINFORM; 3 | #Endif; 4 | 5 | Constant Story "Parser test"; 6 | Constant Headline "^A parser test suite for PunyInform.^"; 7 | Serial "200827"; 8 | 9 | 10 | Constant INITIAL_LOCATION_VALUE = Library; 11 | 12 | #Ifndef USEINFORM; 13 | ! Uncomment to show time instead of score/turns 14 | !Statusline time; 15 | 16 | Constant DEBUG; 17 | !Constant DEBUG_PARSEANDPERFORM; 18 | !Constant DEBUG_PARSEPATTERN; 19 | !Constant DEBUG_PARSETOKEN; 20 | !Constant DEBUG_PARSENOUNPHRASE; 21 | !Constant DEBUG_GETNEXTNOUN; 22 | !Constant DEBUG_SCOPE; 23 | 24 | ! Uncomment to add optional features to PunyLib 25 | !Constant DEBUG; 26 | !Constant CUSTOM_ABBREVIATIONS; 27 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 28 | Constant OPTIONAL_EXTENDED_METAVERBS; 29 | Constant OPTIONAL_EXTENDED_VERBSET; 30 | !Constant OPTIONAL_NO_DARKNESS; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | #EndIf; 37 | 38 | #Ifdef USEINFORM; 39 | Include "Parser"; 40 | Include "VerbLib"; 41 | 42 | #IfNot; 43 | Include "globals.h"; 44 | #EndIf; 45 | 46 | [ ChooseObjects obj code; 47 | if(obj == 0) return 1; 48 | !print (the) obj," ",code, " ", action, " ", action_to_be, "^"; 49 | if(code < 2) { 50 | ! considering including obj in "all", with 51 | ! code == true if wanting to add the obj 52 | if (obj has scenery) { 53 | ! force include (would normally be excluded) 54 | return 1; 55 | } 56 | rfalse; ! go with std parser decision 57 | } 58 | ! deciding between seemingly equally good matches 59 | if(action_to_be == ##Eat && obj has edible) return 3; 60 | if(obj hasnt scenery) return 2; 61 | return 1; 62 | ]; 63 | 64 | #Ifndef USEINFORM; 65 | Include "puny.h"; 66 | #EndIf; 67 | 68 | ! Uncomment to add PunyLib extensions 69 | !Include "ext_menu.h"; 70 | !Include "ext_flags.h"; 71 | !Include "ext_quote_box.h"; 72 | !Include "ext_cheap_scenery.h"; 73 | 74 | #Ifdef USEINFORM; 75 | Include "Grammar"; 76 | #Endif; 77 | Object Library "The Library" 78 | with 79 | description "You are in a library.", 80 | has light; 81 | 82 | Object -> John "John" 83 | with name 'john', 84 | description "He is beautiful and he knows it.", 85 | has animate proper; 86 | 87 | Object -> BlackRod "black rod" 88 | with name 'black' 'rod', 89 | ; 90 | 91 | Object -> BlackCake "black cake" 92 | with name 'black' 'cake', 93 | before [; 94 | Eat: "You decide to leave it for later."; 95 | ], 96 | has edible; 97 | 98 | Object -> Shrubbery "shrubbery" 99 | with name 'shrubbery', 100 | has scenery; 101 | 102 | [ Initialise; 103 | #IfDef USEINFORM; 104 | location=INITIAL_LOCATION_VALUE; 105 | #EndIf; 106 | ChooseObjects(0,0); 107 | ]; 108 | -------------------------------------------------------------------------------- /tests/test-updatescope.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | 3 | Constant Story "Update Scope test"; 4 | Constant Headline "^A sample game which uses PunyInform.^"; 5 | 6 | Constant STATUSLINE_SCORE; Statusline score; 7 | 8 | Constant DEBUG; 9 | Constant OPTIONAL_NO_DARKNESS; 10 | Constant OPTIONAL_EXTENDED_METAVERBS; 11 | Constant OPTIONAL_MANUAL_SCOPE; 12 | Constant OPTIONAL_MANUAL_SCOPE_BOOST; 13 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 14 | 15 | Constant INITIAL_LOCATION_VALUE = NearLocation; 16 | 17 | Include "globals.h"; 18 | 19 | ! [ ForceScopeUpdate; 20 | ! if(scope_reason == PARSING_REASON && location == NearLocation) 21 | ! rtrue; 22 | ! if(scope_reason == PARSING_REASON && action_to_be == ##Take) 23 | ! rtrue; 24 | ! if(scope_reason == REACT_BEFORE_REASON) 25 | ! rtrue; 26 | ! if(scope_reason == EACH_TURN_REASON && turns == 2) 27 | ! rtrue; 28 | ! rfalse; 29 | ! ]; 30 | 31 | [ InScope p_actor; 32 | print "^InScope(", (name) p_actor, ", "; 33 | 34 | switch(scope_reason) { 35 | PARSING_REASON: print "PARSING"; 36 | !TALKING_REASON: print "TALKING"; 37 | EACH_TURN_REASON: print "EACH_TURN"; 38 | REACT_BEFORE_REASON: print "REACT_BEFORE"; 39 | REACT_AFTER_REASON: print "REACT_AFTER"; 40 | LOOPOVERSCOPE_REASON: print "LOOPOVERSCOPE"; 41 | TESTSCOPE_REASON: print "TESTSCOPE"; 42 | } 43 | if(action >= 0) 44 | print ", ", (DebugAction) action; 45 | print ")^"; 46 | if(scope_reason == PARSING_REASON && location == NearLocation) 47 | PlaceInScope(Linda); 48 | if(scope_reason == REACT_BEFORE_REASON) 49 | PlaceInScope(RemoteObject); 50 | if(scope_reason == EACH_TURN_REASON && turns == 2) 51 | PlaceInScope(RemoteObject); 52 | rfalse; 53 | ]; 54 | 55 | Include "puny.h"; 56 | 57 | Object NearLocation "The Near Location" 58 | with 59 | description "You are in a near location. East lies a remote location.", 60 | e_to RemoteLocation; 61 | 62 | Object -> Box "box" 63 | with 64 | name 'box', 65 | has container open openable enterable; 66 | 67 | Object -> Bob "Bob" 68 | with 69 | name 'bob', 70 | has animate proper; 71 | 72 | Object -> NearObject "near object" 73 | with 74 | name 'near' 'object'; 75 | 76 | Object RemoteLocation "The Near Location" 77 | with 78 | description "You are in a remote location. West lies a near location.", 79 | w_to NearLocation; 80 | 81 | Object -> Linda "Linda" 82 | with 83 | name 'linda', 84 | has animate proper female; 85 | 86 | Object -> RemoteObject "remote object" 87 | with 88 | name 'remote' 'object', 89 | react_before [; 90 | Take: print "^The remote object says ~You will take something.~^"; 91 | ], 92 | react_after [; 93 | Take: print "^The remote object says ~You have taken something.~^"; 94 | ], 95 | each_turn [; 96 | print "^The remote object says ~I do something every turn.~^"; 97 | ]; 98 | 99 | [Initialise; 100 | print "^^And so the story begins...^^"; 101 | ]; 102 | -------------------------------------------------------------------------------- /tests/test-consult.inf: -------------------------------------------------------------------------------- 1 | #Iftrue (#version_number == 8); 2 | Constant USEINFORM; 3 | #Endif; 4 | 5 | Constant Story "Parser test"; 6 | Constant Headline "^A parser test suite for PunyInform.^"; 7 | Serial "200827"; 8 | Constant INITIAL_LOCATION_VALUE = Library; 9 | 10 | ! Uncomment to show time instead of score/turns 11 | !Statusline time; 12 | 13 | Constant DEBUG; 14 | !Constant DEBUG_PARSEANDPERFORM; 15 | !Constant DEBUG_PARSEPATTERN; 16 | !Constant DEBUG_PARSETOKEN; 17 | !Constant DEBUG_PARSENOUNPHRASE; 18 | !Constant DEBUG_GETNEXTNOUN; 19 | !Constant DEBUG_SCOPE; 20 | 21 | ! Uncomment to add optional features to PunyLib 22 | !Constant DEBUG; 23 | !Constant CUSTOM_ABBREVIATIONS; 24 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 25 | Constant OPTIONAL_EXTENDED_METAVERBS; 26 | Constant OPTIONAL_EXTENDED_VERBSET; 27 | !Constant OPTIONAL_NO_DARKNESS; 28 | !Constant OPTIONAL_FULL_SCORE; 29 | !Constant OPTIONAL_FULL_DIRECTIONS; 30 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 31 | !Constant OPTIONAL_MANUAL_SCOPE; 32 | !Constant RUNTIME_ERRORS = 0; 33 | 34 | #Ifdef USEINFORM; 35 | Include "Parser"; 36 | Include "VerbLib"; 37 | #IfNot; 38 | Include "globals.h"; 39 | #EndIf; 40 | 41 | #Ifndef USEINFORM; 42 | Include "puny.h"; 43 | #EndIf; 44 | 45 | ! Uncomment to add PunyLib extensions 46 | !Include "ext_menu.h"; 47 | !Include "ext_flags.h"; 48 | !Include "ext_quote_box.h"; 49 | !Include "ext_cheap_scenery.h"; 50 | 51 | 52 | #Ifdef USEINFORM; 53 | Include "Grammar"; 54 | #Endif; 55 | 56 | Object Library "The Library" 57 | with 58 | description "You are in a library.", 59 | before [; 60 | !print "before: ", noun, ": ", second, "^"; 61 | ], 62 | has light; 63 | 64 | Object -> Book "book" 65 | with name 'book', 66 | before [; 67 | Consult: 68 | print "special_number = ", special_number, "^"; 69 | print "consult_words = ", consult_words, "^"; 70 | print "consult_from = ", consult_from, "^"; 71 | ], 72 | has open openable; 73 | 74 | Object -> John "John" 75 | with name 'john', 76 | life [; 77 | Answer: 78 | if(noun ~=0) print (address) noun, "^"; else print "???^"; 79 | print "special_number = ", special_number, "^"; 80 | print "consult_words = ", consult_words, "^"; 81 | print "consult_from = ", consult_from, "^"; 82 | "no answer."; 83 | Ask: 84 | if(second ~=0) print (address) second, "^"; else print "???^"; 85 | print "special_number = ", special_number, "^"; 86 | print "consult_words = ", consult_words, "^"; 87 | print "consult_from = ", consult_from, "^"; 88 | "John ignores your question."; 89 | ], 90 | before [; 91 | Consult: 92 | print "special_number = ", special_number, "^"; 93 | print "consult_words = ", consult_words, "^"; 94 | print "consult_from = ", consult_from, "^"; 95 | ], 96 | has animate proper; 97 | 98 | Object apple "apple" 99 | with name 'apple', 100 | has edible; 101 | 102 | 103 | 104 | 105 | [ Initialise; 106 | #IfDef USEINFORM; 107 | location=INITIAL_LOCATION_VALUE; 108 | #EndIf; 109 | ]; 110 | 111 | -------------------------------------------------------------------------------- /tests/containers.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | ! The very first lines of the main source code file for a game can 4 | ! contain compiler options, like the two lines above. -~S disables 5 | ! strict error checking. This is otherwise used in z5 and z8 games by 6 | ! default. While useful for debugging, it adds ~10 KB to the story file 7 | ! size and it makes the game slower. 8 | ! $OMIT_UNUSED_ROUTINES=1 makes the compiler remove all routines which 9 | ! aren't used. This can save some space. 10 | 11 | #Iftrue (#version_number == 8); 12 | Constant USEINFORM; 13 | #Endif; 14 | 15 | Constant Story "Minimal"; 16 | Constant Headline "^A sample game which uses PunyInform.^"; 17 | 18 | ! Uncomment to show time instead of score/turns 19 | Statusline time; 20 | 21 | !Constant DEBUG; 22 | !Constant DEBUG_PARSEANDPERFORM; 23 | !Constant DEBUG_PARSEPATTERN; 24 | !Constant DEBUG_PARSETOKEN; 25 | !Constant DEBUG_PARSENOUNPHRASE; 26 | !Constant DEBUG_GETNEXTNOUN; 27 | !Constant DEBUG_SCOPE; 28 | 29 | ! Uncomment to add optional features to PunyLib 30 | !Constant CUSTOM_ABBREVIATIONS; 31 | Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 32 | Constant OPTIONAL_EXTENDED_METAVERBS; 33 | !Constant OPTIONAL_EXTENDED_VERBSET; 34 | !Constant OPTIONAL_FULL_SCORE; 35 | Constant OPTIONAL_FULL_DIRECTIONS; 36 | !Constant OPTIONAL_SHIP_DIRECTIONS; 37 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 38 | !Constant OPTIONAL_MANUAL_SCOPE; 39 | !Constant RUNTIME_ERRORS = 0; 40 | 41 | ! Define any library constants you need here, like MAX_SCORE, 42 | ! AMUSING_PROVIDED, MAX_CARRIED, SACK_OBJECT, etc. 43 | 44 | Constant INITIAL_LOCATION_VALUE = Library; 45 | 46 | #Ifdef USEINFORM; 47 | Include "Parser"; 48 | Include "VerbLib"; 49 | #IfNot; 50 | Include "globals.h"; 51 | #EndIf; 52 | 53 | 54 | ! Define your own global variables here, if any 55 | 56 | ! Define the entry point routines you need here, like Amusing, DarkToDark etc. 57 | 58 | [GamePostRoutine; 59 | "Let's go!"; 60 | !print "time_rate is ", time_rate, "^"; 61 | ]; 62 | 63 | 64 | ! Uncomment to add PunyLib extensions 65 | !Include "ext_menu.h"; 66 | !Include "ext_flags.h"; 67 | !Include "ext_quote_box.h"; 68 | !Include "ext_cheap_scenery.h"; 69 | 70 | #Ifndef USEINFORM; 71 | Include "puny.h"; 72 | #EndIf; 73 | #Ifdef USEINFORM; 74 | Include "Grammar"; 75 | #Endif; 76 | 77 | Include "ext_waittime.h"; 78 | 79 | Object Library "The Library" 80 | with 81 | description "You are in a library.", 82 | each_turn [; 83 | #Ifndef USEINFORM; 84 | print "The time is: ", status_field_1 ,":", status_field_2 ,"^"; 85 | #Endif; 86 | ], 87 | has light; 88 | 89 | Object -> Box "box" 90 | with 91 | name 'box', 92 | inside_description "It feels so nice, standing in the box.", 93 | has container openable enterable transparent; 94 | 95 | Object -> -> Knife "knife" 96 | with 97 | name 'knife'; 98 | 99 | [Initialise; 100 | print "^^And so the story begins...^^"; 101 | #IfDef USEINFORM; 102 | location=INITIAL_LOCATION_VALUE;; 103 | #EndIf; 104 | ]; 105 | -------------------------------------------------------------------------------- /tests/minimal-provideundo.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | 4 | ! The very first lines of the main source code file for a game can 5 | ! contain compiler options, like the two lines above. -~S disables 6 | ! strict error checking. This is otherwise used in z5 and z8 games by 7 | ! default. While useful for debugging, it adds ~10 KB to the story file 8 | ! size and it makes the game slower. 9 | ! $OMIT_UNUSED_ROUTINES=1 makes the compiler remove all routines which 10 | ! aren't used. This can save some space. 11 | 12 | Constant Story "Minimal"; 13 | Constant Headline "^A sample game which uses PunyInform.^"; 14 | 15 | ! Uncomment ONE of the two following lines, to show either time or score/turns 16 | ! Leaving both commented out makes the library bigger. 17 | !Constant STATUSLINE_TIME; Statusline time; 18 | Constant STATUSLINE_SCORE; Statusline score; 19 | 20 | ! Comment out to keep track of score 21 | ! The value is what will be shown as the score on statusline in z3 22 | Constant NO_SCORE = 0; 23 | 24 | ! Customize the statusline in z5+ (will have no effect in z3) 25 | !Constant OPTIONAL_SL_NO_SCORE; 26 | !Constant OPTIONAL_SL_NO_MOVES; 27 | 28 | ! Uncomment to add optional features to PunyInform 29 | !Constant DEBUG; 30 | !Constant CUSTOM_ABBREVIATIONS; 31 | !Constant CUSTOM_PLAYER_OBJECT = myPlayerObj; 32 | Constant OPTIONAL_NO_DARKNESS; 33 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 34 | Constant OPTIONAL_EXTENDED_METAVERBS; 35 | !Constant OPTIONAL_EXTENDED_VERBSET; 36 | !Constant OPTIONAL_PRINT_SCENERY_CONTENTS; 37 | !Constant OPTIONAL_SCORED; 38 | !Constant OPTIONAL_FULL_SCORE; ! Comment out NO_SCORE when uncommenting this 39 | !Constant OPTIONAL_FULL_DIRECTIONS; 40 | !Constant OPTIONAL_SIMPLE_DOORS; 41 | !Constant OPTIONAL_SHIP_DIRECTIONS; 42 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 43 | !Constant OPTIONAL_MANUAL_SCOPE; 44 | !Constant OPTIONAL_MANUAL_REACTIVE; 45 | !Constant OPTIONAL_ORDERED_TIMERS; 46 | #Iftrue (#version_number > 3); 47 | Constant OPTIONAL_PROVIDE_UNDO; 48 | #EndIf; 49 | !Constant OPTIONAL_REACTIVE_PARSE_NAME; 50 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 51 | 52 | ! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED, 53 | ! MAX_CARRIED, SACK_OBJECT, etc. 54 | 55 | !Constant INITIAL_LOCATION_VALUE = Library; 56 | 57 | Include "globals.h"; 58 | 59 | ! Define your own global variables here, if any 60 | 61 | ! Define the entry point routines you need here, like Amusing, DarkToDark etc. 62 | 63 | ! Uncomment to add PunyLib extensions 64 | !Include "ext_menu.h"; 65 | !Include "ext_flags.h"; 66 | !Include "ext_quote_box.h"; 67 | !Include "ext_cheap_scenery.h"; 68 | 69 | Include "puny.h"; 70 | 71 | ! Uncomment to add PunyLib extensions 72 | !Include "ext_waittime.h"; 73 | 74 | Object Dummy "dummy"; 75 | 76 | Object Library "The Library" 77 | with 78 | description "You are in a library."; 79 | 80 | Object -> Box "box" 81 | with 82 | name 'box', 83 | inside_description "It feels so nice, standing in the box.", 84 | has container open openable enterable; 85 | 86 | [Initialise; 87 | location = Library; 88 | print "^^And so the story begins...^^"; 89 | ]; 90 | -------------------------------------------------------------------------------- /tests/test-issue85.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Library; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | Constant OPTIONAL_EXTENDED_VERBSET; 31 | Constant OPTIONAL_NO_DARKNESS; 32 | !Constant OPTIONAL_FULL_SCORE; 33 | !Constant OPTIONAL_FULL_DIRECTIONS; 34 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 35 | !Constant OPTIONAL_MANUAL_SCOPE; 36 | !Constant RUNTIME_ERRORS = 0; 37 | 38 | #Ifdef USEINFORM; 39 | Include "Parser"; 40 | Include "VerbLib"; 41 | #IfNot; 42 | Include "globals.h"; 43 | #EndIf; 44 | 45 | #Ifndef USEINFORM; 46 | Include "puny.h"; 47 | #EndIf; 48 | 49 | ! Uncomment to add PunyLib extensions 50 | !Include "ext_menu.h"; 51 | !Include "ext_flags.h"; 52 | !Include "ext_quote_box.h"; 53 | !Include "ext_cheap_scenery.h"; 54 | 55 | 56 | #Ifdef USEINFORM; 57 | Include "Grammar"; 58 | #Endif; 59 | 60 | Object Library "The Library" 61 | with 62 | name 'scenery' 'useless', 63 | description "You are in a library." 64 | ; 65 | 66 | Object -> Apple "apple" 67 | with 68 | name 'apple', 69 | before [; 70 | Take: print "taking apple^"; 71 | Remove: print "removing apple^"; 72 | ], 73 | has edible; 74 | 75 | Object -> Banana "banana" 76 | with 77 | name 'banana', 78 | before [; 79 | Take: print "taking banana^"; 80 | Remove: print "removing banana^"; 81 | ], 82 | has edible; 83 | 84 | Object -> Lemon "lemon" 85 | with 86 | name 'lemon', 87 | before [; 88 | Take: print "taking lemon^"; 89 | Remove: print "removing lemon^"; 90 | ], 91 | has edible; 92 | 93 | Object -> Box "box" 94 | with 95 | name 'box', 96 | before [; 97 | Take: print "taking box^"; 98 | Remove: print "removing box^"; 99 | Receive: 100 | if(noun == Apple) "Apples are verboten"; 101 | LetGo: 102 | if(noun == Banana) "It seems to be stuck inside the box."; 103 | ], 104 | has container open openable; 105 | 106 | Object -> Indians "Apache Indians" 107 | with 108 | name 'apache' 'indians', 109 | has animate pluralname; 110 | 111 | Object -> John "John" 112 | with 113 | name 'john', 114 | has animate proper; 115 | 116 | [ Initialise; 117 | #IfDef USEINFORM; 118 | location=INITIAL_LOCATION_VALUE; 119 | #EndIf; 120 | ]; 121 | 122 | -------------------------------------------------------------------------------- /tests/runtests.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $inform_compiler = "inform" 3 | $is_windows = (ENV['OS'] == 'Windows_NT') 4 | 5 | def checkforfailures() 6 | if $num_tests_failed > 0 then 7 | puts "\n#{$num_tests_failed}/#{$num_tests} TESTS FAILED!" 8 | exit 9 | end 10 | end 11 | 12 | def runtest(filename, version, inform_args) 13 | basename = File.basename(filename, ".inf") 14 | command_file = basename + ".cmd" 15 | compileroutput_file = basename + "_z#{version}.messages" 16 | transcript_file = basename + ".scr" 17 | output_file = basename + ".output" 18 | template_file = basename + ".txt" 19 | 20 | if $is_windows then 21 | puts "Someone needs to provide Windows commands" 22 | exit 23 | else 24 | # use specific template file is available 25 | specific_template = "#{basename}.z#{version}.txt" 26 | template_file = specific_template if File.exist? specific_template 27 | inform_cmd = $inform_compiler + " +. +../lib -v#{version} #{inform_args} #{filename}" 28 | frotz_cmd = "frotz -w 80 -h 200 #{basename}.z#{version} < #{command_file}" 29 | # prune_cmd = "tail -n +6 #{transcript_file} | grep -v PunyInform > #{output_file}" 30 | prune_cmd = "tail -n +6 #{transcript_file} | grep -v PunyInform | gawk \"/qzl/ {print;next} {print gensub(/^(Default is \\\".+)\\\"/, \\\"\\\\\\1.qzl\\\\\\\"\\\", \\\"g\\\"); } \" > #{output_file}" 31 | diff_cmd = "diff -Z #{template_file} #{output_file}" 32 | diff_cmd_ignore_banner = "diff -ZB #{template_file} #{output_file} | grep -v PunyInform" 33 | end 34 | # Remove old transcripts 35 | File.delete transcript_file if File.exist? transcript_file 36 | 37 | print "#{basename}: " 38 | begin 39 | result = %x[#{inform_cmd}] 40 | File.open(compileroutput_file, 'w') { |file| file.write(result) } 41 | if result.include?("(no output)") || result.include?("Warning") || result.include?("Error") then 42 | puts result 43 | raise Errno::ENOENT 44 | end 45 | $num_tests += 1 46 | result = %x[#{frotz_cmd}] 47 | result = %x[#{prune_cmd}] 48 | result = %x[#{diff_cmd_ignore_banner}] 49 | if result.empty? then 50 | puts "passed" 51 | else 52 | puts "failed" 53 | $num_tests_failed += 1 54 | puts %x[#{diff_cmd}] 55 | end 56 | rescue Errno::ENOENT 57 | puts "unable to run this test (compilation error?)" 58 | exit 59 | end 60 | end 61 | 62 | if ARGV.length > 0 then 63 | $inform_compiler = ARGV[0] 64 | end 65 | $num_tests = 0 66 | $num_tests_failed = 0 67 | 68 | puts "Testing v3 release" 69 | Dir["*.inf"].sort.each { |filename| runtest filename, 3, "" } 70 | checkforfailures 71 | 72 | puts "Testing v3 debug" 73 | Dir["*.inf"].sort.each { |filename| runtest filename, 3, "-D" } 74 | checkforfailures 75 | 76 | puts "Testing v5 release" 77 | Dir["*.inf"].sort.each { |filename| runtest filename, 5, "" } 78 | checkforfailures 79 | 80 | puts "Testing v5 debug" 81 | Dir["*.inf"].sort.each { |filename| runtest filename, 5, "-D" } 82 | checkforfailures 83 | 84 | puts "\nALL TESTS PASSED" 85 | -------------------------------------------------------------------------------- /tests/test3.inf: -------------------------------------------------------------------------------- 1 | ! testing 'get red book and ladder from box' 2 | ! and 'put john on box' response 3 | 4 | Constant Story "Minimal"; 5 | Constant Headline "^A sample game which uses PunyInform.^"; 6 | 7 | Constant INITIAL_LOCATION_VALUE = example_room; 8 | 9 | Constant OPTIONAL_EXTENDED_METAVERBS; 10 | !Constant DEBUG_PARSEANDPERFORM; 11 | !Constant DEBUG_PARSEPATTERN; 12 | !Constant DEBUG_PARSETOKEN; 13 | !Constant DEBUG_PARSENOUNPHRASE; 14 | !Constant DEBUG_GETNEXTNOUN; 15 | !Constant DEBUG_SCOPE; 16 | Include "globals.h"; 17 | Include "puny.h"; 18 | 19 | Class Book 20 | with 21 | name 'books//p', 22 | description [; 23 | print "Self is ", self, "^"; 24 | if(self provides hello) { 25 | print (The) self, " has a Hello value of ", self.hello, ". ^"; 26 | } 27 | rfalse; 28 | ], 29 | hello 0, 30 | party [a; 31 | print "Self is ", self, "^"; 32 | print "a is ", a, "^"; 33 | ! print "b is ", b, "^"; 34 | ! print "c is ", c, "^"; 35 | ], 36 | before [; 37 | Open: 38 | "You've never been much of a reader."; 39 | ], 40 | has openable; 41 | 42 | 43 | Object example_room "Example Room" 44 | with description "You are in an example room, for test purposes.", 45 | has light; 46 | 47 | Object -> LargeBox "The box" ! Set the object name to the name we want on the z3 status line when we're in the box. short_name will be used for all other cases. 48 | with 49 | short_name "box", 50 | name 'box', 51 | inside_description "The box looked pretty big from the outside, but you feel really confined in here.", 52 | description "It's a large box. You could probably fit several people in there.", 53 | time_out [; 54 | print "^The box goes BOOM.^"; 55 | ], 56 | before [; 57 | ! LetGo: 58 | ! "No can do!"; 59 | ], 60 | after [; 61 | LetGo: 62 | "Yay, got rid of ", (the) noun, "!"; 63 | Open: 64 | #IfDef OPTIONAL_FULL_SCORE; 65 | Achieved(0); ! opening the box is an achievement 66 | #EndIf; 67 | Receive: 68 | ++score; 69 | ! win if you put two things in the box 70 | if(score >= MAX_SCORE) deadflag = 2; 71 | ], 72 | time_left 0, 73 | has container openable enterable static; 74 | 75 | Book -> -> RedBook "red book" 76 | with 77 | name 'red' 'book', 78 | initial "On the bottom of the box, there is a red book.", 79 | description "The book is old and worn.", 80 | before [; 81 | Take: 82 | if(player in LargeBox) { 83 | "It's too hard to pick it up while inside the box."; 84 | } 85 | ]; 86 | 87 | Object -> Ladder "ladder" 88 | with 89 | name 'ladder', 90 | description [; 91 | print "It's very sturdy. "; 92 | ; 93 | ! if(_PrintContents(" (which contains ", p_obj)) print ")"; 94 | ], 95 | after [; 96 | Receive: "Wow, you put ",(a) noun," on ", (the) self, "..."; 97 | ], 98 | inside_description "It's a really good ladder for standing on.", 99 | has supporter enterable; 100 | 101 | Object -> John "John" 102 | with 103 | name 'john' 104 | has proper animate; 105 | 106 | 107 | [Initialise; 108 | return 2; 109 | ]; 110 | -------------------------------------------------------------------------------- /tests/test-parsetoken.txt: -------------------------------------------------------------------------------- 1 | 2 | > . 3 | Come again? 4 | 5 | > .. 6 | Come again? 7 | 8 | Come again? 9 | 10 | > , 11 | Come again? 12 | 13 | > 14 | Come again? 15 | 16 | > x john 17 | He is beautiful and he knows it. 18 | 19 | > x beautiful 20 | He is beautiful and he knows it. 21 | 22 | > x the beautiful john 23 | He is beautiful and he knows it. 24 | 25 | > scan1 paper 26 | Scanning the paper... Clear! 27 | 28 | > scan1 paper and paperclip 29 | paper: Scanning the paper... Clear! 30 | paperclip: Scanning the paperclip... Clear! 31 | 32 | > scan1 paper with me 33 | Scanning the paper with yourself 34 | 35 | > scan1 all 36 | paper: Scanning the paper... Clear! 37 | paperclip: Scanning the paperclip... Clear! 38 | 39 | > scan2 paper 40 | Scanning the paper... Clear! 41 | 42 | > scan2 paper and paperclip 43 | You can't use multiple objects with that verb. 44 | 45 | > scan2 all 46 | You can't use multiple objects with that verb. 47 | 48 | > scan3 paper 49 | Scanning the paper... Clear! 50 | 51 | > scan3 paper here 52 | I don't understand that sentence. 53 | 54 | > scan3 john here 55 | Scanning John... Clear! 56 | 57 | > scan3 john 58 | You're crazy! 59 | 60 | > scan4 paper 61 | Scanning the paper... Clear! 62 | 63 | > scan4 paper here 64 | I don't understand that sentence. 65 | 66 | > scan4 john here 67 | Scanning John... Clear! 68 | 69 | > scan4 john 70 | You're crazy! 71 | 72 | > bang 100 73 | Noun is 100. 74 | 75 | > wow asdsadas 76 | ParseToken returned -1 77 | ParseToken returned -1 78 | You can't wow that, you crazy person! 79 | 80 | > wow john 81 | ParseToken returned -1 82 | ParseToken returned -1 83 | You can't wow that, you crazy person! 84 | 85 | > wow apple 86 | ParseToken returned 11 87 | ParseToken returned 11 88 | The apple is in scope! 89 | 90 | > bang xyzzy 91 | I didn't understand that number. 92 | 93 | > yeah 94 | I don't understand that sentence. 95 | 96 | > s 97 | Car Park 98 | You are in a car park. 99 | 100 | You can see a apple and a egg here. 101 | > x egg 102 | There is nothing special about the egg. 103 | 104 | > x yolk 105 | There is nothing special about the egg. 106 | 107 | > x yummy 108 | There is nothing special about the egg. 109 | 110 | > x yummy egg 111 | There is nothing special about the egg. 112 | 113 | > x yummy yolk 114 | There is nothing special about the egg. 115 | 116 | > x the egg 117 | There is nothing special about the egg. 118 | 119 | > x the yummy egg 120 | There is nothing special about the egg. 121 | 122 | > x apple 123 | There is nothing special about the apple. 124 | 125 | > x apricot 126 | There is nothing special about the apple. 127 | 128 | > x banana 129 | Sorry, I don't understand what "banana" means. 130 | 131 | > take apricot and egg 132 | apple: Taken. 133 | egg: Taken. 134 | 135 | > take banana and egg 136 | Sorry, I don't understand what "banana" means. 137 | 138 | > take apple. go north 139 | You already have it. 140 | 141 | The Library 142 | 143 | You can see John here. 144 | 145 | > s 146 | Car Park 147 | 148 | > take banana. go north 149 | Sorry, I don't understand what "banana" means. 150 | 151 | > quit 152 | Are you sure you want to quit? yes 153 | 154 | -------------------------------------------------------------------------------- /tests/test-score.inf: -------------------------------------------------------------------------------- 1 | ! testing normal scoring 2 | ! 3 | #Iftrue (#version_number == 8); 4 | Constant USEINFORM; 5 | #Endif; 6 | 7 | Constant Story "Parser test"; 8 | Constant Headline "^A parser test suite for PunyInform.^"; 9 | Serial "200827"; 10 | Constant INITIAL_LOCATION_VALUE = LitRoom; 11 | 12 | ! Uncomment to show time instead of score/turns 13 | !Statusline time; 14 | 15 | !Constant DEBUG; 16 | !Constant DEBUG_PARSEANDPERFORM; 17 | !Constant DEBUG_PARSEPATTERN; 18 | !Constant DEBUG_PARSETOKEN; 19 | !Constant DEBUG_PARSENOUNPHRASE; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_SCOPE; 22 | 23 | ! Uncomment to add optional features to PunyLib 24 | !Constant DEBUG; 25 | !Constant CUSTOM_ABBREVIATIONS; 26 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 27 | Constant OPTIONAL_EXTENDED_METAVERBS; 28 | !Constant OPTIONAL_EXTENDED_VERBSET; 29 | !Constant OPTIONAL_FULL_SCORE; 30 | !Constant OPTIONAL_FULL_DIRECTIONS; 31 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 32 | !Constant OPTIONAL_MANUAL_SCOPE; 33 | !Constant RUNTIME_ERRORS = 0; 34 | 35 | #IfDef OPTIONAL_FULL_SCORE; 36 | Constant MAX_SCORE = 7; 37 | Constant OBJECT_SCORE = 1; 38 | Array task_scores -> 3 0; ! inform doens't like array of length 1 39 | Constant TASKS_PROVIDED; 40 | Constant NUMBER_TASKS = 1; 41 | #IfNot; 42 | Constant MAX_SCORE = 4; 43 | #EndIf; 44 | 45 | ![ PrintTaskName task_number; 46 | ! switch (task_number) { 47 | ! 0: "opening the box"; 48 | ! } 49 | !]; 50 | 51 | 52 | #Ifdef USEINFORM; 53 | Include "Parser"; 54 | Include "VerbLib"; 55 | #IfNot; 56 | Include "globals.h"; 57 | #EndIf; 58 | 59 | #Ifndef USEINFORM; 60 | Include "puny.h"; 61 | #EndIf; 62 | 63 | ! Uncomment to add PunyLib extensions 64 | !Include "ext_menu.h"; 65 | !Include "ext_flags.h"; 66 | !Include "ext_quote_box.h"; 67 | !Include "ext_cheap_scenery.h"; 68 | 69 | #Ifdef USEINFORM; 70 | Include "Grammar"; 71 | #Endif; 72 | 73 | Object LitRoom "Lit Room" 74 | with 75 | description [; 76 | print "You are in a brightly lit room.^"; 77 | ], 78 | has light; 79 | 80 | Object -> Box "box" 81 | with 82 | name 'box', 83 | after [; 84 | LetGo: 85 | --score; 86 | "Yay, got rid of ", (the) noun, "!"; 87 | Open: 88 | #IfDef OPTIONAL_FULL_SCORE; 89 | Achieved(0); ! opening the box is an achievement 90 | #EndIf; 91 | Receive: 92 | ++score; 93 | ! win if you put two things in the box 94 | if(score >= MAX_SCORE) deadflag = 2; 95 | ], 96 | has openable static container; 97 | 98 | Object -> Poison "poison" 99 | with 100 | name 'poison', 101 | before [; 102 | Eat: 103 | deadflag = true; 104 | "AAAargh!"; 105 | ]; 106 | 107 | Object -> Point "one point" 108 | with 109 | name 'one' 'point'; 110 | 111 | Object -> Toy "toy" 112 | with 113 | name 'toy'; 114 | 115 | Object -> Torch "torch" 116 | with 117 | name 'torch'; 118 | 119 | [Initialise; 120 | print "^^The testsuite is open for business!^^"; 121 | #IfDef USEINFORM; 122 | location=INITIAL_LOCATION_VALUE;; 123 | #EndIf; 124 | ]; 125 | 126 | 127 | -------------------------------------------------------------------------------- /tests/minimal-waittime.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | 4 | ! The very first lines of the main source code file for a game can 5 | ! contain compiler options, like the two lines above. -~S disables 6 | ! strict error checking. This is otherwise used in z5 and z8 games by 7 | ! default. While useful for debugging, it adds ~10 KB to the story file 8 | ! size and it makes the game slower. 9 | ! $OMIT_UNUSED_ROUTINES=1 makes the compiler remove all routines which 10 | ! aren't used. This can save some space. 11 | 12 | Constant Story "Minimal"; 13 | Constant Headline "^A sample game which uses PunyInform.^"; 14 | 15 | ! Uncomment ONE of the two following lines, to show either time or score/turns 16 | ! Leaving both commented out makes the library bigger. 17 | Constant STATUSLINE_TIME; Statusline time; 18 | !Constant STATUSLINE_SCORE; Statusline score; 19 | 20 | ! Comment out to keep track of score 21 | ! The value is what will be shown as the score on statusline in z3 22 | Constant NO_SCORE = 0; 23 | 24 | ! Customize the statusline in z5+ (will have no effect in z3) 25 | !Constant OPTIONAL_SL_NO_SCORE; 26 | !Constant OPTIONAL_SL_NO_MOVES; 27 | 28 | ! Uncomment to add optional features to PunyInform 29 | !Constant DEBUG; 30 | !Constant CUSTOM_ABBREVIATIONS; 31 | !Constant CUSTOM_PLAYER_OBJECT = myPlayerObj; 32 | Constant OPTIONAL_NO_DARKNESS; 33 | Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 34 | Constant OPTIONAL_EXTENDED_METAVERBS; 35 | !Constant OPTIONAL_EXTENDED_VERBSET; 36 | !Constant OPTIONAL_PRINT_SCENERY_CONTENTS; 37 | !Constant OPTIONAL_SCORED; 38 | !Constant OPTIONAL_FULL_SCORE; ! Comment out NO_SCORE when uncommenting this 39 | !Constant OPTIONAL_FULL_DIRECTIONS; 40 | !Constant OPTIONAL_SIMPLE_DOORS; 41 | !Constant OPTIONAL_SHIP_DIRECTIONS; 42 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 43 | !Constant OPTIONAL_MANUAL_SCOPE; 44 | !Constant OPTIONAL_MANUAL_REACTIVE; 45 | !Constant OPTIONAL_ORDERED_TIMERS; 46 | !Constant OPTIONAL_PROVIDE_UNDO; 47 | !Constant OPTIONAL_REACTIVE_PARSE_NAME; 48 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 49 | 50 | ! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED, 51 | ! MAX_CARRIED, SACK_OBJECT, etc. 52 | 53 | Constant INITIAL_LOCATION_VALUE = Library; 54 | 55 | Include "globals.h"; 56 | 57 | ! Define your own global variables here, if any 58 | 59 | ! Define the entry point routines you need here, like Amusing, DarkToDark etc. 60 | 61 | ! Uncomment to add PunyLib extensions 62 | !Include "ext_menu.h"; 63 | !Include "ext_flags.h"; 64 | !Include "ext_quote_box.h"; 65 | !Include "ext_cheap_scenery.h"; 66 | 67 | Include "puny.h"; 68 | 69 | ! Uncomment to add PunyLib extensions 70 | Include "ext_waittime.h"; 71 | 72 | Object Library "The Library" 73 | with 74 | description "You are in a library.", 75 | after [ h m; 76 | WaitUntil, WaitHours, WaitMinutes, WaitMoves: 77 | h = the_time / 60; 78 | m = the_time % 60; 79 | "The time is now ", m, " minutes past ", h,". "; 80 | ]; 81 | 82 | Object -> Box "box" 83 | with 84 | name 'box', 85 | inside_description "It feels so nice, standing in the box.", 86 | has container open openable enterable; 87 | 88 | [Initialise; 89 | SetTime(23 * 60 + 10, 1); 90 | print "^^And so the story begins...^^"; 91 | ]; 92 | -------------------------------------------------------------------------------- /tests/test-updatescope.txt: -------------------------------------------------------------------------------- 1 | 2 | > linda, examine the remote object 3 | 4 | InScope(yourself, PARSING) 5 | 6 | InScope(Linda, PARSING, Examine) 7 | Linda has better things to do. 8 | 9 | InScope(yourself, EACH_TURN, Examine) 10 | 11 | > linda, examine me 12 | 13 | InScope(yourself, PARSING) 14 | 15 | InScope(Linda, PARSING, Examine) 16 | 17 | InScope(yourself, REACT_BEFORE, Answer) 18 | There is no reply. 19 | 20 | InScope(yourself, EACH_TURN, Answer) 21 | 22 | The remote object says "I do something every turn." 23 | 24 | > bob, examine linda 25 | 26 | InScope(yourself, PARSING) 27 | 28 | InScope(Bob, PARSING, Examine) 29 | Bob has better things to do. 30 | 31 | InScope(yourself, EACH_TURN, Examine) 32 | 33 | > e 34 | 35 | InScope(yourself, REACT_BEFORE, Go) 36 | 37 | InScope(yourself, REACT_AFTER, Go) 38 | The Near Location 39 | You are in a remote location. West lies a near location. 40 | 41 | You can see Linda and a remote object here. 42 | 43 | InScope(yourself, REACT_AFTER, Look) 44 | 45 | InScope(yourself, EACH_TURN, Go) 46 | 47 | The remote object says "I do something every turn." 48 | 49 | > w 50 | 51 | InScope(yourself, REACT_BEFORE, Go) 52 | 53 | InScope(yourself, REACT_AFTER, Go) 54 | The Near Location 55 | 56 | You can see a box (which is open but empty), Bob and a near object here. 57 | 58 | InScope(yourself, REACT_AFTER, Look) 59 | 60 | InScope(yourself, EACH_TURN, Go) 61 | 62 | > x me 63 | 64 | InScope(yourself, PARSING, Examine) 65 | 66 | InScope(yourself, REACT_BEFORE, Examine) 67 | As good-looking as ever. 68 | 69 | InScope(yourself, REACT_AFTER, Examine) 70 | 71 | InScope(yourself, EACH_TURN, Examine) 72 | 73 | > bob, x me 74 | 75 | InScope(yourself, PARSING) 76 | 77 | InScope(Bob, PARSING, Examine) 78 | Bob has better things to do. 79 | 80 | InScope(yourself, EACH_TURN, Examine) 81 | 82 | > bob, give me box 83 | 84 | InScope(yourself, PARSING) 85 | 86 | InScope(Bob, PARSING, Give) 87 | 88 | InScope(Bob, PARSING, Give) 89 | 90 | InScope(Bob, PARSING, Give) 91 | Bob has better things to do. 92 | 93 | InScope(yourself, EACH_TURN, Give) 94 | 95 | > ask bob about box 96 | 97 | InScope(yourself, PARSING, Ask) 98 | 99 | InScope(yourself, PARSING, Ask) 100 | 101 | InScope(yourself, REACT_BEFORE, Ask) 102 | There is no reply. 103 | 104 | InScope(yourself, EACH_TURN, Ask) 105 | 106 | > ask bob for box 107 | 108 | InScope(yourself, PARSING, Ask) 109 | 110 | InScope(yourself, PARSING, AskFor) 111 | 112 | InScope(yourself, PARSING, AskFor) 113 | Bob has better things to do. 114 | 115 | InScope(yourself, EACH_TURN, Give) 116 | 117 | > take box 118 | 119 | InScope(yourself, PARSING, Take) 120 | 121 | InScope(yourself, REACT_BEFORE, Take) 122 | 123 | The remote object says "You will take something." 124 | 125 | InScope(yourself, TESTSCOPE, Take) 126 | 127 | InScope(yourself, REACT_AFTER, Take) 128 | Taken. 129 | 130 | InScope(yourself, EACH_TURN, Take) 131 | 132 | > drop it 133 | 134 | InScope(yourself, PARSING, Drop) 135 | 136 | InScope(yourself, TESTSCOPE, Drop) 137 | 138 | InScope(yourself, REACT_BEFORE, Drop) 139 | 140 | InScope(yourself, REACT_AFTER, Drop) 141 | Dropped. 142 | 143 | InScope(yourself, EACH_TURN, Drop) 144 | 145 | > quit 146 | Are you sure you want to quit? yes 147 | 148 | -------------------------------------------------------------------------------- /tests/ruletest.inf: -------------------------------------------------------------------------------- 1 | #Iftrue (#version_number == 8); 2 | Constant USEINFORM; 3 | #Endif; 4 | 5 | Constant Story "Rule test"; 6 | Constant Headline "^A test to see when rules run as you go between rooms.^"; 7 | Serial "200827"; 8 | 9 | Constant INITIAL_LOCATION_VALUE = Room1; 10 | Constant DEBUG; 11 | 12 | #Ifndef USEINFORM; 13 | ! Uncomment to show time instead of score/turns 14 | !Statusline time; 15 | 16 | !Constant DEBUG_PARSEANDPERFORM; 17 | !Constant DEBUG_PARSEPATTERN; 18 | !Constant DEBUG_PARSETOKEN; 19 | !Constant DEBUG_PARSENOUNPHRASE; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_SCOPE; 22 | 23 | ! Uncomment to add optional features to PunyLib 24 | !Constant CUSTOM_ABBREVIATIONS; 25 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 26 | Constant OPTIONAL_EXTENDED_METAVERBS; 27 | Constant OPTIONAL_EXTENDED_VERBSET; 28 | !Constant OPTIONAL_NO_DARKNESS; 29 | !Constant OPTIONAL_FULL_SCORE; 30 | !Constant OPTIONAL_FULL_DIRECTIONS; 31 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 32 | !Constant OPTIONAL_MANUAL_SCOPE; 33 | !Constant RUNTIME_ERRORS = 0; 34 | #EndIf; 35 | 36 | #Ifdef USEINFORM; 37 | Include "Parser"; 38 | Include "VerbLib"; 39 | #IfNot; 40 | Include "globals.h"; 41 | #EndIf; 42 | 43 | #Ifndef USEINFORM; 44 | Include "puny.h"; 45 | #EndIf; 46 | 47 | ! Uncomment to add PunyLib extensions 48 | !Include "ext_menu.h"; 49 | !Include "ext_flags.h"; 50 | !Include "ext_quote_box.h"; 51 | !Include "ext_cheap_scenery.h"; 52 | 53 | 54 | #Ifdef USEINFORM; 55 | Include "Grammar"; 56 | #Endif; 57 | 58 | [ NounParameter p_w; 59 | if (p_w >= 1 && p_w <= top_object) print p_w, " (", (name) p_w, ")"; 60 | if (UnsignedCompare(p_w, dict_start) >= 0 && 61 | UnsignedCompare(p_w, dict_end) < 0 && 62 | (p_w - dict_start) % dict_entry_size == 0) 63 | print " ('", (address) p_w, "')"; 64 | ]; 65 | 66 | Class Room 67 | with 68 | print_trace [ prop; 69 | #Ifdef DEBUG; 70 | print " *** ", (name) self, ".", (string) prop, ": action is ", (DebugAction) action; 71 | if(noun ~= 0) print " noun=", (NounParameter) noun; 72 | if(second ~=0) print " second=", (NounParameter) second; 73 | print "^ consult ", consult_from, "/", consult_words; 74 | print " (going ", ##Going, ", notustood ", ##NotUnderstood, ")^"; 75 | #Endif; 76 | ], 77 | before [; self.print_trace("before"); ], 78 | after [; self.print_trace("after"); ], 79 | has light; 80 | 81 | Room Room1 "Room 1" 82 | with 83 | description "You can see that room 2 lies to the north.", 84 | n_to Room2; 85 | 86 | Object -> RedCube "red cube" 87 | with 88 | name 'red' 'cube'; 89 | 90 | Object -> BlackCube "black cube" 91 | with 92 | name 'black' 'cube'; 93 | 94 | Room -> John "John" 95 | with 96 | name 'john', 97 | life [; self.print_trace("life"); ], 98 | orders [; self.print_trace("orders"); ], 99 | has animate proper; 100 | 101 | Object -> -> Gun "gun" 102 | with 103 | name 'gun'; 104 | 105 | Room Room2 "Room 2" 106 | with 107 | description "You can see that room 1 lies to the south.", 108 | s_to Room1 109 | has ~light; 110 | 111 | [ Initialise; 112 | location = Room1; 113 | #Ifndef DEBUG; 114 | print "^^You need to compile in DEBUG mode to see what's happening!"; 115 | #Endif; 116 | "^^"; 117 | ]; 118 | -------------------------------------------------------------------------------- /tests/thirdnoun.inf: -------------------------------------------------------------------------------- 1 | ! Testing what is/SopeWithin and custom meta 2 | ! 3 | #Iftrue (#version_number == 8); 4 | Constant USEINFORM; 5 | #Endif; 6 | 7 | Constant Story "Parser test"; 8 | Constant Headline "^A parser test suite for PunyInform.^"; 9 | Serial "200827"; 10 | Constant INITIAL_LOCATION_VALUE = LitRoom; 11 | 12 | ! Uncomment to show time instead of score/turns 13 | !Statusline time; 14 | 15 | !Constant DEBUG; 16 | !Constant DEBUG_PARSEANDPERFORM; 17 | !Constant DEBUG_PARSEPATTERN; 18 | !Constant DEBUG_PARSETOKEN; 19 | !Constant DEBUG_PARSENOUNPHRASE; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_SCOPE; 22 | 23 | ! Uncomment to add optional features to PunyLib 24 | !Constant DEBUG; 25 | !Constant CUSTOM_ABBREVIATIONS; 26 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 27 | Constant OPTIONAL_EXTENDED_METAVERBS; 28 | !Constant OPTIONAL_EXTENDED_VERBSET; 29 | !Constant OPTIONAL_FULL_SCORE; 30 | !Constant OPTIONAL_FULL_DIRECTIONS; 31 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 32 | !Constant OPTIONAL_MANUAL_SCOPE; 33 | !Constant RUNTIME_ERRORS = 0; 34 | 35 | #Ifdef USEINFORM; 36 | Include "Parser"; 37 | Include "VerbLib"; 38 | #IfNot; 39 | Include "globals.h"; 40 | #EndIf; 41 | 42 | #Ifndef USEINFORM; 43 | Include "puny.h"; 44 | #EndIf; 45 | 46 | ! Uncomment to add PunyLib extensions 47 | !Include "ext_menu.h"; 48 | !Include "ext_flags.h"; 49 | !Include "ext_quote_box.h"; 50 | !Include "ext_cheap_scenery.h"; 51 | 52 | 53 | ! -- testing third noun 54 | ! See: https://www.inform-fiction.org/manual/html/sa6.html#ans91 55 | 56 | Global third; 57 | #Ifdef USEINFORM; 58 | [ ThirdNoun x; 59 | x = ParseToken(ELEMENTARY_TT, NOUN_TOKEN); 60 | if (x == GPR_FAIL or GPR_REPARSE) return x; 61 | third = x; return GPR_PREPOSITION; 62 | ]; 63 | #IfNot; 64 | [ ThirdNoun x; 65 | x = ParseToken(TT_OBJECT, NOUN_OBJECT); 66 | if (x == GPR_FAIL or GPR_REPARSE) return x; 67 | third = x; return GPR_PREPOSITION; 68 | ]; 69 | #EndIf; 70 | 71 | [ InstallSub; 72 | print "installing with ", (the) third, "^"; 73 | ]; 74 | 75 | Verb 'install' 76 | * noun 'on' noun 'with' ThirdNoun -> Install; 77 | 78 | #Ifdef USEINFORM; 79 | Include "Grammar"; 80 | #Endif; 81 | 82 | ! http://www.firthworks.com/roger/informfaq/vv.html 83 | ! (meta discussion at the end) 84 | ! 85 | ! but since restart is already orginally defined as meta 86 | ! we have to reinvert the logic here, and add a notMeta 87 | ! (to disable meta) instead. 88 | ![ isMeta; 89 | ! meta = true; 90 | ! return GPR_PREPOSITION; 91 | !]; 92 | 93 | [ notMeta; 94 | meta = false; 95 | return GPR_PREPOSITION; 96 | ]; 97 | 98 | Extend 'restart' replace 99 | * -> Restart 100 | * notMeta noun -> SwitchOn; 101 | 102 | 103 | Object LitRoom "Lit Room" 104 | with 105 | description [; 106 | print "You are in a brightly lit room.^"; 107 | ], 108 | has light; 109 | 110 | Object -> Battery "battery" 111 | with 112 | name 'battery'; 113 | 114 | Object -> Mounting "mounting" 115 | with 116 | name 'mounting'; 117 | 118 | Object -> Toolbox "toolbox" 119 | with 120 | name 'toolbox'; 121 | 122 | [Initialise; 123 | print "^^The testsuite is open for business!^^"; 124 | #IfDef USEINFORM; 125 | location=INITIAL_LOCATION_VALUE;; 126 | #EndIf; 127 | ]; 128 | 129 | 130 | -------------------------------------------------------------------------------- /tests/test-fullscore.inf: -------------------------------------------------------------------------------- 1 | ! testing normal scoring 2 | ! 3 | #Iftrue (#version_number == 8); 4 | Constant USEINFORM; 5 | #Endif; 6 | 7 | Constant Story "Parser test"; 8 | Constant Headline "^A parser test suite for PunyInform.^"; 9 | Serial "200827"; 10 | Constant INITIAL_LOCATION_VALUE = LitRoom; 11 | 12 | ! Uncomment to show time instead of score/turns 13 | !Statusline time; 14 | 15 | !Constant DEBUG; 16 | !Constant DEBUG_PARSEANDPERFORM; 17 | !Constant DEBUG_PARSEPATTERN; 18 | !Constant DEBUG_PARSETOKEN; 19 | !Constant DEBUG_PARSENOUNPHRASE; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_SCOPE; 22 | 23 | ! Uncomment to add optional features to PunyLib 24 | !Constant DEBUG; 25 | !Constant CUSTOM_ABBREVIATIONS; 26 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 27 | Constant OPTIONAL_EXTENDED_METAVERBS; 28 | !Constant OPTIONAL_EXTENDED_VERBSET; 29 | Constant OPTIONAL_SCORED; 30 | Constant OPTIONAL_FULL_SCORE; 31 | !Constant OPTIONAL_FULL_DIRECTIONS; 32 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 33 | !Constant OPTIONAL_MANUAL_SCOPE; 34 | !Constant RUNTIME_ERRORS = 0; 35 | 36 | !Constant OPTIONAL_SL_NO_SCORE; 37 | !Constant OPTIONAL_SL_NO_MOVES; 38 | 39 | #IfDef OPTIONAL_FULL_SCORE; 40 | Constant MAX_SCORE = 7; 41 | Constant OBJECT_SCORE = 1; 42 | Array task_scores -> 3 0; ! inform doens't like array of length 1 43 | Constant TASKS_PROVIDED; 44 | Constant NUMBER_TASKS = 1; 45 | #IfNot; 46 | Constant MAX_SCORE = 3; 47 | #EndIf; 48 | 49 | [ PrintTaskName task_number; 50 | switch (task_number) { 51 | 0: "opening the box"; 52 | } 53 | ]; 54 | 55 | 56 | #Ifdef USEINFORM; 57 | Include "Parser"; 58 | Include "VerbLib"; 59 | #IfNot; 60 | Include "globals.h"; 61 | #EndIf; 62 | 63 | #Ifndef USEINFORM; 64 | Include "puny.h"; 65 | #EndIf; 66 | 67 | ! Uncomment to add PunyLib extensions 68 | !Include "ext_menu.h"; 69 | !Include "ext_flags.h"; 70 | !Include "ext_quote_box.h"; 71 | !Include "ext_cheap_scenery.h"; 72 | 73 | #Ifdef USEINFORM; 74 | Include "Grammar"; 75 | #Endif; 76 | 77 | Object LitRoom "Lit Room" 78 | with 79 | description [; 80 | print "You are in a brightly lit room.^"; 81 | ], 82 | has light; 83 | 84 | Object -> Box "box" 85 | with 86 | name 'box', 87 | after [; 88 | LetGo: 89 | --score; 90 | "Yay, got rid of ", (the) noun, "!"; 91 | Open: 92 | #IfDef OPTIONAL_FULL_SCORE; 93 | Achieved(0); ! opening the box is an achievement 94 | #EndIf; 95 | Receive: 96 | ++score; 97 | ! win if you put two things in the box 98 | if(score >= MAX_SCORE) deadflag = 2; 99 | ], 100 | has openable static container; 101 | 102 | Object -> Poison "poison" 103 | with 104 | name 'poison', 105 | before [; 106 | Eat: 107 | deadflag = true; 108 | "AAAargh!"; 109 | ]; 110 | 111 | Object -> Point "one point" 112 | with 113 | name 'one' 'point' 114 | has scored; 115 | 116 | Object -> Toy "toy" 117 | with 118 | name 'toy'; 119 | 120 | Object -> Torch "torch" 121 | with 122 | name 'torch'; 123 | 124 | [Initialise; 125 | print "^^The testsuite is open for business!^^"; 126 | #IfDef USEINFORM; 127 | location=INITIAL_LOCATION_VALUE;; 128 | #EndIf; 129 | ]; 130 | 131 | 132 | -------------------------------------------------------------------------------- /howto/adjectives.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Adjectives"; 6 | Constant Headline "^A sample game which uses PunyInform.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | ! Uncomment to add optional features to PunyInform 11 | !Constant DEBUG; 12 | Constant OPTIONAL_NO_DARKNESS; 13 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 14 | 15 | Constant INITIAL_LOCATION_VALUE = Library; 16 | 17 | Include "globals.h"; 18 | 19 | Include "puny.h"; 20 | 21 | ! -------------------- Copy the following code to your own game 22 | 23 | #Ifv5; 24 | Property adj_name; 25 | Property noun_name; 26 | #Ifnot; 27 | Property individual adj_name; 28 | Property individual noun_name; 29 | #Endif; 30 | 31 | #Ifv5; 32 | [MatchNameList p_obj p_prop _w _matched _an _count _i; 33 | _an = p_obj.&p_prop; 34 | if(_an == 0) { wn++; return 0; } 35 | _count = p_obj.#p_prop; 36 | @log_shift _count (-1) -> _count; ! Divide by 2 37 | while(true) { 38 | _w = NextWord(); 39 | @scan_table _w _an _count -> _i ?_MNL_match; 40 | return _matched; 41 | ._MNL_match; 42 | _matched++; 43 | } 44 | ]; 45 | #Ifnot; 46 | [MatchNameList p_obj p_prop _w _matched _base _an _count _i; 47 | _an = p_obj.&p_prop; 48 | if(_an == 0) { wn++; return 0; } 49 | _count = p_obj.#p_prop / 2; 50 | while(true) { 51 | _w = NextWord(); 52 | _base = _matched; 53 | for(_i = 0 : _i < _count : _i++) 54 | if(_w == _an-->_i) { _matched++; break; } 55 | if(_matched == _base) return _matched; 56 | } 57 | ]; 58 | #Endif; 59 | 60 | Class AdjObject 61 | with 62 | parse_name [ _adj _noun; 63 | _adj = MatchNameList(self, adj_name); 64 | wn--; 65 | _noun = MatchNameList(self, noun_name); 66 | if(_noun) return _noun + _adj; 67 | ]; 68 | 69 | ! -------------------- End of code to copy 70 | 71 | 72 | Object Library "The Library" 73 | with 74 | description "I am in a library."; 75 | 76 | Object -> Box "box" 77 | with 78 | name 'box', 79 | inside_description "It feels so nice, standing in the box.", 80 | has container open openable enterable; 81 | 82 | Object -> RecordPlayer "brown record player" 83 | class AdjObject 84 | with 85 | adj_name 'brown' 'record', 86 | noun_name 'player', 87 | description "A beautiful record player, mostly made out of wood.", 88 | has static; 89 | 90 | Object -> Record "record" 91 | with 92 | name 'record', 93 | description "Dark Side of the Moon, by Pink Floyd."; 94 | 95 | Verb 'play' 96 | * held 'on' noun -> Play; 97 | 98 | [PlaySub; 99 | if(noun notin player) "You're not even holding ", (the) noun, "."; 100 | if(noun ~= Record) 101 | "That's not something you can play."; 102 | if(second ~= RecordPlayer) 103 | "You can't play it on that!"; 104 | "It sounds fantastic!"; 105 | ]; 106 | 107 | [Initialise; 108 | print "^^The AdjObject class allows you to define up to 32 adjectives and 109 | 32 nouns for an object, in any Z-code version. This can be used to add 110 | lots of synonyms as nouns, and/or to define some words as adjectives. 111 | Adjectives are words that can be used to refer to the object but only if 112 | they're followed by one or more nouns.^^ 113 | In this example, RECORD refers to the record, while RECORD PLAYER 114 | refers to the record player, and there is no ambiguity. You can also refer 115 | to the record player as BROWN PLAYER or BROWN RECORD PLAYER or just PLAYER.^^"; 116 | ]; 117 | -------------------------------------------------------------------------------- /documentation/technical/dictionary_and_grammar.txt: -------------------------------------------------------------------------------- 1 | Extra data in dictionary: 2 | 3 | byte 0 & $1 : Verb flag 4 | byte 0 & $2 : Meta flag 5 | 255 - (byte 1) : Verb number (255 - value is for "traditional Infocom reasons") 6 | 7 | 8 | 9 | Grammar table is always located at the start of static memory (address 10 | pointed to by word at $0e in header). Word (Verb number) points to the 11 | start address for the grammar for a verb. 12 | 13 | Grammar for a verb: 14 | 15 | For a detailed description of grammar version 2 (which is what we use), 16 | read the text starting with "GV2 is a much more suitable data structure" 17 | at https://www.inform-fiction.org/source/tm/TechMan.txt 18 | 19 | Byte 0: Number of grammar lines for this verb + 1 20 | Byte 1 ... Syntax line 0, 1, ... 21 | 22 | 23 | Grammar line 24 | 25 | 0: Highbyte of action_value 26 | 1: Lowbyte of action_value 27 | 28 | (action_value & $0400) ~= 0 means the action is reversed 29 | 30 | action = action_value & $03ff 31 | 32 | 3 bytes per token: 33 | byte 0 & $0f : token_type 34 | byte 1 + 2 : Token data 35 | If token_type = 15 (ENDIT_TOKEN), this is the end of line, and byte 1 36 | and 2 are not supplied. 37 | 38 | 39 | ILLEGAL_TT = 0; ! Types of grammar token: illegal 40 | ELEMENTARY_TT = 1; ! (one of those below) 41 | PREPOSITION_TT = 2; ! e.g. 'into' 42 | ROUTINE_FILTER_TT = 3; ! e.g. noun=CagedCreature 43 | ATTR_FILTER_TT = 4; ! e.g. edible 44 | SCOPE_TT = 5; ! e.g. scope=Spells 45 | GPR_TT = 6; ! a general parsing routine 46 | ENDIT_TOKEN = 15 47 | 48 | 49 | 50 | 51 | ALL BELOW THIS LINE IS GRAMMAR VERSION 1, WHICH WE DON'T INTEND TO USE AT ALL 52 | ----------------------------------------------------------------------------- 53 | 54 | 55 | Grammar for Quit, grammar version 1: 56 | 01 Number of grammar lines 57 | 58 | 00 params wanted 59 | ff token 1 60 | 00 token 2 61 | 00 token 3 62 | 00 token 4 63 | 00 token 5 64 | 00 token 6 65 | 00 action number 66 | 67 | 68 | 02 Grammar line 1, highbyte of action routine 69 | bd Grammar line 1, lowbyte of action routine 70 | 71 | 72 | Tokens available in grammar version 1: 73 | NOUN_TOKEN = 0; ! The elementary grammar tokens, and 74 | HELD_TOKEN = 1; ! the numbers compiled by Inform to 75 | MULTI_TOKEN = 2; ! encode them 76 | MULTIHELD_TOKEN = 3; 77 | MULTIEXCEPT_TOKEN = 4; 78 | MULTIINSIDE_TOKEN = 5; 79 | CREATURE_TOKEN = 6; 80 | SPECIAL_TOKEN = 7; 81 | NUMBER_TOKEN = 8; 82 | 83 | ENDIT_TOKEN = $0f ! Legal, but doesn't seem to be used 84 | 85 | Token $10-$2f are routine filters (ROUTINE_FILTER_TT). e.g. noun=CagedCreature 86 | 87 | Token $30-$4f are general parsing routines (GPR_TT). 88 | Routine address is in #preactions_table-->(token-48) 89 | 90 | Token $50-$7f are scope tokens (SCOPE_TT). e.g. scope=Spells 91 | Routine address is in #preactions_table-->(token-80) 92 | 93 | 94 | Token $80-$b3 are attribute filters (ATTR_FILTER_TT). e.g. edible 95 | 96 | Token $b4-$ff are prepositions (PREPOSITION_TT). e.g. 'into' 97 | Prepositions are located in the "adjectives table". The start address is 98 | in the constant #adjectives_table . Each entry consists of two words. If 99 | the second word is the preposition-number (like $ff), the first word is 100 | the address of the dictionary word. There is no length number or end 101 | marker. You should just expect to find the entry somewhere in there. 102 | 103 | -------------------------------------------------------------------------------- /tests/test-adjectives.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | Constant Story "Adjectives"; 6 | Constant Headline "^A sample game which uses PunyInform.^"; 7 | 8 | Constant STATUSLINE_SCORE; Statusline score; 9 | 10 | ! Uncomment to add optional features to PunyInform 11 | !Constant DEBUG; 12 | Constant OPTIONAL_NO_DARKNESS; 13 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 14 | 15 | Constant OPTIONAL_EXTENDED_METAVERBS; 16 | Constant OPTIONAL_EXTENDED_VERBSET; 17 | 18 | Constant INITIAL_LOCATION_VALUE = Library; 19 | 20 | Include "globals.h"; 21 | 22 | Include "puny.h"; 23 | 24 | ! -------------------- Copy the following code to your own game 25 | 26 | #Ifv5; 27 | Property adj_name; 28 | Property noun_name; 29 | #Ifnot; 30 | Property individual adj_name; 31 | Property individual noun_name; 32 | #Endif; 33 | 34 | #Ifv5; 35 | [MatchNameList p_obj p_prop _w _matched _an _count _i; 36 | #Ifnot; 37 | [MatchNameList p_obj p_prop _w _matched _base _an _count _i; 38 | #Endif; 39 | _w = NextWord(); 40 | _an = p_obj.&p_prop; 41 | if(_an == 0) return 0; 42 | _count = p_obj.#p_prop / 2; 43 | while(true) { 44 | #Ifv5; 45 | @scan_table _w _an _count -> _i ?_MNL_match; 46 | return _matched; 47 | ._MNL_match; 48 | _matched++; 49 | _w = NextWord(); 50 | #Ifnot; 51 | _base = _matched; 52 | for(_i = 0 : _i < _count : _i++) 53 | if(_w == _an-->_i) { _matched++; _w = NextWord(); break; } 54 | if(_matched == _base) return _matched; 55 | #Endif; 56 | } 57 | ]; 58 | 59 | Class AdjObject 60 | with 61 | parse_name [ _adj _noun; 62 | _adj = MatchNameList(self, adj_name); 63 | wn--; 64 | _noun = MatchNameList(self, noun_name); 65 | if(_noun) return _noun + _adj; 66 | ]; 67 | 68 | ! -------------------- End of code to copy 69 | 70 | 71 | Object Library "The Library" 72 | with 73 | description "I am in a library."; 74 | 75 | Object -> Box "box" 76 | with 77 | name 'box', 78 | inside_description "It feels so nice, standing in the box.", 79 | has container open openable enterable; 80 | 81 | Object -> RecordPlayer "brown record player" 82 | class AdjObject 83 | with 84 | adj_name 'brown' 'record', 85 | noun_name 'player', 86 | description "A beautiful record player, mostly made out of wood.", 87 | has static; 88 | 89 | Object -> Record "record" 90 | with 91 | name 'record', 92 | description "Dark Side of the Moon, by Pink Floyd."; 93 | 94 | Verb 'play' 95 | * held 'on' noun -> Play; 96 | 97 | [PlaySub; 98 | if(noun notin player) "You're not even holding ", (the) noun, "."; 99 | if(noun ~= Record) 100 | "That's not something you can play."; 101 | if(second ~= RecordPlayer) 102 | "You can't play it on that!"; 103 | "It sounds fantastic!"; 104 | ]; 105 | 106 | [Initialise; 107 | print "^^The AdjObject class allows you to define up to 32 adjectives and 108 | 32 nouns for an object, in any Z-code version. This can be used to add 109 | lots of synonyms as nouns, and/or to define some words as adjectives. 110 | Adjectives are words that can be used to refer to the object but only if 111 | they're followed by one or more nouns.^^ 112 | In this example, RECORD refers to the record, while RECORD PLAYER 113 | refers to the record player, and there is no ambiguity. You can also refer 114 | to the record player as BROWN PLAYER or BROWN RECORD PLAYER or just PLAYER.^^"; 115 | ]; 116 | -------------------------------------------------------------------------------- /tests/test-issue107.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Library; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_NO_DARKNESS; 32 | !Constant OPTIONAL_FULL_SCORE; 33 | !Constant OPTIONAL_FULL_DIRECTIONS; 34 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 35 | !Constant OPTIONAL_MANUAL_SCOPE; 36 | !Constant RUNTIME_ERRORS = 0; 37 | 38 | #Ifdef USEINFORM; 39 | Include "Parser"; 40 | Include "VerbLib"; 41 | #IfNot; 42 | Include "globals.h"; 43 | #EndIf; 44 | 45 | #Ifndef USEINFORM; 46 | [ DisallowTakeAnimate p_obj; 47 | if (p_obj == thechild) rfalse; 48 | ]; 49 | #Endif; 50 | 51 | #Ifndef USEINFORM; 52 | Include "puny.h"; 53 | #EndIf; 54 | 55 | ! Uncomment to add PunyLib extensions 56 | !Include "ext_menu.h"; 57 | !Include "ext_flags.h"; 58 | !Include "ext_quote_box.h"; 59 | !Include "ext_cheap_scenery.h"; 60 | 61 | 62 | #Ifdef USEINFORM; 63 | Include "Grammar"; 64 | #Endif; 65 | 66 | Object Library "The Library" 67 | with 68 | description "You are in a library.", 69 | has light; 70 | 71 | Object -> apple "apple" 72 | with name 'apple'; 73 | 74 | Object -> RedKey "red key" 75 | with name 'red' 'key'; 76 | 77 | Object -> BlueKey "blue key" 78 | with name 'blue' 'key'; 79 | 80 | Object -> MyDoor "door" 81 | with name 'door', 82 | with_key BlueKey, 83 | has openable lockable locked static; 84 | 85 | [ printnounsecond msg; 86 | print (string) msg, ": "; 87 | if(inp1 == 0) print "nothing"; else if(inp1 == 1) print ""; else print (the) noun; 88 | print "/", inp1, " "; 89 | if(inp2 == 0) print "nothing"; else if(inp2 == 1) print ""; else print (the) second; 90 | print "/", inp2, "^"; 91 | ]; 92 | 93 | Object -> george "George" 94 | with name 'george', 95 | before [; 96 | printnounsecond( "before"); 97 | Ask: print "ask^"; 98 | AskTo: print "before^"; 99 | ], 100 | Life [; 101 | printnounsecond( "life"); 102 | if (action_to_be == ##AskTo) print "Life^"; 103 | Answer: print "Life Answer^"; 104 | Ask: print "Life Ask^"; 105 | Look: print "Life Look^"; 106 | ], 107 | orders [; 108 | printnounsecond("orders"); 109 | if (action_to_be == ##Look) print "orders look^"; 110 | if (action_to_be == ##Ask) print "orders ask^"; 111 | if (action_to_be == ##AskTo) print "orders askto ", consult_from, " ", consult_words, "^"; 112 | ], 113 | has animate proper; 114 | 115 | Object -> thechild "child" 116 | with name 'child', 117 | has animate; 118 | 119 | [ Initialise; 120 | !no_implicit_actions = true; 121 | #IfDef USEINFORM; 122 | location=INITIAL_LOCATION_VALUE; 123 | #EndIf; 124 | ]; 125 | 126 | -------------------------------------------------------------------------------- /tests/test-issue63.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Park; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | !Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | !Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_FULL_SCORE; 32 | !Constant OPTIONAL_FULL_DIRECTIONS; 33 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 34 | !Constant OPTIONAL_MANUAL_SCOPE; 35 | !Constant RUNTIME_ERRORS = 0; 36 | 37 | #Ifdef USEINFORM; 38 | Include "Parser"; 39 | Include "VerbLib"; 40 | #IfNot; 41 | Include "globals.h"; 42 | #EndIf; 43 | 44 | #Ifndef USEINFORM; 45 | Include "puny.h"; 46 | #EndIf; 47 | 48 | ! Uncomment to add PunyLib extensions 49 | !Include "ext_menu.h"; 50 | !Include "ext_flags.h"; 51 | !Include "ext_quote_box.h"; 52 | !Include "ext_cheap_scenery.h"; 53 | 54 | 55 | #Ifdef USEINFORM; 56 | Include "Grammar"; 57 | #Endif; 58 | 59 | Object Park "Park" 60 | with description "You are in a park. There is a wooden bench and a stone bench here. You can go south.", 61 | s_to Room, 62 | has light; 63 | 64 | Object Room "Room" 65 | with description "You are in a room. There is a wooden bench here and a park to the north.", 66 | n_to Park, 67 | has light; 68 | 69 | Object red_coat "red coat" selfobj 70 | with 71 | name 'red' 'coat', 72 | description "a red coat", 73 | has clothing; 74 | 75 | Object blue_coat "blue coat" Park 76 | with 77 | name 'blue' 'coat', 78 | description "a blue coat", 79 | has clothing; 80 | 81 | Object wooden_bench "wooden bench" Park 82 | with 83 | name 'bench' 'wooden', 84 | description "a wooden bench", 85 | has scenery enterable; 86 | 87 | Object stone_bench "stone bench" Park 88 | with 89 | name 'bench' 'stone', 90 | description "a stone bench", 91 | has scenery enterable; 92 | 93 | Object wooden_bench2 "wooden bench" Room 94 | with 95 | name 'bench' 'wooden', 96 | description "a wooden bench", 97 | has scenery enterable; 98 | 99 | Object stone_bench2 "stone bench" Room 100 | with 101 | name 'bench' 'stone', 102 | description "a stone bench", 103 | has enterable; 104 | 105 | Object coffre_noir "coffre noir" Park 106 | with 107 | parse_name [; 108 | if (NextWord() ~= 'coffre') return 0; 109 | if (NextWord() == 'noir') return 2; 110 | return 1; 111 | ], 112 | description "C'est un coffre noir.", 113 | has container openable ~open; 114 | 115 | Object coffre_blanc "coffre blanc" Park 116 | with 117 | parse_name [; 118 | if (NextWord() ~= 'coffre') return 0; 119 | if (NextWord() == 'blanc') return 2; 120 | return 1; 121 | ], 122 | description "C'est un coffre blanc.", 123 | has container openable ~open; 124 | 125 | [ Initialise; 126 | #IfDef USEINFORM; 127 | location=INITIAL_LOCATION_VALUE; 128 | #EndIf; 129 | ]; 130 | 131 | -------------------------------------------------------------------------------- /tests/test6.inf: -------------------------------------------------------------------------------- 1 | ! Testing what is/SopeWithin and custom meta 2 | ! 3 | #Iftrue (#version_number == 8); 4 | Constant USEINFORM; 5 | #Endif; 6 | 7 | Constant Story "Parser test"; 8 | Constant Headline "^A parser test suite for PunyInform.^"; 9 | Serial "200827"; 10 | Constant INITIAL_LOCATION_VALUE = LitRoom; 11 | 12 | ! Uncomment to show time instead of score/turns 13 | !Statusline time; 14 | 15 | !Constant DEBUG; 16 | !Constant DEBUG_PARSEANDPERFORM; 17 | !Constant DEBUG_PARSEPATTERN; 18 | !Constant DEBUG_PARSETOKEN; 19 | !Constant DEBUG_PARSENOUNPHRASE; 20 | !Constant DEBUG_GETNEXTNOUN; 21 | !Constant DEBUG_SCOPE; 22 | 23 | ! Uncomment to add optional features to PunyLib 24 | !Constant DEBUG; 25 | !Constant CUSTOM_ABBREVIATIONS; 26 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 27 | Constant OPTIONAL_EXTENDED_METAVERBS; 28 | !Constant OPTIONAL_EXTENDED_VERBSET; 29 | !Constant OPTIONAL_FULL_SCORE; 30 | !Constant OPTIONAL_FULL_DIRECTIONS; 31 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 32 | !Constant OPTIONAL_MANUAL_SCOPE; 33 | !Constant RUNTIME_ERRORS = 0; 34 | 35 | #Ifdef USEINFORM; 36 | Include "Parser"; 37 | Include "VerbLib"; 38 | #IfNot; 39 | Include "globals.h"; 40 | #EndIf; 41 | 42 | #Ifndef USEINFORM; 43 | Include "puny.h"; 44 | #EndIf; 45 | 46 | ! Uncomment to add PunyLib extensions 47 | !Include "ext_menu.h"; 48 | !Include "ext_flags.h"; 49 | !Include "ext_quote_box.h"; 50 | !Include "ext_cheap_scenery.h"; 51 | 52 | 53 | Object questions "questions"; 54 | 55 | Object -> "long count" 56 | with name 'long' 'count', 57 | description "The Long Count is the great Mayan cycle of 58 | time, which began in 3114 BC and will finish with 59 | the world's end in 2012 AD."; 60 | Object -> "grue" 61 | with name 'grue', 62 | description "Don't tell me you don't know."; 63 | Object -> "samarkand" 64 | with name 'samarkand', 65 | description "Samarkand is a city in south-eastern Uzbekistan."; 66 | 67 | ! -- testing scope grammar token 68 | ! See: https://www.inform-fiction.org/manual/html/s32.html 69 | [ QueryTopic; 70 | switch (scope_stage) { 71 | 1: rfalse; 72 | 2: ScopeWithin(questions); rtrue; 73 | 3: "At the moment, even the simplest questions confuse you."; 74 | } 75 | ]; 76 | 77 | [ QuerySub; noun.description();]; 78 | 79 | Verb 'what' * 'is'/'was' scope=QueryTopic -> Query; 80 | 81 | #Ifdef USEINFORM; 82 | Include "Grammar"; 83 | #Endif; 84 | 85 | ! http://www.firthworks.com/roger/informfaq/vv.html 86 | ! (meta discussion at the end) 87 | ! 88 | ! but since restart is already orginally defined as meta 89 | ! we have to reinvert the logic here, and add a notMeta 90 | ! (to disable meta) instead. 91 | ![ isMeta; 92 | ! meta = true; 93 | ! return GPR_PREPOSITION; 94 | !]; 95 | 96 | [ notMeta; 97 | meta = false; 98 | return GPR_PREPOSITION; 99 | ]; 100 | 101 | Extend 'restart' replace 102 | * -> Restart 103 | * notMeta noun -> SwitchOn; 104 | 105 | 106 | Object LitRoom "Lit Room" 107 | with 108 | description [; 109 | print "You are in a brightly lit room.^"; 110 | ], 111 | has light; 112 | 113 | Object -> LightSwitch "LightSwitch" 114 | with 115 | short_name "light switch", 116 | description "It's a switch located on the wall.", 117 | name 'light' 'switch', 118 | has switchable static; 119 | 120 | [Initialise; 121 | print "^^The testsuite is open for business!^^"; 122 | print "If you drop the ball in the dark room it will still be in scope.^"; 123 | #IfDef USEINFORM; 124 | location=INITIAL_LOCATION_VALUE;; 125 | #EndIf; 126 | ]; 127 | 128 | 129 | -------------------------------------------------------------------------------- /tests/test-printcontents.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | 6 | Constant Story "Test PrintContents"; 7 | Constant Headline "^A sample game which uses PunyInform.^"; 8 | 9 | ! Uncomment ONE of the two following lines, to show either time or score/turns 10 | ! Leaving both commented out makes the library bigger. 11 | !Constant STATUSLINE_TIME; Statusline time; 12 | Constant STATUSLINE_SCORE; Statusline score; 13 | 14 | ! Comment out to keep track of score 15 | ! The value is what will be shown as the score on statusline in z3 16 | Constant NO_SCORE = 0; 17 | 18 | ! Customize the statusline in z5+ (will have no effect in z3) 19 | !Constant OPTIONAL_SL_NO_SCORE; 20 | !Constant OPTIONAL_SL_NO_MOVES; 21 | 22 | ! Uncomment to add optional features to PunyInform 23 | !Constant DEBUG; 24 | Constant OPTIONAL_NO_DARKNESS; 25 | Constant OPTIONAL_EXTENDED_METAVERBS; 26 | !Constant OPTIONAL_EXTENDED_VERBSET; 27 | Constant OPTIONAL_FLEXIBLE_INVENTORY; 28 | !Constant OPTIONAL_LANGUAGE_NUMBER; 29 | !Constant OPTIONAL_LIST_TOGETHER; 30 | !Constant OPTIONAL_PRINT_SCENERY_CONTENTS; 31 | Constant RUNTIME_ERRORS = 2; ! 0, 1 or 2. 0 = smallest file, 2 = most info 32 | 33 | ! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED, 34 | ! MAX_CARRIED, SACK_OBJECT, etc. 35 | 36 | Constant INITIAL_LOCATION_VALUE = Library; 37 | 38 | Include "globals.h"; 39 | 40 | ! Define your attributes, common properties and global variables here, if any 41 | 42 | ! Define the entry point routines you need here, like Amusing, DarkToDark etc. 43 | 44 | Include "puny.h"; 45 | 46 | Verb 'fillall' 47 | * -> FillAll; 48 | 49 | Verb 'emptyall' 50 | * -> EmptyAll; 51 | 52 | [FillAllSub x; 53 | objectloop(x provides buddy) 54 | move x.buddy to x; 55 | scope_modified = true; 56 | "You move stuff into stuff!"; 57 | ]; 58 | 59 | [EmptyAllSub x y; 60 | objectloop(x provides Buddy) { 61 | y = x.Buddy; 62 | if(y in x) move y to location; 63 | } 64 | scope_modified = true; 65 | "You move stuff out of stuff!"; 66 | ]; 67 | 68 | Object Library "The Library" 69 | with 70 | description "You are in a library."; 71 | 72 | Object -> Table "table" 73 | with 74 | name 'table', 75 | describe [; 76 | print "^A beautiful table stands in the middle of the room."; 77 | if(PrintContents(" On the table ", self, ISARE_BIT)) "."; 78 | new_line; 79 | rtrue; 80 | ], 81 | has static supporter; 82 | 83 | Object -> Chest "chest" 84 | with 85 | name 'chest', 86 | buddy Book, 87 | has container open openable; 88 | 89 | Object -> Book "book" 90 | with 91 | name 'book'; 92 | 93 | Object -> GlassJar "glass jar" 94 | with 95 | name 'glass' 'jar', 96 | buddy Peach, 97 | has container open openable transparent; 98 | 99 | Object -> Peach "peach" 100 | with 101 | name 'peach'; 102 | 103 | Object -> Bucket "bucket" 104 | with 105 | name 'bucket', 106 | buddy Garbage, 107 | has container open; 108 | 109 | Object -> Garbage "garbage" 110 | with 111 | name 'garbage' 112 | has pluralname; 113 | 114 | Object -> GlassBowl "glass bowl" 115 | with 116 | name 'glass' 'bowl', 117 | buddy Onion, 118 | has container open transparent; 119 | 120 | Object -> Onion "onion" 121 | with 122 | name 'onion', 123 | article "an"; 124 | 125 | [Initialise; 126 | print "^^Let's test PrintContents!^^ 127 | Each container has a buddy object. You can use the command FILLALL 128 | to move all buddy objects into their respective containers, and 129 | EMPTYALL to move them out of the containers and onto the floor.^^"; 130 | ]; 131 | -------------------------------------------------------------------------------- /tests/test-type.inf: -------------------------------------------------------------------------------- 1 | !% -~S 2 | !% $OMIT_UNUSED_ROUTINES=1 3 | !% $ZCODE_LESS_DICT_DATA=1 4 | 5 | ! The very first lines of the main source code file for a game can 6 | ! contain compiler options, like the lines above. -~S disables 7 | ! strict error checking. This is otherwise used in z5 and z8 games by 8 | ! default. While useful for debugging, it adds ~10 KB to the story file 9 | ! size and it makes the game slower. 10 | ! $OMIT_UNUSED_ROUTINES=1 makes the compiler remove all routines which 11 | ! aren't used. This can save some space. 12 | ! $ZCODE_LESS_DICT_DATA=1 removes an empty data byte for every dictionary word. 13 | 14 | Constant Story "Minimal"; 15 | Constant Headline "^A sample game which uses PunyInform.^"; 16 | 17 | ! Uncomment ONE of the two following lines, to show either time or score/turns 18 | ! Leaving both commented out makes the library bigger. 19 | !Constant STATUSLINE_TIME; Statusline time; 20 | Constant STATUSLINE_SCORE; Statusline score; 21 | 22 | ! Comment out to keep track of score 23 | ! The value is what will be shown as the score on statusline in z3 24 | Constant NO_SCORE = 0; 25 | 26 | ! Customize the statusline in z5+ (will have no effect in z3) 27 | !Constant OPTIONAL_SL_NO_SCORE; 28 | !Constant OPTIONAL_SL_NO_MOVES; 29 | 30 | ! Uncomment to add optional features to PunyInform 31 | !Constant DEBUG; 32 | !Constant CUSTOM_ABBREVIATIONS; 33 | !Constant CUSTOM_PLAYER_OBJECT = myPlayerObj; 34 | Constant OPTIONAL_NO_DARKNESS; 35 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 36 | Constant OPTIONAL_EXTENDED_METAVERBS; 37 | Constant OPTIONAL_EXTENDED_VERBSET; 38 | !Constant OPTIONAL_FLEXIBLE_INVENTORY; 39 | !Constant OPTIONAL_PRINT_SCENERY_CONTENTS; 40 | !Constant OPTIONAL_SCORED; 41 | !Constant OPTIONAL_FULL_SCORE; ! Comment out NO_SCORE when uncommenting this 42 | !Constant OPTIONAL_FULL_DIRECTIONS; 43 | !Constant OPTIONAL_SIMPLE_DOORS; 44 | !Constant OPTIONAL_SHIP_DIRECTIONS; 45 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 46 | !Constant OPTIONAL_MANUAL_SCOPE; 47 | !Constant OPTIONAL_MANUAL_REACTIVE; 48 | !Constant OPTIONAL_ORDERED_TIMERS; 49 | !Constant OPTIONAL_PROVIDE_UNDO; 50 | !Constant OPTIONAL_REACTIVE_PARSE_NAME; 51 | !Constant RUNTIME_ERRORS = 0; ! 0, 1 or 2. 0 = smallest file, 2 = most info 52 | 53 | ! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED, 54 | ! MAX_CARRIED, SACK_OBJECT, etc. 55 | 56 | Constant INITIAL_LOCATION_VALUE = Library; 57 | 58 | Include "globals.h"; 59 | 60 | ! Define your attributes, common properties and global variables here, if any 61 | 62 | ! Define the entry point routines you need here, like Amusing, DarkToDark etc. 63 | 64 | ! Uncomment to add PunyLib extensions 65 | !Include "ext_menu.h"; 66 | !Include "ext_flags.h"; 67 | !Include "ext_talk_menu.h"; ! Note: Also include ext_flags.h to allow use of flags 68 | !Include "ext_quote_box.h"; 69 | !Include "ext_cheap_scenery.h"; 70 | 71 | Include "puny.h"; 72 | 73 | ! Uncomment to add PunyLib extensions 74 | !Include "ext_waittime.h"; 75 | 76 | Object Library "The Library" 77 | with 78 | description "You are in a library."; 79 | 80 | Object -> Box "box" 81 | with 82 | name 'box', 83 | inside_description "It feels so nice, standing in the box.", 84 | has container open openable enterable; 85 | 86 | [Initialise; 87 | print "^^And so the story begins...^^"; 88 | ]; 89 | 90 | [ Type1Sub; 91 | ]; 92 | 93 | [ Type2Sub; 94 | ]; 95 | 96 | [ Type3Sub; 97 | ]; 98 | 99 | Verb 'type1' * special 'into'/'in' noun -> Type1; 100 | Verb 'type2' * topic 'into'/'in' noun -> Type2; 101 | Verb 'type3' * noun 'into'/'in' special -> Type3; 102 | 103 | -------------------------------------------------------------------------------- /tests/test1.txt: -------------------------------------------------------------------------------- 1 | 2 | > i.i 3 | You are empty handed. 4 | 5 | You are empty handed. 6 | 7 | > take red 8 | Do you mean the small red ball or the red cube? 9 | 10 | > i 11 | You are empty handed. 12 | 13 | > take red 14 | Do you mean the small red ball or the red cube? 15 | 16 | > red 17 | I still don't understand what you are referring to. 18 | 19 | > take red 20 | Do you mean the small red ball or the red cube? 21 | 22 | > ball 23 | Taken. 24 | 25 | > drop all 26 | small red ball: Dropped. 27 | 28 | > take all red 29 | small red ball: Taken. 30 | red cube: Taken. 31 | 32 | > take blue ball 33 | Taken. 34 | 35 | > take blue cube 36 | I only understood you as far as "take blue" but then you lost me. 37 | 38 | > take blue ball and blue cube 39 | I only understood you as far as "take blue ball and blue" but then you lost me. 40 | 41 | > drop all 42 | small blue ball: Dropped. 43 | red cube: Dropped. 44 | small red ball: Dropped. 45 | 46 | > get ball 47 | Do you mean the small blue ball, the small red ball or the small green ball? 48 | 49 | > red 50 | Taken. 51 | 52 | > get all balls 53 | small blue ball: Taken. 54 | small green ball: Taken. 55 | 56 | > get cubes 57 | red cube: Taken. 58 | black cube: Taken. 59 | 60 | > drop black cube 61 | Dropped. 62 | 63 | > drop cubes 64 | Dropped. 65 | 66 | > drop cubes 67 | There are no things available that match "drop cubes". 68 | 69 | > get black ball 70 | Taken. 71 | 72 | > s 73 | White Room 74 | It's all white. The ball room lies to the north. 75 | 76 | You can see a red box (which is open but empty) and a transparent box (which is 77 | open but empty) here. 78 | 79 | > put all balls but the red one in the red box 80 | small black ball: You put the small black ball into the red box. 81 | small green ball: You put the small green ball into the red box. 82 | small blue ball: You put the small blue ball into the red box. 83 | 84 | > put all in transparent 85 | small red ball: You put the small red ball into the transparent box. 86 | 87 | > get all balls from transparent 88 | small red ball: Removed. 89 | 90 | > get all from transparent 91 | There are no things available that match "get all from transparent". 92 | 93 | > drop red ball 94 | Dropped. 95 | 96 | > get it 97 | Taken. 98 | 99 | > get all from red box 100 | small blue ball: Removed. 101 | small green ball: Removed. 102 | small black ball: Removed. 103 | 104 | > drop all 105 | small black ball: Dropped. 106 | small green ball: Dropped. 107 | small blue ball: Dropped. 108 | small red ball: Dropped. 109 | 110 | > get all boxes 111 | red box: Taken. 112 | transparent box: Taken. 113 | 114 | > n 115 | Ball Room 116 | 117 | There is a blue table in the middle of the room. 118 | 119 | You can also see a red cube and a black cube here. 120 | 121 | > put all on the table 122 | transparent box: You put the transparent box on the table. 123 | red box: You put the red box on the table. 124 | 125 | > put transparent box in red box 126 | (first taking the transparent box) 127 | You put the transparent box into the red box. 128 | 129 | > enter transparent box 130 | You have to enter the red box first. 131 | 132 | > enter red box 133 | You have to enter the table first. 134 | 135 | > enter table 136 | You enter the table. 137 | 138 | > enter transparent box 139 | You have to enter the red box first. 140 | 141 | > enter red box 142 | You enter the red box. 143 | 144 | > enter transparent box 145 | You enter the transparent box. 146 | 147 | > enter table 148 | You have to leave the transparent box first. 149 | 150 | > exit 151 | You leave the transparent box. 152 | 153 | > exit 154 | You leave the red box. 155 | 156 | > exit 157 | You leave the table. 158 | 159 | > quit 160 | Are you sure you want to quit? yes 161 | 162 | -------------------------------------------------------------------------------- /tests/test-grammarproperty.inf: -------------------------------------------------------------------------------- 1 | ! this code looks messy but it tests all return values from the 2 | ! grammar property. -1, 0, 'verb' and -'verb'. See test-grammarproperty.cmd 3 | ! for example inputs. 4 | 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Library; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | !Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_GRAMMAR_PROPERTY; 32 | !Constant OPTIONAL_NO_DARKNESS; 33 | !Constant OPTIONAL_FULL_SCORE; 34 | !Constant OPTIONAL_FULL_DIRECTIONS; 35 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 36 | !Constant OPTIONAL_MANUAL_SCOPE; 37 | !Constant RUNTIME_ERRORS = 0; 38 | 39 | #Ifdef USEINFORM; 40 | Include "Parser"; 41 | Include "VerbLib"; 42 | #IfNot; 43 | Include "globals.h"; 44 | #EndIf; 45 | 46 | #Ifndef USEINFORM; 47 | Include "puny.h"; 48 | #EndIf; 49 | 50 | ! Uncomment to add PunyLib extensions 51 | !Include "ext_menu.h"; 52 | !Include "ext_flags.h"; 53 | !Include "ext_quote_box.h"; 54 | !Include "ext_cheap_scenery.h"; 55 | 56 | 57 | #Ifdef USEINFORM; 58 | Include "Grammar"; 59 | #Endif; 60 | 61 | [ TakeAimSub; 62 | ! Only BattleBot can be ordered to take aim, and this is handled in its 63 | ! orders property, so this routine should never be executed. 64 | "No."; 65 | ]; 66 | 67 | Verb 'bot,' * 'take' 'aim' -> TakeAim; 68 | 69 | Object Library "The Library" 70 | with 71 | description "You are in a library.", 72 | has light; 73 | 74 | Object -> John "John" 75 | with name 'john', 76 | life [; 77 | Answer: print "answer words ", consult_words, " from ", consult_from, "^"; 78 | Ask: print "ask^"; 79 | Order: 80 | print "order "; 81 | switch(action) { 82 | ##Inv: print "##Inv"; 83 | ##Take: print "##Take"; 84 | default: print action; 85 | }; 86 | print "^"; 87 | ], 88 | before [; 89 | Consult: print "consult^"; 90 | ], 91 | orders [; 92 | Open: "Why do you want me to open ", (the) noun, "."; 93 | Close: "Why do you want me to close ", (the) noun, "."; 94 | Eat: "I eat"; 95 | Jump: "I jump"; 96 | Unlock: "I unlock ", (the) noun, "."; 97 | SwitchOff: "I switch off ", (the) noun, "."; 98 | Inv: "I have nothing"; 99 | TakeAim: "~Okay, I'm aiming.~"; 100 | ], 101 | grammar [; 102 | print "grammar ", verb_wordnum, " ", verb_word == 'jump', "^"; 103 | if(verb_word == 'drink') { 104 | return 'eat'; 105 | } 106 | if(verb_word == 'open') { 107 | return 'close'; 108 | } 109 | if(verb_word == 'close') { 110 | parser_one = true; 111 | return -'eat'; 112 | } 113 | if(verb_word == 'jump') { 114 | action = ##Inv; 115 | rtrue; 116 | } 117 | if(verb_word == 'take') { 118 | parser_one = true; 119 | return -'bot,'; 120 | } 121 | rfalse; 122 | ], 123 | has animate proper; 124 | 125 | Object -> apple "apple" 126 | with name 'apple', 127 | has edible; 128 | 129 | [ Initialise; 130 | #IfDef USEINFORM; 131 | location=INITIAL_LOCATION_VALUE; 132 | #EndIf; 133 | ]; 134 | 135 | -------------------------------------------------------------------------------- /tests/test-actors.inf: -------------------------------------------------------------------------------- 1 | ! Testing that held and creature tokens parse all/all-but correctly 2 | ! Testing issue 60 (sentence splitting) 3 | ! 4 | ! 5 | #Iftrue (#version_number == 8); 6 | Constant USEINFORM; 7 | #Endif; 8 | 9 | Constant Story "Parser test"; 10 | Constant Headline "^A parser test suite for PunyInform.^"; 11 | Serial "200827"; 12 | Constant INITIAL_LOCATION_VALUE = Library; 13 | 14 | ! Uncomment to show time instead of score/turns 15 | !Statusline time; 16 | 17 | Constant DEBUG; 18 | !Constant DEBUG_PARSEANDPERFORM; 19 | !Constant DEBUG_PARSEPATTERN; 20 | !Constant DEBUG_PARSETOKEN; 21 | !Constant DEBUG_PARSENOUNPHRASE; 22 | !Constant DEBUG_GETNEXTNOUN; 23 | !Constant DEBUG_SCOPE; 24 | 25 | ! Uncomment to add optional features to PunyLib 26 | !Constant DEBUG; 27 | !Constant CUSTOM_ABBREVIATIONS; 28 | !Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS; 29 | Constant OPTIONAL_EXTENDED_METAVERBS; 30 | Constant OPTIONAL_EXTENDED_VERBSET; 31 | !Constant OPTIONAL_NO_DARKNESS; 32 | !Constant OPTIONAL_FULL_SCORE; 33 | !Constant OPTIONAL_FULL_DIRECTIONS; 34 | !Constant OPTIONAL_GUESS_MISSING_NOUN; 35 | !Constant OPTIONAL_MANUAL_SCOPE; 36 | !Constant RUNTIME_ERRORS = 0; 37 | 38 | #Ifdef USEINFORM; 39 | Include "Parser"; 40 | Include "VerbLib"; 41 | #IfNot; 42 | Include "globals.h"; 43 | #EndIf; 44 | 45 | #Ifndef USEINFORM; 46 | [ DisallowTakeAnimate p_obj; 47 | if (p_obj == thechild) rfalse; 48 | ]; 49 | #Endif; 50 | 51 | #Ifndef USEINFORM; 52 | Include "puny.h"; 53 | #EndIf; 54 | 55 | ! Uncomment to add PunyLib extensions 56 | !Include "ext_menu.h"; 57 | !Include "ext_flags.h"; 58 | !Include "ext_quote_box.h"; 59 | !Include "ext_cheap_scenery.h"; 60 | 61 | 62 | #Ifdef USEINFORM; 63 | Include "Grammar"; 64 | #Endif; 65 | 66 | Object Library "The Library" 67 | with 68 | description "You are in a library.", 69 | has light; 70 | 71 | Object -> apple "apple" 72 | with name 'apple'; 73 | 74 | Object -> RedKey "red key" 75 | with name 'red' 'key'; 76 | 77 | Object -> BlueKey "blue key" 78 | with name 'blue' 'key'; 79 | 80 | Object -> MyDoor "door" 81 | with name 'door', 82 | with_key BlueKey, 83 | has openable lockable locked static; 84 | 85 | [ printnounsecond msg; 86 | print (string) msg, ": "; 87 | if(inp1 == 0) print "nothing"; else if(inp1 == 1) print ""; else print (the) noun; 88 | print "/", inp1, " "; 89 | if(inp2 == 0) print "nothing"; else if(inp2 == 1) print ""; else print (the) second; 90 | print "/", inp2, "^"; 91 | ]; 92 | 93 | Object -> george "George" 94 | with name 'george', 95 | before [; 96 | printnounsecond( "before"); 97 | Ask: print "ask^"; 98 | AskTo: print "before^"; 99 | ], 100 | Life [; 101 | printnounsecond( "George life"); 102 | if (action_to_be == ##AskTo) print "Life^"; 103 | Answer: print "Life Answer^"; 104 | Ask: print "Life Ask^"; 105 | Look: print "Life Look^"; 106 | ], 107 | orders [; 108 | printnounsecond("George orders"); 109 | if (action_to_be == ##Look) print "orders look^"; 110 | if (action_to_be == ##Ask) print "orders ask^"; 111 | if (action_to_be == ##AskTo) print "orders askto ", consult_from, " ", consult_words, "^"; 112 | ], 113 | has animate proper; 114 | 115 | Object -> thechild "child" 116 | with name 'child', 117 | Life [; 118 | printnounsecond( "life"); 119 | if (action_to_be == ##AskTo) print "Child life^"; 120 | ], 121 | orders [; 122 | printnounsecond("Child orders"); 123 | ], 124 | has animate; 125 | 126 | [ Initialise; 127 | !no_implicit_actions = true; 128 | #IfDef USEINFORM; 129 | location=INITIAL_LOCATION_VALUE; 130 | #EndIf; 131 | ]; 132 | 133 | --------------------------------------------------------------------------------