-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtestbench.inf
1420 lines (1265 loc) · 33.8 KB
/
testbench.inf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!% -~S
!% -e
!% $OMIT_UNUSED_ROUTINES=1
!% $ZCODE_LESS_DICT_DATA=1
! Testbench - a platform for trying things out in PunyInform
! compile as z8 to use Inform stdlib instead of puny (for debugging)
#Iftrue (#version_number == 8);
Constant USEINFORM;
#Endif;
! Uncomment ONE of the two following lines, to show either time or score/turns
! Leaving both commented out makes the library bigger.
Statusline time;
!Constant STATUSLINE_SCORE; Statusline score;
!Constant RUNTIME_ERRORS = 0; ! 0 = Minimal error checking, 1 = Numeric error codes, 2: Error messages
#IfnDef USEINFORM;
! Uncomment to add optional features to PunyInform
!Constant OPTIONAL_NO_DARKNESS;
Constant STATUSLINE_TIME;
Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS;
Constant OPTIONAL_FLEXIBLE_INVENTORY;
Constant OPTIONAL_EXTENDED_METAVERBS;
Constant OPTIONAL_EXTENDED_VERBSET;
!Constant OPTIONAL_NON_FLASHING_STATUSLINE;
!Constant OPTIONAL_LANGUAGE_NUMBER;
!Constant OPTIONAL_LIST_TOGETHER;
Constant OPTIONAL_PRINT_SCENERY_CONTENTS;
Constant OPTIONAL_SCORED;
Constant OPTIONAL_FULL_SCORE;
Constant OPTIONAL_GUESS_MISSING_NOUN;
Constant OPTIONAL_FULL_DIRECTIONS;
Constant OPTIONAL_SIMPLE_DOORS;
Constant OPTIONAL_SHIP_DIRECTIONS;
Constant OPTIONAL_MANUAL_SCOPE;
Constant OPTIONAL_MANUAL_SCOPE_BOOST;
Constant OPTIONAL_MANUAL_REACTIVE;
Constant OPTIONAL_REACTIVE_PARSE_NAME;
Constant OPTIONAL_ORDERED_TIMERS;
Constant MAX_SCOPE = 50;
Constant M_NO_LOOK;
#Iftrue (#version_number == 5);
Constant OPTIONAL_PROVIDE_UNDO;
#Endif;
Constant INITIAL_LOCATION_VALUE = Library;
!Constant DEBUG; ! Provides debug verbs for both Inform and PunyInform
!Constant DEBUG_PARSEANDPERFORM;
!Constant DEBUG_PARSEPATTERN;
!Constant DEBUG_PARSETOKEN;
!Constant DEBUG_PARSENOUNPHRASE;
!Constant DEBUG_GETNEXTNOUN;
!Constant DEBUG_SCOPE;
!Constant DEBUG_MANUAL_SCOPE_BOOST;
!Constant DEBUG_TIMER; ! requires special Ozmoo
#EndIf;
!Constant TEST_BEFOREAFTER;
Constant Story "Testbench";
Constant Headline "^A sandbox for PunyInform development^";
#IfDef DEBUG_TIMER;
Serial "999999"; ! Serial "999999" enables timing in Ozmoo, meaning that the RTC (jiffies since start) can be read from $1c-->0
#EndIf;
Constant DEATH_MENTION_UNDO;
!Constant MAX_CARRIED 3;
Constant SACK_OBJECT infiniteBag;
Constant AMUSING_PROVIDED;
#IfDef OPTIONAL_FULL_SCORE;
Constant MAX_SCORE = 7;
Constant OBJECT_SCORE = 1;
Array task_scores -> 3 0; ! inform doens't like array of length 1
Constant TASKS_PROVIDED;
Constant NUMBER_TASKS = 1;
#IfNot;
Constant MAX_SCORE = 3;
#EndIf;
[ Amusing;
"^Did you try?^^1. Pushing John many times.^2. Going outside and looking at the sun";
];
! Setup cheap scenery
[SceneryReply w1 w2 id_or_routine;
Push:
if(w1=='bird' && w2=='birds') "The birds fly away as you try.";
"Now how would you do that?";
default:
id_or_routine = 0; ! Avoid compiler warning for unused var
rfalse;
];
! Setup flags
Constant FLAG_COUNT 8;
!Constant F_SQUIRREL_ESCAPED 0;
!Constant F_PARROT_FED 1;
!Constant F_BOUGHT_TICKETS 2;
#IfDef TEST_BEFOREAFTER;
[LookRoutine;
"***** LookRoutine, yay!";
];
#EndIf;
#Ifdef USEINFORM;
Include "Parser";
Attribute reactive;
Include "VerbLib";
Include "ext_cheap_scenery.h";
Include "ext_flags.h";
[OnOff obj; ! TODO: is there something like this in I6? change name if needed
if(obj has on) print "on";
else print "off";
return;
];
#IfNot;
Include "globals.h";
#EndIf;
[ChooseObjects obj code;
if(code == 2) {
if(action_to_be == ##SwitchOn or ##SwitchOff) {
if(obj has switchable)
return 2;
}
return 0;
}
! print " ALL:", (name) obj;
rfalse; ! Don't interfere with ALL
];
Global have_revived = 0;
[ AfterLife;
if(have_revived) return;
have_revived = true;
print "^^You really shouldn't have died. Try again!^^";
PlayerTo(Library);
deadflag = 0; ! Same as GS_PLAYING, but works in standard library as well
];
[InScope p_actor;
if(p_actor == player && location == thedark && John in real_location)
PlaceInScope(John);
rfalse;
];
[ParseNoun obj w;
if(obj == LargeBox) {
w = NextWord();
if(w == 'crate') { wn = wn + 7; return 1; } ! Change wn just to check that nothing breaks
if(w == 'huge') return -1;
wn--;
}
if(obj == PinkBook) {
w = NextWord();
if(w == 'tiny') return -1;
wn--;
}
return -1;
];
[ DarkToDark;
deadflag = 1;
"You are eaten by a grue.";
];
[ PrintRank;
print ", earning you the rank of ";
if (score >= 3) "Treasure hunter.";
if (score >= 2) "Explorer.";
"Tourist.";
];
[ PrintTaskName task_number;
switch (task_number) {
0: "opening the box";
}
];
#Ifndef USEINFORM;
Include "ext_cheap_scenery.h";
Include "ext_flags.h";
!Include "ext_talk_menu.h";
Constant EXT_MENU_STDLIB_MODE;
Include "ext_menu.h";
! Setup custom library messages
Constant MSG_OPEN_YOU_CANT 1000;
Constant MSG_AREYOUSUREQUIT 1001;
Constant MSG_DISROBE_NOT_WEARING 1002;
Constant MSG_LOOK_BEFORE_ROOMNAME 1003;
[LibraryMessages p_msg p_arg_1 p_arg_2;
switch(p_msg) {
MSG_OPEN_YOU_CANT:
"How would you go about opening ", (a) noun, "?";
MSG_AREYOUSUREQUIT:
print "You ain't no quitter eh? ";
rtrue;
MSG_DISROBE_NOT_WEARING:
"Not worn!";
MSG_LOOK_BEFORE_ROOMNAME:
if(turns >= 0) new_line;
}
p_arg_1 = 0; p_arg_2 = 0; ! To avoid warnings
];
[DisallowTakeAnimate;
if(noun == Lizard) rfalse;
];
Include "puny.h";
Include "ext_waittime.h";
#Endif;
[ HelpItems;
print "There is information provided on the following:^^";
print " Instructions^";
print " About this game^";
print " Game credits^";
];
[ HelpMenu;
! Note that we set item_width to half the length of each name, since we have
! defined EXT_MENU_STDLIB_MODE to make ext_menu fully compatible with the
! standard library DoMenu implementation.
switch(menu_item) {
0: item_width=10; item_name="Help and Information"; return 3;
1: item_width=6; item_name="Instructions";
2: item_width=7; item_name="About this game";
3: item_width=6; item_name="Game credits";
}
];
[ HelpInfo;
switch(menu_item) {
1: "You play this game like any old Infocom game.^^Common commands lnclude examine, open, close, save, restore and quit.";
2: "This is a test game";
3: "This was was created by us";
}
];
[ HelpSub;
DoMenu(HelpItems, HelpMenu, HelpInfo);
];
Verb 'help' * -> Help;
[ MumbleSub a;
a=TryNumber(consult_from);
print "The number is ",a,"^";
"No no, speak up!";
];
[ MumbleAtSub a;
a=TryNumber(consult_from);
print "The number is ",a,"^";
"You mumble ", consult_words, " words to ", (the) second,".";
];
Verb 'mumble'
* topic 'at' creature -> MumbleAt
* topic -> Mumble;
Verb 'talk'
* 'to'/'with' creature -> Talk;
[TalkSub;
if (noun == player) "The conversation is hardly inspiring.";
if (RunLife(noun,##Talk) ~= false) return;
"You have nothing to say.";
];
[ScanScope;
switch(scope_stage) {
1: rfalse;
2: ScopeWithin(RiverBank); rtrue;
3: "You're crazy!";
}
];
[BangParse;
#Ifdef USEINFORM;
return ParseToken(ELEMENTARY_TT, NUMBER_TOKEN);
#Ifnot;
return ParseToken(TT_OBJECT, NUMBER_OBJECT);
#Endif;
];
Verb 'bang'
* BangParse -> Bang;
[BangSub;
"Noun is ", parsed_number, ".";
];
[WowScope;
switch(scope_stage) {
1: rfalse;
2: ScopeWithin(CarPark); rtrue;
3: "You can't wow that, you crazy person!";
}
];
[WowParse x;
#Ifdef USEINFORM;
x = ParseToken(SCOPE_TT, WowScope);
#Ifnot;
x = ParseToken(TT_SCOPE, WowScope);
#Endif;
print "ParseToken returned ", x, "^";
return x;
];
Verb 'wow'
* WowParse -> Wow;
[WowSub;
print (The) noun, " is in scope!^";
! LoopOverScope(WowLoop);
];
Verb 'scan'
* scope=ScanScope -> Scan
* 'local' noun -> Scan;
[ScanSub;
if(AfterRoutines()) rtrue;
print "Scanning ", (the) noun, "... Clear!^";
];
Verb 'telly'
* number 'to' topic -> Telly;
[ TellySub;
"You telly ", noun, " to ", (address) second, ".";
];
Constant SCN_WATER = "The water is so beautiful this time of year, all clear and glittering.";
[SCN_SUN;
Examine:
deadflag = 1;
"As you stare right into the sun, you feel a burning sensation in your eyes.
After a while, all goes black. With no eyesight, you have little hope of
completing your investigations.";
default:
! Since this is a named routine, it will return true by default. Thus we
! have to return false for all actions we don't care about
rfalse;
];
Class Book
with
name 'books//p',
description [;
print "Self is ", self, "^";
if(self provides hello) {
print (The) self, " has a Hello value of ", self.hello, ". ^";
}
rfalse;
],
hello 0,
party [a;
print "Self is ", self, "^";
print "a is ", a, "^";
! print "b is ", b, "^";
! print "c is ", c, "^";
],
before [;
Open:
"You've never been much of a reader.";
],
has openable;
Object dummy "dummy"
with
! react_before [; Examine: "No you can't!"; ] [; Open: "Hell no!"; ],
name 'dummy',
! found_in [; rtrue; ]
found_in Sweater,
has reactive;
Class Outside
has light;
Outside CarPark "Car Park"
with
!short_name [; print "In front of the library!"; rtrue; ],
initial "Wow, this is a huge car park!",
description [;
"You are in a car park in front of the library.
You can enter to the north. There is a river off to the east.
Alpha Repair can be seen to the south.
A table stands inexplicably in the middle of the car park.
A weird smell permeats the air.";],
n_to Library,
sw_to [; "There's an angry dragon blocking the path!"; ],
e_to RiverBank,
s_to AlphaRepair,
each_turn [;
print (string) random(
"^An owl is howling nearby.",
"^A terrible scream is heard from the library.",
"^The sound of many birds comes from the east.");
"";
],
scenery_outdoors
CS_NO_ADJ 'air' "The air is fresh here!"
'soil' 'dirt' "The ground is damp after last night's rain.",
cheap_scenery
CS_NO_ADJ 'library' [;
Examine: "It's a very nice library.";
Burn: "Oh, better not!";
]
CS_PARSE_NAME [ i;
while(NextWord() == 'fabulous' or 'huge' or 'car' or 'park') i++; return i;]
"A fabulous, huge car park!"
'weird' 'smell' "A bit like a skunk really."
'soil' 'dirt' "The ground is surprisingly dry here!"
CS_ADD_LIST CarPark (scenery_outdoors),
#IfDef TEST_BEFOREAFTER;
after [; print "*** CarPark.after^"; ],
before [; print "*** CarPark.before^"; ],
#EndIf;
cant_go "Without a car the only viable exit is to the north.",
#IfDef OPTIONAL_FULL_SCORE;
has scored light reactive;
#IfNot;
has light reactive;
#EndIf;
Object -> Blue "blue table"
with
name 'blue' 'table',
has supporter scenery;
Object -> Table "table"
with
name 'table',
has supporter scenery;
Object -> -> "obvious plate"
with
name 'obvious' 'plate',
article "an";
Object -> -> "concealed plate"
with
name 'concealed' 'plate'
has concealed;
Object -> Key "key"
with
description "It's a metal key, with a keyring attached to it.",
name 'key' 'metal',
#IfDef TEST_BEFOREAFTER;
after [; print "*** Key.after^"; ],
before [; print "*** Key.before^"; ],
#EndIf;
has transparent
#IfDef OPTIONAL_FULL_SCORE;
scored
#EndIf;
;
Object -> -> Keyring "keyring"
with
name 'keyring',
description "It's just a plain metal ring really.";
Object -> LeadWeight "lead weight"
with
name 'weight' 'lead',
before [;
Drop:
remove self;
move pencil to parent(player);
PronounNotice(pencil);
#IfDef OPTIONAL_MANUAL_SCOPE;
scope_modified = true;
#EndIf;
"When the lead weight hits the ground it sounds different.";
]
;
Object Pencil "pencil"
with name 'pencil';
Object car "little red car" CarPark
with name 'little' 'red' 'car',
description "Large enough to sit inside. Among the controls is a
prominent on/off switch. The numberplate is KAR 1.",
describe [;
@new_line;
if(self has on) {
"The red car sits here, its engine still running.";
} else {
"A little red car is parked here.";
}
],
!when_on "The red car sits here, its engine still running.",
!when_off "A little red car is parked here.",
before [;
Go: if (car has on) "Brmm! Brmm!";
print "(The ignition is off at the moment.)^";
],
has switchable enterable static container open;
Object RiverBank "River Bank"
with
description "The river is quite wide here. The sun reflects in the blue water, the birds are
flying high up above.",
d_to SecretHatch,
w_to CarPark,
nw_to Library,
cheap_scenery
'blue' 'water' SCN_WATER
'bird' 'birds' "They seem so carefree."
CS_NO_ADJ 'sun' SCN_SUN
CS_ADD_LIST CarPark (scenery_outdoors),
has light;
Object -> ExoSkeleton "exoskeleton"
with
description "A powered exoskeleton, designed to give its user superhuman
strength. You can enter the exoskeleton.",
name 'exo' 'exoskeleton' 'skeleton',
article "an",
has enterable transparent;
Object -> Microphone "microphone"
with
name 'microphone',
orders [;
"~Don't you boss me around!~ says the microphone.";
],
before [;
Ask:
print "Before: Microphone - Ask^";
AskFor:
print "Before: Microphone - AskFor^";
Answer:
print "Before: Microphone - Answer^";
Tell:
print "Before: Microphone - Tell^";
],
life [;
Ask:
"Life: Microphone - Ask";
AskFor:
"Life: Microphone - AskFor";
Answer:
"Life: Microphone - Answer";
Tell:
"Life: Microphone - Tell";
],
has talkable;
Object -> SecretHatch "secret hatch"
with
name 'secret' 'hatch',
description "It's very secret.",
after [;
give self ~concealed;
],
door_to Library,
door_dir (d_to),
has static concealed door openable;
Object -> Lizard "cute little lizard"
with
name 'cute' 'little' 'lizard',
description "It looks at you with big eyes.",
after [;
Take:
"It dives into your breast pocket, spins around
and peaks out, ready for adventure!";
Drop:
deadflag = 1;
"He jumps up and bites your hand. You die.";
],
has animate neuter;
Object -> paper "paper"
with
name 'paper',
describe "^There is a paper here.";
Object -> paperclip "paperclip"
with
name 'paperclip' 'clip',
describe "^There is a paperclip here.";
Object AlphaRepair "Alpha Repair"
with
description "You're in alpha repair. The car park lies to the north,
while beta repair lies to the south. The alpha repair panel and
the conveyor belt are the most obvious features here.",
n_to CarPark,
s_to BetaRepair,
repair_name 'alpha',
cheap_scenery
CS_PARSE_NAME
[ i;
while(NextWord()==self.repair_name or 'repair' or 'panel')
i++;
return i;
]
[; Examine: "The ", (address) self.repair_name, " repair panel looks ok."; ]
'conveyor' 'belt' "It doesn't look broken.",
has light;
Object BetaRepair "Beta Repair"
with
description "You're in beta repair. Alpha repair lies to the north.
The beta repair panel and the conveyor
belt are the most obvious features here.",
n_to AlphaRepair,
repair_name 'beta',
cheap_scenery CS_ADD_LIST AlphaRepair (cheap_scenery),
has light;
Object Toilet "The toilet"
with
short_name [; print "A toilet"; rtrue; ],
description[;
print "This toilet is in dire need of cleaning. The toilet door
leads west back into the library, and there's a dark doorway
to the east. ";
if(Faucet has on) {
"Water is streaming from the faucet into the sink. ";
}
"";
],
#IfDef USEINFORM;
w_to Library,
#IfNot;
w_to ToiletDoor,
#EndIf;
e_to DarkChamber,
has ~light;
Object -> ToiletDoor "toilet door"
with
name 'toilet' 'door',
describe [; rtrue; ],
! parse_name [ _w;
! _w = NextWord();
! if(_w == 'toilet') {
! _w = NextWord();
! if(_w == 'door')
! return 2;
! return 0;
! }
! if(_w == 'door')
! return 1;
! ],
description "Surprisingly clean.",
when_open "The toilet door stands slightly ajar.",
when_closed "The toilet door is closed.",
#IfDef USEINFORM;
door_to [;
if(self in Toilet) return Library;
return Toilet;
],
door_dir [;
if(self in Toilet) return w_to;
return e_to;
],
#IfNot;
door_dir (w_to) (e_to),
#EndIf;
found_in Toilet Library,
with_key [; if(second == Key or Sweater) return second;],
#IfDef TEST_BEFOREAFTER;
after [; print "*** ToiletDoor.after^"; ],
before [; print "*** ToiletDoor.before^"; ],
#EndIf;
has door openable static lockable;
Object -> Goblin "Goblin"
with
short_name "Goblin",
description "He is a mean looking creature, not to be messed around with. ",
name 'goblin' 'creature',
before[;
Attack:
print "But he has a grim looking scimitar, and you are defenceless. Are you sure that's a good idea? ";
if(YesOrNo()) {
deadflag = 1;
"You'd never believe that so much blood could be contained within this body. ";
} else {
"Wise call.";
}
! rtrue;
],
has animate;
Object -> Sink "Sink"
with
short_name "sink",
name 'sink' 'water',
description[;
print "It's a regular white sink with a faucet for turning water on or off.";
if(Faucet has on)
" There's water running into the sink from the faucet.";
"";
],
has container static scenery;
Object -> Faucet "faucet"
with
short_name "faucet",
name 'faucet',
description[;
print "It's a faucet, possible to switch on/off. ";
"It's currently ", (OnOff) self, ".";
],
has switchable static scenery;
Object DarkChamber "Dark Chamber"
with
description "It's almost entirely dark.",
w_to Toilet;
Class BucketClass
with
! describe [; "^A lovely bucket lies here."; ];
describe "^A stringy bucket lies here.";
Object Library "The Library"
with
name 'library', ! should create "you don't need to refer to ..."
short_name [; print "Huge library"; rtrue; ],
description "You are in an old and deserted library. There is an exit leading south and a toilet to the east.",
s_to CarPark,
se_to RiverBank,
#IfDef USEINFORM;
e_to Toilet,
#IfNot;
e_to ToiletDoor,
#EndIf;
#IfDef TEST_BEFOREAFTER;
after [; print "*** Library.after^"; ],
before [; print "*** Library.before^"; ],
#IfNot;
before [;
Look:
if(self hasnt general) {
give self general;
!QuoteBox(quote_1);
}
],
#EndIf;
has light;
Object -> Holder "holder"
with name 'holder',
has container open;
Object -> -> Carton "carton"
with
name 'carton',
inside_description "It feels so nice, standing in the carton.",
has container open openable enterable;
Object -> Dial "dial"
with
name 'black' 'dial',
initial "There's a black dial on the wall.",
description [;
print "It does from 0 to 99. It's currently set to ",
self.time_left, ".^";
],
time_left 0,
before [;
Turn, Push, Pull: "Try SET DIAL TO 3.";
SetTo:
if(second >= 0 && second < 100) {
if(HDR_GAMEFLAGS-->0 & 128) {
! sound effect: 3, start, full volume, once
print "[Can you hear the sound effect?]^^";
@sound_effect second 2 255 0;
}
self.time_left = second;
"Ok.";
}
"It only goes from 0 to 99.";
],
has static;
Object -> LightSwitch "LightSwitch"
with
short_name "light switch",
description "It's a switch located near the toilet. ",
name 'light' 'switch',
before [;
Push:
if(self has on) {
<<SwitchOff self>>;
} else {
<<SwitchOn self>>;
}
],
after[;
SwitchOn:
give toilet light;
#IfnDef USEINFORM;
ship_directions_enabled = true;
"You flip the light switch next to the toilet upwards. You get
a weird feeling that ship directions now work. ";
#Endif;
SwitchOff:
give toilet ~light;
#IfnDef USEINFORM;
ship_directions_enabled = false;
"You flip the light switch next to the toilet downwards. You get
a weird feeling that ship directions no longer work.";
#Endif;
],
has switchable static;
Object -> Sweater "sweater"
with
name 'sweater' 'red',
has clothing;
BucketClass -> Bucket "bucket"
with
name 'bucket',
describe [; "^An ugly bucket here lies."; ],
has container open;
BucketClass -> Bucker "bucker"
with
name 'bucker',
has container open;
Object -> Aquarium "aquarium"
with
name 'aquarium',
article "an",
description "A big glass aquarium with a lid.",
has container open openable transparent static enterable;
Object ->-> Apple "apple"
with name 'apple',
has concealed;
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.
with
short_name "box",
name 'large' 'box',
inside_description "The box looked pretty big from the outside, but you feel really confined in here.",
description "It's a large box. You could probably fit several people in there.",
time_out [;
print "^The box goes BOOM.^";
],
before [;
! LetGo:
! "No can do!";
],
after [;
LetGo:
--score;
"Yay, got rid of ", (the) noun, "!";
Open:
#IfDef OPTIONAL_FULL_SCORE;
Achieved(0); ! opening the box is an achievement
#EndIf;
Receive:
++score;
! win if you put two things in the box
if(score >= MAX_SCORE) deadflag = 2;
],
time_left 0,
timer_order 50,
has container openable enterable static;
Book -> -> RedBook "red book"
with
name 'red' 'book',
initial "On the bottom of the box, there is a red book.",
description "The book is old and worn.",
before [;
Transfer:
"NO WAY!";
Take, Remove:
if(player in LargeBox) {
"It's too hard to pick it up while inside the box.";
}
if(BlueBook in player) {
print "The blue book does not want to be near the red book and jumps out of your grasp and lands on the floor.^^";
move BlueBook to location;
}
];
Book -> -> BrownBook "brown book"
with
name 'brown' 'book',
description "The book is beautiful..";
Object -> -> Gun "gun"
with
name 'gun',
before [;
Examine: rfalse;
! default: "It's very dangerous, better just leave it alone!";
],
has transparent;
Object -> -> -> Trigger "trigger"
with
name 'trigger';
Object -> Shelf "shelf"
with
name 'shelf',
capacity 1,
has supporter enterable;
Object -> -> Boots "boots"
with
name 'pair' 'of' 'boots',
article "a pair of",
has supporter enterable pluralname;
Object -> Ladder "ladder"
with
name 'ladder',
description [;
print "It's very sturdy. ";
<Search self>;
! if(_PrintContents(" (which contains ", p_obj)) print ")";
],
after [;
Receive: "Wow, you put ",(a) noun," on ", (the) self, "...";
],
inside_description "It's a really good ladder for standing on.",
has supporter enterable;
Object -> -> Sticker "sticker"
with
name 'sticker',
each_turn [;
#IfnDef USEINFORM;
! if(location ~= thedark) "The sticker looks oh so sticky.";
#Endif;
],
add_to_scope Key,
has reactive;
Object -> BlueBook "blue book" class Book
with
name 'book' 'blue',
time_left 0,
initial [;
!print "Self is ", self, ". ";
!if(BlueBook provides hello && BlueBook.hello > 10) {
! print "BlueBook.Hello is ", BlueBook.hello, ". ";
!}
print "A ";
PrintShortName(self);
" is standing on a shelf. Looking at ", (the) self, " makes you dizzy.";
],
before [;
Turn:
"You turn the book around and around. It is endlessly fun. ";
],
after [;
! Drop:
! StopDaemon(Self);