/
grammar.h
1965 lines (1674 loc) · 49.1 KB
/
grammar.h
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
! ######################### Grammar + Actions
! ---------------------
! Base verbs
! ---------------------
Verb 'answer' 'say' 'speak'
* topic 'to' creature -> Answer;
Verb 'ask'
* creature 'about' topic -> Ask
* creature 'for' noun -> AskFor
* creature 'to' topic -> AskTo
* 'that' creature topic -> AskTo;
Verb 'attack' 'break' 'crack' 'destroy'
'fight' 'hit' 'kill' 'murder' 'punch'
'smash' 'thump' 'torture' 'wreck'
* noun -> Attack
* noun 'with' held -> Attack;
Verb 'climb' 'scale'
* noun -> Climb
* 'up'/'over' noun -> Climb
* 'into'/'onto' noun -> Enter
* 'out' 'of'/'from' noun -> Exit;
Verb 'close' 'cover' 'shut'
* noun -> Close
* 'off' noun -> SwitchOff;
Verb 'cut' 'chop' 'prune' 'slice'
* noun -> Cut
* noun 'with' held -> Attack;
Verb 'dig'
* noun -> Dig
* noun 'with' held -> Dig;
Verb 'drink' 'sip' 'swallow'
* noun -> Drink;
Verb 'drop' 'discard' 'throw'
* multiheld -> Drop
* multiexcept 'in'/'into'/'down' noun -> Insert
* held 'at'/'against'/'on'/'onto' noun -> ThrowAt;
Verb 'eat'
* held -> Eat;
#IfDef OPTIONAL_EXTENDED_VERBSET;
Verb 'enter'
* -> GoIn
* noun -> Enter;
#IfNot;
Verb 'enter'
* noun -> Enter;
#Endif;
Verb 'examine' 'x//'
* noun -> Examine;
Verb 'exit' 'leave'
* -> Exit
* noun -> Exit;
Verb 'fill'
* noun -> Fill;
Verb 'get'
* 'out'/'off'/'up' 'of'/'from' noun -> Exit
* 'up'/'out'/'off' -> Exit
* multi -> Take
* 'in'/'into'/'on'/'onto' noun -> Enter
* 'off' noun -> GetOff
* multiinside 'from'/'off' noun -> Remove;
Verb 'give' 'feed' 'offer' 'pay'
* held 'to' creature -> Give
* creature held -> Give reverse
* 'over' held 'to' creature -> Give;
[ ADirection;
if (noun == Directions) rtrue;
rfalse;
];
Verb 'go'
* noun=ADirection -> Go
* noun -> Enter;
Verb 'insert'
* multiexcept 'in'/'into' noun -> Insert;
#Ifdef OPTIONAL_FLEXIBLE_INVENTORY;
Verb 'inventory' 'i//'
* -> Inv
* 'tall'/'wide' -> Inv;
#Ifnot;
Verb 'inventory' 'i//'
* -> Inv;
#Endif;
Verb 'jump'
* -> Jump
* 'over' noun -> JumpOver
* 'in'/'into'/'onto' noun -> Enter
* 'out' 'of'/'from' noun -> Exit
* 'off' noun -> Exit;
Verb 'listen'
* -> Listen
* 'to' noun -> Listen;
Verb 'lock'
* noun 'with' held -> Lock;
Verb 'look' 'l//'
* noun -> Examine
* 'at' noun -> Examine
* -> Look
* 'in'/'inside'/'on' noun -> Search;
Verb 'open' 'uncover' 'unwrap'
* noun -> Open
* noun 'with' held -> Unlock;
Verb 'pick'
* 'up' multi -> Take
* multi 'up' -> Take;
Verb 'pull' 'drag'
* noun -> Pull;
Verb 'push' 'clear' 'move' 'press' 'shift'
* noun -> Push
* noun noun=ADirection -> PushDir
* noun 'to' noun -> Transfer;
Verb 'put' 'place'
* multiexcept 'in'/'inside'/'into' noun -> Insert
* multiexcept 'on'/'onto' noun -> PutOn
* 'on' held -> Wear;
Verb 'read'
* noun -> Examine
* 'about' topic 'in' noun -> Consult reverse
* topic 'in' noun -> Consult;
Verb 'remove'
* worn -> Disrobe
* multi -> Take
* multiinside 'from' noun -> Remove;
Verb 'rub' 'clean' 'dust' 'polish' 'scrub' 'shine' 'sweep' 'wipe'
* noun -> Rub;
Verb 'search'
* noun -> Search;
Verb 'shed' 'disrobe' 'doff'
* held -> Disrobe;
Verb 'shout' 'scream' 'yell'
* topic 'to'/'at' creature -> Answer
* 'to'/'at' noun -> ShoutAt
* topic -> Shout
* -> Shout;
Verb 'show' 'display' 'present'
* creature held -> Show reverse
* held 'to' creature -> Show;
Verb 'sit' 'lie'
* 'on'/'in'/'inside' noun -> Enter
* 'on' 'top' 'of' noun -> Enter;
Verb 'smell' 'sniff'
* -> Smell
* noun -> Smell;
Verb 'stand'
* -> Exit
* 'up' -> Exit
* 'on' noun -> Enter;
Verb 'switch'
* 'on' noun -> SwitchOn
* 'off' noun -> SwitchOff
* noun 'on' -> SwitchOn
* noun 'off' -> SwitchOff
* noun -> SwitchOn;
Verb 'take' 'carry' 'hold'
* multi -> Take
* 'off' noun -> Disrobe
* multiinside 'from'/'off' noun -> Remove
* 'inventory' -> Inv;
Verb 'tell'
* creature 'about' topic -> Tell
* creature 'to' topic -> AskTo;
Verb 'tie' 'attach' 'fasten' 'fix'
* noun -> Tie
* noun 'to' noun -> Tie;
Verb 'touch' 'feel' 'fondle' 'grope'
* noun -> Touch;
Verb 'turn' 'rotate' 'screw' 'twist' 'unscrew'
* noun -> Turn
* noun 'on' -> SwitchOn
* noun 'off' -> SwitchOff
* 'on' noun -> SwitchOn
* 'off' noun -> SwitchOff;
Verb 'unlock'
* noun 'with' held -> Unlock;
Verb 'wait' 'z'
* -> Wait;
Verb 'wear'
* held -> Wear;
[ AnswerSub;
if (second > 1 && RunLife(second,##Answer) ~= 0) rfalse;
return MSG_ANSWER_DEFAULT;
];
[ AskSub;
if (RunLife(noun,##Ask) ~= 0) rfalse;
return MSG_ASK_DEFAULT;
];
[ AskToSub;
PrintMsg(MSG_ASKTO_DEFAULT, noun);
];
[ AskForSub;
if (noun == player) <<Inv>>;
PrintMsg(MSG_ASKFOR_DEFAULT, noun);
];
[ AttackSub;
if(ImplicitGrabIfNotHeld(second)) rtrue;
if (ObjectIsUntouchable(noun)) return;
if (noun has animate && RunLife(noun, ##Attack) ~= 0) rfalse;
return MSG_ATTACK_DEFAULT;
];
[ ClimbSub;
if(noun has animate) return MSG_CLIMB_ANIMATE;
return MSG_CLIMB_DEFAULT;
];
[ CloseSub;
if(ObjectIsUntouchable(noun)) return;
if(noun hasnt openable) { PrintMsg(MSG_CLOSE_YOU_CANT, 'close'); rtrue; }
if(noun hasnt open) { PrintMsg(MSG_CLOSE_NOT_OPEN, noun); rtrue; }
give noun ~open;
scope_modified = true;
run_after_routines_msg = MSG_CLOSE_DEFAULT;
run_after_routines_arg_1 = 'close';
];
[ ConsultSub;
return MSG_CONSULT_NOTHING_INTERESTING;
];
[ CutSub;
return MSG_CUT_NO_USE;
];
[ DigSub;
if(ImplicitGrabIfNotHeld(second)) rtrue;
return MSG_DIG_NO_USE;
];
[ DisrobeSub;
if (noun notin player || noun hasnt worn) return MSG_DISROBE_NOT_WEARING;
give noun ~worn;
run_after_routines_msg = MSG_DISROBE_DEFAULT;
];
[ DrinkSub;
return MSG_DRINK_NOTHING_SUITABLE;
];
[ DropSub _p;
if(noun notin player) return MSG_DROP_NOT_HOLDING;
if(ImplicitDisrobeIfWorn(noun)) rtrue;
_p = parent(player);
!if(_p ~= location) <<Insert noun _p>>;
move noun to parent(player);
give noun moved;
run_after_routines_msg = MSG_DROP_DROPPED;
];
[ EatSub;
if(noun has animate) return MSG_EAT_ANIMATE;
if(ImplicitGrabIfNotHeld(noun)) rtrue;
if(noun hasnt edible) return MSG_EAT_INEDIBLE;
remove noun;
scope_modified = true;
run_after_routines_msg = MSG_EAT_DEFAULT;
];
[ EnterSub _door_dir;
if(noun has door) {
#IfTrue RUNTIME_ERRORS > RTE_MINIMUM;
if(noun.&door_dir == 0) { ! door_to will be checked by Go action anyway
_RunTimeError(ERR_OBJECT_HASNT_PROPERTY, noun);
rtrue;
}
#EndIf;
#IfDef OPTIONAL_SIMPLE_DOORS;
if(noun.#door_dir > 2) {
! This is a Simple Door, where door_dir is an array
if(real_location == noun.&found_in-->1)
_door_dir = 1;
_door_dir = noun.&door_dir-->_door_dir;
} else {
#EndIf;
! Normal Inform door
_door_dir = noun.door_dir;
if(UnsignedCompare(_door_dir, top_object) > 0) {
_door_dir = noun.door_dir();
}
#IfDef OPTIONAL_SIMPLE_DOORS;
}
#EndIf;
! Convert to fake object
_door_dir = DirPropToFakeObj(_door_dir);
<<Go _door_dir>>;
}
if(noun hasnt enterable) { PrintMsg(MSG_ENTER_YOU_CANT, 'enter'); rtrue; }
if(player in noun) return MSG_ENTER_ALREADY;
if(IndirectlyContains(player, noun)) return MSG_ENTER_HELD;
if(noun has container && noun hasnt open) { PrintMsg(MSG_ENTER_NOT_OPEN, noun); rtrue; }
if(parent(noun) ~= parent(player)) return MSG_ENTER_BAD_LOCATION;
PlayerTo(noun, true);
run_after_routines_msg = MSG_ENTER_DEFAULT;
run_after_routines_arg_1 = 'enter';
];
[ ExamineSub x;
#Ifndef OPTIONAL_NO_DARKNESS;
if(location == thedark) return MSG_EXAMINE_DARK;
#Endif;
if (noun.description == 0) {
if (noun has container) {
if (noun has open or transparent) <<Search noun>>;
else { PrintMsg(MSG_EXAMINE_CLOSED, noun); rtrue; }
}
if (noun has switchable) return MSG_EXAMINE_ONOFF;
return MSG_EXAMINE_NOTHING_SPECIAL;
}
x = PrintOrRun(noun, description);
run_after_routines_msg = 1; ! Run after routines, don't print a msg
if (x == 0 && noun has switchable) return MSG_EXAMINE_ONOFF;
];
[ ExitSub _p;
_p = parent(player);
if(parent(_p) == 0) {
! player not inside, standing in the room
if(_p.out_to && noun == 0) <<Go FAKE_OUT_OBJ>>;
return MSG_EXIT_ALREADY;
}
if(noun == 0) <<Exit _p>>;
if(player notin noun) {
if(IndirectlyContains(noun, player)) { PrintMsg(MSG_EXIT_FIRST_LEAVE, parent(player)); rtrue; }
if(noun has supporter) return MSG_EXIT_NOT_ON;
return MSG_EXIT_NOT_IN;
}
if(noun has container && noun hasnt open) { PrintMsg(MSG_EXIT_NOT_OPEN, noun); rtrue; }
PlayerTo(parent(noun), true);
run_after_routines_msg = MSG_EXIT_DEFAULT;
run_after_routines_arg_1 = 'leave';
];
[ FillSub;
return MSG_FILL_NO_WATER;
];
[ GetOffSub;
if (parent(player) == noun) <<Exit noun>>;
return MSG_EXIT_NOT_ON;
];
[ GiveSub;
if(ObjectIsUntouchable(second)) return;
if (noun notin player) return MSG_GIVE_NOT_HOLDING;
if (second == player) return MSG_GIVE_PLAYER;
if (RunLife(second, ##Give) ~= 0) rfalse;
return MSG_GIVE_DEFAULT;
];
[ GoSub _prop;
! when called Directions have been set properly
_prop = selected_direction;
#IfTrue RUNTIME_ERRORS > RTE_MINIMUM;
if(_prop == 0) { _RunTimeError(ERR_INVALID_DIR_PROP); rtrue; }
#EndIf;
return GoDir(_prop);
];
! Generic routine to move object. Can be used for Insert, PutOn, Take, Drop, Transfer, Empty (and Enter/Exit?)
! p_messages:
! 0: Noun is already in second
! 1: Can't put noun in/on itself
! 2: Second isn't open
! 3: Try to grab if not held (1 to try, no message#)
! 4: Try to disrobe noun if worn (1 to try, no message#)
! 5: Second is animate
! 6: Second isn't container
! 7: Second isn't supporter
! 8: Check if second is full
! 9: Default (success) message
[ _MoveNounToSecond p_messages _msg _ancestor _action;
if(ObjectIsUntouchable(second)) return;
_ancestor = CommonAncestor(noun, second);
_msg = p_messages-->0;
if(_msg && parent(noun) == second)
return _msg;
_msg = p_messages-->1;
if(_msg && _ancestor == noun)
return _msg;
_msg = p_messages-->2;
if(_msg && second ~= _ancestor && second has container && second hasnt open) {
PrintMsg(_msg, second);
rtrue;
}
_msg = p_messages-->3;
if(_msg && noun ~=player && second ~= Directions && ImplicitGrabIfNotHeld(noun)) rtrue;
_msg = p_messages-->4;
if(_msg && ImplicitDisrobeIfWorn(noun)) rtrue;
! run before on receiver
#IfDef DEBUG;
if(debug_flag & 1) print "(", (name) second, ").before()^";
#EndIf;
receive_action = action;
_action = action; action = ##Receive;
if(RunRoutines(second, before) ~= 0) { action = _action; rtrue; }
action = _action;
_msg = p_messages-->5;
if(_msg && second has animate)
return _msg;
_msg = p_messages-->6;
if(_msg && second hasnt container) {
PrintMsg(_msg, second);
rtrue;
}
_msg = p_messages-->7;
if(_msg && second hasnt supporter) {
PrintMsg(_msg, second);
rtrue;
}
_msg = p_messages-->8;
if(_msg && _AtFullCapacity(second))
return _msg;
move noun to second;
! run after on object
if(AfterRoutines()) rtrue;
! run after on receiver
#IfDef DEBUG;
if(debug_flag & 1) print "(", (name) second, ").after()^";
#EndIf;
_action = action; action = ##Receive;
if(RunRoutines(second, after) ~= 0) { action = _action; rtrue; }
action = _action;
if (keep_silent) return;
_msg = p_messages-->9;
return _msg; ! Can be 0 or a message#
];
! 0: Noun is already in second
! 1: Can't put noun in/on itself
! 2: Second isn't open
! 3: Try to grab if not held (1 to try, no message#)
! 4: Try to disrobe noun if worn (1 to try, no message#)
! 5: Second is animate
! 6: Second isn't container
! 7: Second isn't supporter
! 8: Check if second is full
! 9: Default (success) message
Array _InsertMessages -->
MSG_INSERT_ALREADY
MSG_INSERT_ITSELF
MSG_INSERT_NOT_OPEN
1
1
MSG_INSERT_ANIMATE
MSG_INSERT_NOT_CONTAINER
0
MSG_INSERT_NO_ROOM
MSG_INSERT_DEFAULT;
[ InsertSub;
if(noun == player) <<Enter second>>;
return _MoveNounToSecond(_InsertMessages);
];
#Ifdef OPTIONAL_FLEXIBLE_INVENTORY;
[ InvSub _mode;
_mode = WordValue(num_words);
if(_mode == 'tall') inventory_style = 0;
if(_mode == 'wide') inventory_style = 1;
#Ifnot;
[ InvSub;
#Endif;
run_after_routines_msg = 1; ! Run after routines, don't print a msg
if(PrintMsg(MSG_INVENTORY_DEFAULT) == false)
return MSG_INVENTORY_EMPTY;
];
[ JumpSub;
return MSG_JUMP;
];
[ JumpOverSub;
return MSG_JUMP_OVER;
];
[ ListenSub;
return MSG_LISTEN_DEFAULT;
];
[ LockSub;
if (ObjectIsUntouchable(noun)) return;
if (noun hasnt lockable) { PrintMsg(MSG_LOCK_NOT_A_LOCK, 'lock'); rtrue; }
if (noun has locked) { PrintMsg(MSG_LOCK_ALREADY_LOCKED, 'lock'); rtrue; }
if (noun has open) return MSG_LOCK_CLOSE_FIRST;
if(ImplicitGrabIfNotHeld(second)) rtrue;
if (RunRoutines(noun, with_key) ~= second) return MSG_LOCK_KEY_DOESNT_FIT;
give noun locked;
run_after_routines_msg = MSG_LOCK_DEFAULT;
run_after_routines_arg_1 = 'lock';
];
[ LookSub _old_lookmode;
_old_lookmode = lookmode;
lookmode = 2; ! force long description
Look();
lookmode = _old_lookmode;
];
[ OpenSub;
if(ObjectIsUntouchable(noun)) return;
if(noun hasnt openable) { PrintMsg(MSG_OPEN_YOU_CANT, 'open'); rtrue; }
if(noun has locked) return MSG_OPEN_LOCKED;
if(noun has open) return MSG_OPEN_ALREADY;
give noun open;
scope_modified = true;
run_after_routines_msg = MSG_OPEN_DEFAULT;
];
[ PullSub;
if (ObjectIsUntouchable(noun)) return;
if (noun has static) return MSG_PULL_STATIC;
if (noun has scenery) return MSG_PULL_SCENERY;
if (noun has animate) return MSG_PULL_ANIMATE;
return MSG_PULL_DEFAULT; !Nothing obvious happens
];
[ PushSub;
if (ObjectIsUntouchable(noun)) return;
if (noun has static) return MSG_PUSH_STATIC;
if (noun has scenery) return MSG_PUSH_SCENERY;
if (noun has animate) return MSG_PUSH_ANIMATE;
return MSG_PUSH_DEFAULT;
];
[ PushDirSub;
return MSG_PUSHDIR_DEFAULT;
];
! 0: Noun is already in second
! 1: Can't put noun in/on itself
! 2: Second isn't open
! 3: Try to grab if not held (1 to try, no message#)
! 4: Try to disrobe noun if worn (1 to try, no message#)
! 5: Second is animate
! 6: Second isn't container
! 7: Second isn't supporter
! 8: Check if second is full
! 9: Default (success) message
Array _PutOnMessages -->
MSG_PUTON_ALREADY
MSG_PUTON_ITSELF
0
1
1
MSG_PUTON_ANIMATE
0
MSG_PUTON_NOT_SUPPORTER
MSG_PUTON_NO_ROOM
MSG_PUTON_DEFAULT;
[ PutOnSub;
if(noun == player) <<Enter second>>;
return _MoveNounToSecond(_PutOnMessages);
];
[ RemoveSub _i;
_i = parent(noun);
if (_i has container && _i hasnt open) { PrintMsg(MSG_REMOVE_CLOSED, _i); rtrue; }
if (_i ~= second) return MSG_REMOVE_NOT_HERE;
if(TryToTakeNoun() ~= false) rtrue;
action = ##Remove; if (AfterRoutines()) rtrue;
action = ##Take;
run_after_routines_msg = MSG_REMOVE_DEFAULT;
];
[ RubSub;
return MSG_RUB_DEFAULT;
];
[ SearchSub _i _plural;
#Ifndef OPTIONAL_NO_DARKNESS;
if(location == thedark) return MSG_SEARCH_DARK;
#Endif;
if (ObjectIsUntouchable(noun)) return;
_plural = PrintContents(1, noun);
if(noun has supporter) {
if(_plural == 0)
return MSG_SEARCH_NOTHING_ON;
else
return MSG_SEARCH_ON_IT_ISARE;
}
if(noun hasnt container) return MSG_SEARCH_NOTHING_SPECIAL;
if(noun hasnt transparent && noun hasnt open)
return MSG_SEARCH_CANT_SEE_CLOSED;
if(AfterRoutines()) rtrue;
_i = MSG_SEARCH_EMPTY;
if(_plural)
_i = MSG_SEARCH_IN_IT_ISARE;
return _i;
];
[ ShoutSub;
return MSG_SHOUT_DEFAULT;
];
[ ShoutAtSub;
return MSG_SHOUTAT_DEFAULT;
];
[ ShowSub;
if (parent(noun) ~= player) return MSG_SHOW_NOT_HOLDING;
if (second == player) <<Examine noun>>;
if (RunLife(second, ##Show) ~= 0) rfalse;
return MSG_SHOW_DEFAULT;
];
[ SmellSub;
if(ObjectIsUntouchable(noun)) return;
return MSG_SMELL_DEFAULT;
];
[ SwitchOffSub;
if (ObjectIsUntouchable(noun)) return;
if (noun hasnt switchable) return MSG_SWITCH_OFF_NOT_SWITCHABLE;
if (noun hasnt on) return MSG_SWITCH_OFF_NOT_ON;
give noun ~on;
run_after_routines_msg = MSG_SWITCH_OFF_DEFAULT;
];
[ SwitchOnSub;
if (ObjectIsUntouchable(noun)) return;
if (noun hasnt switchable) return MSG_SWITCH_ON_NOT_SWITCHABLE;
if (noun has on) return MSG_SWITCH_ON_ON;
give noun on;
run_after_routines_msg = MSG_SWITCH_ON_DEFAULT;
];
[ TakeSub;
if(TryToTakeNoun() ~= false) rtrue;
run_after_routines_msg = MSG_TAKE_DEFAULT;
];
[ TieSub;
return MSG_TIE_DEFAULT;
];
[ TellSub;
if (noun == player) return MSG_TELL_PLAYER;
if (RunLife(noun, ##Tell) ~= 0) rfalse;
return MSG_TELL_DEFAULT;
];
[ ThrowAtSub;
if(ImplicitGrabIfNotHeld(noun)) rtrue;
if(ObjectIsUntouchable(second)) return;
if(ImplicitDisrobeIfWorn(noun)) rtrue;
if(second > 1) {
#IfDef DEBUG;
if(debug_flag & 1) print "(", (name) second, ").before()^";
#EndIf;
action = ##ThrownAt;
if (RunRoutines(second, before) ~= 0) { action = ##ThrowAt; rtrue; }
action = ##ThrowAt;
}
if(second hasnt animate) return MSG_THROW_ANIMATE;
if(RunLife(second,##ThrowAt) ~= 0) rfalse;
return MSG_THROW_DEFAULT;
];
[ TouchSub;
if(ObjectIsUntouchable(noun)) return;
return MSG_TOUCH_DEFAULT;
];
[ TransferSub;
if(noun in second || (noun in parent(player) && selected_direction == d_to))
return MSG_TRANSFER_ALREADY;
if(noun notin player && TryToTakeNoun() == true) rtrue;
if (second has supporter) <<PutOn noun second>>;
if (second == Directions && selected_direction == d_to) <<Drop noun>>;
<Insert noun second>;
];
[ TurnSub;
if (ObjectIsUntouchable(noun)) return;
if (noun has static) return MSG_TURN_STATIC;
if (noun has scenery) return MSG_TURN_SCENERY;
if (noun has animate) return MSG_TURN_ANIMATE;
return MSG_TURN_DEFAULT;
];
[ UnlockSub;
if (ObjectIsUntouchable(noun)) return;
if (noun hasnt lockable) { PrintMsg(MSG_UNLOCK_NOT_A_LOCK, 'unlock'); rtrue; }
if (noun hasnt locked) { PrintMsg(MSG_UNLOCK_ALREADY_UNLOCKED, 'unlock'); rtrue; }
if(ImplicitGrabIfNotHeld(second)) rtrue;
if (RunRoutines(noun, with_key) ~= second) return MSG_UNLOCK_KEY_DOESNT_FIT;
give noun ~locked;
run_after_routines_msg = MSG_UNLOCK_DEFAULT;
run_after_routines_arg_1 = 'unlock';
];
[ WaitSub;
if(AfterRoutines()) rtrue;
return MSG_WAIT_DEFAULT;
];
[ WearSub;
if (parent(noun) ~= player) return MSG_WEAR_NOT_HOLDING;
if (noun has worn) return MSG_WEAR_ALREADY_WORN;
if (noun hasnt clothing) { PrintMsg(MSG_WEAR_NOT_CLOTHING, 'wear'); rtrue; }
give noun worn;
run_after_routines_msg = MSG_WEAR_DEFAULT;
];
! ---------------------
! Extended verbs
! ---------------------
#IfDef OPTIONAL_EXTENDED_VERBSET;
Verb 'blow'
* held -> Blow;
Verb 'bother' 'curses' 'darn' 'drat'
* -> Mild
* topic -> Mild;
Verb 'burn' 'light'
* noun -> Burn
* noun 'with' held -> Burn;
Verb 'buy' 'purchase'
* noun -> Buy;
Verb 'consult'
* noun 'about' topic -> Consult
* noun 'on' topic -> Consult;
Verb 'empty'
* noun -> Empty
* 'out' noun -> Empty
* noun 'out' -> Empty
* noun 'to'/'into'/'on'/'onto' noun -> EmptyT;
Verb 'in' 'inside'
* -> GoIn;
Verb 'kiss' 'embrace' 'hug'
* creature -> Kiss;
Verb 'no'
* -> No;
Verb 'peel'
* noun -> Take
* 'off' noun -> Take;
Verb 'pray'
* -> Pray;
Verb 'pry' 'prise' 'prize' 'lever' 'jemmy' 'force'
* noun 'with' held -> Unlock
* 'apart'/'open' noun 'with' held -> Unlock
* noun 'apart'/'open' 'with' held -> Unlock;
Verb 'set' 'adjust'
* noun -> Set
* noun 'to' special -> SetTo;
Verb 'shit' 'damn' 'fuck' 'sod'
* -> Strong
* topic -> Strong;
Verb 'sing'
* -> Sing;
Verb 'sleep' 'nap'
* -> Sleep;
Verb 'sorry'
* -> Sorry;
Verb 'squeeze' 'squash'
* noun -> Squeeze;
Verb 'swim' 'dive'
* -> Swim;
Verb 'swing'
* noun -> Swing
* 'on' noun -> Swing;
Verb 'taste'
* noun -> Taste;
Verb 'think'
* -> Think;
Verb 'transfer'
* noun 'to' noun -> Transfer;
Verb 'wake' 'awake' 'awaken'
* -> Wake
* 'up' -> Wake
* creature -> WakeOther
* creature 'up' -> WakeOther
* 'up' creature -> WakeOther;
Verb 'wave'
* -> WaveHands
* noun -> Wave;
Verb 'yes' 'y//'
* -> Yes;
[ BlowSub;
if(ImplicitGrabIfNotHeld(noun)) rtrue;
return MSG_BLOW_DEFAULT;
];
[ BurnSub;
if(ImplicitGrabIfNotHeld(second)) rtrue;
return MSG_BURN_DEFAULT;
];
[ BuySub;
return MSG_BUY_DEFAULT;
];
[ EmptySub;
<EmptyT noun FAKE_D_OBJ>;
];
[ EmptyTSub _i _recipient;
if(noun == second) return MSG_EMPTY_WOULDNT_ACHIEVE;
if(noun has container && noun hasnt open) {
PrintMsg(MSG_EMPTY_IS_CLOSED, noun);
rtrue;
}
if(second == Directions && selected_direction ~= 0)
_recipient = DirPropToFakeObj(selected_direction);
else
_recipient = second;
_i = child(noun);
if(_i == 0) { PrintMsg(MSG_EMPTY_ALREADY_EMPTY, noun); rtrue; }
while(_i ~= 0) {
if(keep_silent == 0) print (name) _i, ": ";
<Transfer _i _recipient>;
if(_i in noun || _i in player) rtrue;
_i = child(noun);
}
run_after_routines_msg = 1;
];
[ GoInSub;
! shortcut to <<Go in>>
<Go FAKE_IN_OBJ>;
];
[ KissSub;
if (ObjectIsUntouchable(noun)) return;
if (RunLife(noun, ##Kiss) ~= 0) rfalse;
if (noun == player) return MSG_KISS_PLAYER;
return MSG_KISS_DEFAULT;
];
[ MildSub;
return MSG_MILD_DEFAULT;
];
[ NoSub;
return MSG_RHETORICAL_QUESTION;
];
[ PraySub;
return MSG_PRAY_DEFAULT;
];
[ SetSub;
return MSG_SET_DEFAULT;
];
[ SetToSub;
return MSG_SET_TO_DEFAULT;
];
[ SingSub;
return MSG_SING_DEFAULT;
];
[ SleepSub;
return MSG_SLEEP_DEFAULT;
];
[ SorrySub;
return MSG_SORRY_DEFAULT;
];
[ StrongSub;
return MSG_STRONG_DEFAULT;
];
[ SqueezeSub;
if (ObjectIsUntouchable(noun)) return;
if (noun has animate) return MSG_SQUEEZE_YOURSELF;
return MSG_SQUEEZE_DEFAULT;
];
[ SwimSub;
return MSG_SWIM_DEFAULT;
];
[ SwingSub;
return MSG_SWING_DEFAULT;
];
[ TasteSub;
if (ObjectIsUntouchable(noun)) return;
return MSG_TASTE_DEFAULT;
];
[ ThinkSub;
return MSG_THINK_DEFAULT;
];
[ WakeSub;
return MSG_WAKE_DEFAULT;
];
[ WakeOtherSub;
if (ObjectIsUntouchable(noun)) return;
if (RunLife(noun, ##WakeOther) ~= 0) rfalse;
return MSG_WAKEOTHER_DEFAULT;
];
[ WaveSub;
if(parent(noun) ~= player) { PrintMsg(MSG_WAVE_NOTHOLDING, noun); rtrue; }
return MSG_WAVE_DEFAULT;
];
[ WaveHandsSub;
return MSG_WAVEHANDS_DEFAULT;
];
[ YesSub;
return MSG_RHETORICAL_QUESTION;