-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToki Pona.i7x
More file actions
2376 lines (1942 loc) · 141 KB
/
Toki Pona.i7x
File metadata and controls
2376 lines (1942 loc) · 141 KB
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
Version 1.0.0 of Toki Pona by Vivian Rose begins here.
"Translates the language of play to toki pona."
[Once https://github.com/ganelson/inform-evolution/blob/main/proposals/0016-language-extensions-reform.md is released, this should be converted to the new format for language extensions. Until then, it shall be a normal extension.]
Book - Translate Is-Usuallys
[ Here we override whole sections of the Standard Rules just to translate some "is usually" text. As Sebastian Arg's Spanish translation puts it, «el 'is usually' no deja redefinir de nuevo por defecto las constantes, por lo que hay que hackearlo».]
Section - Override Default Story Headline (in place of Section 7 - Unindexed Standard Rules variables - in Standard Rules by Graham Nelson)
The story title, the story author, the story headline, the story genre, and the story description are text variables.
The release number and the story creation year are number variables.
The release number is usually 1.
[ The default story headline is the only part we're changing. ]
The story headline is usually "musi".
[ It seems reasonable to leave the default story genre untranslated, considering the documentation:
'The "story genre" … exists purely to help librarians. If it is at all possible to do so, authors are asked to use one of the following standard categories…'
Emily Short defies this convention with Counterfeit Monkey's genre of "Espionage", but such a great work may deserve its own shelf in the library anyway. ]
The story genre is usually "Fiction".
The story title variable translates into Inter as "Story".
Section - Override Default Yourself Description (in place of Section 11 - People in Standard Rules by Graham Nelson)
The specification of person is "Despite the name, not necessarily a human
being, but anything animate enough to envisage having a conversation with, or
bartering with."
A person can be female or male. A person is usually male.
A person can be neuter. A person is usually not neuter.
A person has a number called carrying capacity.
The carrying capacity of a person is usually 100.
A person can be transparent. A person is always transparent.
The yourself is an undescribed person. The yourself is proper-named.
The yourself is privately-named.
Understand "your former self" or "my former self" or "former self" or
"former" as yourself when the player is not yourself.
The description of yourself is usually "sina pona." [This is the only changed line. "As good-looking as ever." → "sina pona."]
The yourself object translates into Inter as "selfobj".
Book - Understanding
Part - Translated Grammar (in place of Part Six - Grammar in Standard Rules by Graham Nelson)
The understand token a time period translates into Inter as "RELATIVE_TIME_TOKEN".
Chapter - Understand Worldly Actions
Understand "alasa lon insa/-- [thing]" or "alasa insa e/-- [thing]" or "alasa lon [thing]" as searching.
Understand "awen" or "z" as waiting.
Understand "insa e [things] tawa [thing]" as inserting it into.
Understand "insa e/-- [thing]" as entering.
Understand "jo e/-- [things]" as taking.
Understand "ijo mi/sina" or "i" as taking inventory.
Understand "kama jo e [things]" as taking.
Understand "kama jo e [things inside] tan [something]" as removing it from.
Understand "kama lon/insa e/-- [thing]" as entering.
Understand "kipisi e [thing]" as cutting.
Understand "kute" as listening.
Understand "kute e [thing]" as listening.
Understand "lanpan e [things]" as taking.
Understand "lanpan e [things inside] tan [something]" as removing it from.
Understand "lape" or "slape" as sleeping.
Understand "len e [something preferably held]" as wearing.
Understand "len ala e [something preferably held]" as taking off.
Understand "luka e [something]" as touching.
Understand "lukin" or "lukin ma" as looking.
Understand "lukin e/-- [something]" as examining.
Understand "lukin anpa e/-- [thing]" or "lukin e anpa pi/-- [thing]" or "lukin lon anpa pi/-- [thing]" as looking under.
Understand "lukin e jo" as taking inventory.
Understand "lukin e ijo mi" as taking inventory.
Understand "lukin insa e/-- [thing]" as searching.
Understand the command "oko" or "l" or "x" as "lukin".
Understand "pakala e/-- [something]" as attacking.
Understand "moku e [things preferably held]" as eating.
Understand "moli e [something]" as attacking.
Understand "nena" or "pilin kon" or "pilin pi/-- nena sinpin/--" as smelling.
Understand "nena e [thing]" or "pilin kon e [thing]" or "pilin pi/-- nena sinpin/-- e [thing]" as smelling.
Understand "open e [device]" as switching on.
Understand "open e [something]" as opening.
Understand "open e [something] kepeken [something preferably held]" as unlocking it with.
Understand "pana e [things preferably held]" as dropping.
[ Default to the right action (inserting it into vs putting it on) for containers/supporters. ]
Understand "pana e [other things] tawa/lon [container]" as inserting it into.
Understand "pana e [other things] tawa/lon [supporter]" as putting it on.
[ But for a non-container non-supporter, default to putting it on. ]
Understand "pana e [other things] tawa/lon [thing]" as putting it on.
Understand "pana e [thing] tawa [person]" as showing it to. [ A story involving more giving than showing might want to change this to giving. ]
Understand "pana lukin e [thing] tawa [person]" as showing it to.
Understand "pilin uta e [thing]" as tasting.
Understand "pilin e/-- [something]" as touching.
Understand "pini e [device]" as switching off.
Understand "pini e [something]" as closing.
Understand "pini awen e [something] kepeken [something preferably held]" as locking it with. [ Consider thinking of a better translation if your story features locking. ]
Understand "seli e [things preferably held]" as burning.
Understand "tawa [direction]" as going.
Understand "tawa [something enterable]" as entering.
Understand "tawa [door]" as entering.
Understand "tawa insa [something]" as entering.
Understand "tawa weka" as exiting.
Understand the command "t" as "tawa".
Understand "uta olin e [something]" or "olin uta e [something]" as kissing. [ "uta e" left to you; is it kissing or tasting or something else? ]
Understand "utala e [something]" as attacking.
Understand "weka" as exiting.
Understand "weka e [things preferably held]" as dropping.
Understand "weka e [other things] tawa/lon [container]" as inserting it into.
Understand "weka e [other things] tawa/lon [supporter]" as putting it on.
Understand "pana e [other things] tawa/lon [thing]" as putting it on.
Chapter - Directions
Section - Translate Directions
Up, down, inside, and outside are privately-named.
Understand "anpa" as down. The printed name of down is "anpa".
Understand "insa" as inside. The printed name of inside is "insa".
Understand "weka" as outside. The printed name of outside is "weka".
Understand "sewi" as up. The printed name of up is "sewi".
[ Cardinal directions don't have good toki pona translations. ]
North, south, east, west, northeast, southeast, northwest, and southwest are privately-named.
Section - Understand a direction as going that direction
[ The parser already does this with builtin directions, but doesn't seem to catch on to their new names. These approaches also don't work:
Understand "[direction]" as going.
Understand "sewi" as going up.
So we do this instead. ]
Ascending is an action applying to nothing. Understand "sewi" as ascending. Instead of ascending, try going up.
Descending is an action applying to nothing. Understand "anpa" as descending. Instead of descending, try going down.
Inside-going is an action applying to nothing. Understand "insa" as inside-going. Instead of inside-going, try going inside.
Chapter - Understand Out Of World Actions
[ These ones are harder to translate. Some, I daresay, barely make literal sense in English. Some are IF jargon; others are computer interface terminology. So let's be merciful and understand the English commands for these. ]
Understand "score" or "musi o nanpa" as requesting the score.
Understand "quit" or "musi o weka" or "pake" as quitting the game.
Understand "save" or "wekama" or "pali e lipu tenpo" as saving the game.
Understand "restart" or "open sin" as restarting the game.
Understand "restore" or "load" or "kama e lipu tenpo" or "kama lipu" as restoring the game.
Understand "verify" or "musi o ale pona anu seme" as verifying the story file.
Understand "version" or "nanpa musi" as requesting the story file version.
Understand "script" or "script on" or "transcript" or "transcript on" or "pali e lipu pi toki musi" as switching the story transcript on.
Understand "script off" or "transcript off" as switching the story transcript off.
Understand "superbrief" or "short" as preferring abbreviated room descriptions.
Understand "verbose" or "long" as preferring unabbreviated room descriptions.
Understand "brief" or "normal" as preferring sometimes abbreviated room descriptions.
Understand "nouns" or "pronouns" as requesting the pronoun meanings.
Understand "notify" or "notify on" as switching score notification on.
Understand "notify off" as switching score notification off.
Part - Understand Built-In Kinds
Understand "ijo" as a thing.
Understand "jan" as a non-animal person. Definition: something is non-animal if it is not an animal.
Understand "lupa" as a door.
Understand "moku" as something edible.
Understand "poki" as a container.
Understand "soweli" as an animal. [ May be inappropriate. Are all animals soweli? Probably not. ]
Understand "supa" as a supporter.
Book - Grammatical Phrases
Chapter - Saying Pronouns
[ "[mi]" is our equivalent to "[we]" or "[us]". ]
Rule for printing the name of yourself: say "[mi]".
To say mi:
now the prior named object is the player;
if the story viewpoint is first person singular or the story viewpoint is first person plural:
say "mi";
if the story viewpoint is second person singular or the story viewpoint is second person plural:
say "sina";
if the story viewpoint is third person singular or the story viewpoint is third person plural: [ I don't recommend this one, but it's here just in case. ]
say "ona".
To say mi li:
if the story viewpoint is third person singular or the story viewpoint is third person plural:
say "ona li";
otherwise:
say "[mi]".
[ The "[ona]" phrase might be handy for responses like this:
Instead of smelling something, say "kon [regarding the noun][ona] li nasa ala.".
Yielding:
>nena e kiwen
kon ona li nasa ala.
>nena e mi
kon sina li nasa ala.]
To say ona:
if the prior named object is the player:
say "[mi]";
otherwise:
say "ona".
To say ona li:
if the prior named object is the player:
say "[mi]";
otherwise:
say "ona li".
Chapter - li
[ The article «li» is omitted for sentences with the subject "mi" or "sina". This phrase lets us say something like "[noun li] poki ala.". If the noun is the player (when referred to with sina/mi), the "li" gets correctly omitted. ]
To say (N - object) li:
if N is yourself:
if story viewpoint is first person singular or
story viewpoint is second person singular or
story viewpoint is first person plural or
story viewpoint is second person plural:
say mi;
rule succeeds;
say "[N] li".
Chapter - Saying Numbers
Section - Vague Toki Pona Numbers
To say (N - number) in vague toki pona:
if N <= 0:
say "ala";
else if N is 1:
say "wan";
else if N is 2:
say "tu";
else:
say "mute".
Section - Specific Toki Pona Numbers
Table of Toki Pona Specific Number Words
Value Word
100 "ale"
20 "mute"
5 "luka"
2 "tu"
1 "wan"
To say (N - number) in specific toki pona:
if N is 0:
say "ala";
rule succeeds;
If N is negative:
say "anpa "; [ Maybe this should go at the end instead of the beginning, but this is just a failsafe. ]
now N is 0 - N;
let started be false;
while N > 0:
repeat through Table of Toki Pona Specific Number Words:
if N >= value entry:
now N is N - value entry;
if started is true:
say " ";
now started is true;
say word entry;
break.
Chapter - Listing Direct Objects
[ Say a list of things as direct objects. Includes commas for three or more things, including the serial comma. For example:
The initial appearance of the desk is "supa li suli. [lob]supa li jo [indenting 3][e list of for sale things on the desk].".
Might say, depending on the things on the desk:
supa li suli. supa li jo e kili, e pan, e poki telo.
supa li suli. supa li jo e kili e pan.
supa li suli. supa li jo e kili.
supa li suli. supa li jo e ala.
In logographic mode, no commas are used, and the list is indented, sort of like this:
supa li suli.
supa li jo e kili
e pan
e poki telo. ]
Use no commas for direct objects translates as (- Constant TOK_OMIT_EN_COMMAS; -).
To say e (L - list of objects):
say "e ";
if the number of entries in L is 0:
say "ala";
rule succeeds;
let commas needed be whether or not the number of entries in L > 2 and the no commas for direct objects option is inactive;
say L joined by "[if commas needed is true][comma][end if] [ilob]e ".
Use no commas for subjects translates as (- Constant TOK_OMIT_E_COMMAS; -).
To say (L - list of objects) li:
if the number of entries in L is 1:
say entry 1 in L li;
otherwise:
say L as subject;
say " li".
To say (L - list of objects) as a/-- subject/subjects:
if the number of entries in L is 0:
say "ala";
rule succeeds;
let commas needed be whether or not the number of entries in L > 2 and the no commas for subjects option is inactive;
say L joined by "[if commas needed is true][comma][end if] en ".
To say (L - list of objects) joined by (S - some text):
let N be the number of entries in L;
repeat with J running from 1 to N:
say entry J in L;
if J is not N:
say S.
Book - English Language Kit Replacements
[ See https://ganelson.github.io/inform/EnglishLanguageKit/S-lng.html ]
Chapter - Vocabulary
Include (- Constant AGAIN1__WD = 'jasima'; -) replacing "AGAIN1__WD".
Include (- Constant AGAIN2__WD = 'sin'; -) replacing "AGAIN2__WD".
Include (- Constant AGAIN3__WD = 'again'; -) replacing "AGAIN3__WD".
Include (- Constant OOPS1__WD = 'oops'; -) replacing "OOPS1__WD".
Include (- Constant OOPS2__WD = 'oops'; -) replacing "OOPS2__WD".
Include (- Constant OOPS3__WD = 'oops'; -) replacing "OOPS3__WD".
Include (- Constant UNDO1__WD = 'monsi'; -) replacing "UNDO1__WD".
Include (- Constant UNDO2__WD = 'ne'; -) replacing "UNDO2__WD".
Include (- Constant UNDO3__WD = 'undo'; -) replacing "UNDO3__WD".
Include (- Constant ALL1__WD = 'ale'; -) replacing "ALL1__WD".
Include (- Constant ALL2__WD = 'ali'; -) replacing "ALL2__WD".
Include (- Constant ALL3__WD = 'ale'; -) replacing "ALL3__WD".
Include (- Constant ALL4__WD = 'ale'; -) replacing "ALL4__WD".
Include (- Constant ALL5__WD = 'ale'; -) replacing "ALL5__WD".
Include (- Constant AND1__WD = 'e//'; -) replacing "AND1__WD".
Include (- Constant AND2__WD = 'en'; -) replacing "AND2__WD".
Include (- Constant AND3__WD = 'e//'; -) replacing "AND3__WD".
Include (- Constant BUT1__WD = 'UNUSED'; -) replacing "BUT1__WD".
Include (- Constant BUT2__WD = 'UNUSED'; -) replacing "BUT2__WD".
Include (- Constant BUT3__WD = 'UNUSED'; -) replacing "BUT3__WD".
Include (- Constant BY__WD = 'tan'; -) replacing "BY__WD".
Include (- Constant ME1__WD = 'mi'; -) replacing "ME1__WD".
Include (- Constant ME2__WD = 'mi'; -) replacing "ME2__WD".
Include (- Constant ME3__WD = 'mi'; -) replacing "ME3__WD".
Include (- Constant OF1__WD = 'of'; -) replacing "OF1__WD".
Include (- Constant OF2__WD = 'of'; -) replacing "OF2__WD".
Include (- Constant OF3__WD = 'of'; -) replacing "OF3__WD".
Include (- Constant OF4__WD = 'of'; -) replacing "OF4__WD".
Include (- Constant OTHER1__WD = 'ante'; -) replacing "OTHER1__WD".
Include (- Constant OTHER2__WD = 'ante'; -) replacing "OTHER2__WD".
Include (- Constant OTHER3__WD = 'ante'; -) replacing "OTHER3__WD".
Include (- Constant THEN1__WD = 'then'; -) replacing "THEN1__WD".
Include (- Constant THEN2__WD = 'then'; -) replacing "THEN2__WD".
Include (- Constant THEN3__WD = 'then'; -) replacing "THEN3__WD".
Include (- Constant NO1__WD = 'ala'; -) replacing "NO1__WD".
Include (- Constant NO2__WD = 'ike'; -) replacing "NO2__WD".
Include (- Constant NO3__WD = 'powe'; -) replacing "NO3__WD".
Include (- Constant YES1__WD = 'lon'; -) replacing "YES1__WD".
Include (- Constant YES2__WD = 'pona'; -) replacing "YES2__WD".
Include (- Constant YES3__WD = 'oke'; -) replacing "YES3__WD".
Include (- Constant AMUSING__WD = 'amusing'; -) replacing "AMUSING__WD".
Include (- Constant FULLSCORE1__WD = 'fullscore'; -) replacing "FULLSCORE1__WD".
Include (- Constant FULLSCORE2__WD = 'full'; -) replacing "FULLSCORE2__WD".
Include (- Constant QUIT1__WD = 'q//'; -) replacing "QUIT1__WD".
Include (- Constant QUIT2__WD = 'quit'; -) replacing "QUIT2__WD".
Include (- Constant RESTART__WD = 'restart'; -) replacing "RESTART__WD".
Include (- Constant RESTORE__WD = 'restore'; -) replacing "RESTORE__WD".
Chapter - Pronoun
[ This lets the story understand "ona". ]
Include (-
Array LanguagePronouns table
'ona' $$1111111111111111 NULL;
-) replacing "LanguagePronouns".
Chapter - Descriptors
Include (-
Array LanguageDescriptors table
'mi' $$111111111111 POSSESS_PK 0
'ona' $$111111111111 POSSESS_PK 'ona';
-) replacing "LanguageDescriptors".
Chapter - Numbers
Include (-
Array LanguageNumbers table
'wan' 1 'tu' 2 'mute' 3;
-) replacing "LanguageNumbers".
Chapter - Commands
[ Kind of a vague chapter name, I know, but I'm matching the ones in the English Language Kit.]
Section - LanguageVerb
[This is so that the command "i asdasd" gives a response like "I only understood you as far as wanting to take inventory." instead of "I only understood you as as far as wanting to i.".]
Include (-
[ LanguageVerb i;
switch (i) {
'i//': print "lukin e ijo sina";
'l//': print "lukin";
'z//': print "awen";
default: rfalse;
}
rtrue;
];
-) replacing "LanguageVerb".
Section - LanguageVerbMayBeName
[ From English Language Kit:
LanguageVerbMayBeName is called by NounDomain when dealing with the player's reply to a "Which do you mean, the short stick or the long stick?" prompt from the parser. If the reply is another verb (for example, LOOK) then then previous ambiguous command is discarded unless it is one of these words which could be both a verb and an adjective in a name property.
Well, there's a lot of this overlap in toki pona. Let's just specify these for now; this may need revisiting depending on the actions and nouns implemented by the story. ]
Include (-
[ LanguageVerbMayBeName w;
if (w == 'ilo' or 'lipu' or 'seli' or 'ku')
rtrue;
rfalse;
];
-) replacing "LanguageVerbMayBeName".
Book - Particles and Lists
Chapter - "anu" in "which do you mean" messages
[ This is for separating choices in the "Which do you mean," parser clarification message. So we get something like this:
>pana e moku
sina toki e seme? sina toki e poki moku, anu pan, anu kili? ]
anu-needed-for-which-do-you-mean is initially false.
Before asking which do you mean:
now anu-needed-for-which-do-you-mean is false.
Before printing the name of an object while asking which do you mean (this is the anu-injection rule):
if anu-needed-for-which-do-you-mean is true:
say "anu ";
now anu-needed-for-which-do-you-mean is true.
Chapter - Strictly Format Logographic Inventory
[ The print standard inventory rule works well in alphabetic mode. For example:
sina jo e:
tomo waso
sike waso mani (pini; ken open ala)
lipu
But logographic mode already has its own notion of indentation, so this would look strange. We want to omit parentheticals too. Let's opt for a more grammatically correct inventory listing in logographic mode. Something like:
sina jo e tomo waso
e lipu
]
The toki pona print inventory rule is listed instead of the print standard inventory rule in the carry out taking inventory rulebook.
Carry out taking inventory (this is the toki pona print inventory rule):
if the current orthography is alphabetic:
say "[mi li] jo e:[line break]" (A);
list the contents of the player, with newlines, indented, including contents, giving inventory information, with extra indentation;
else:
dentally say "[mi li] jo " (B);
list the contents of the player;
say ".".
Hanging is initially false.
Before listing contents of the player when the current orthography is logographic (this is the reset hanging for logographic inventory rule):
now hanging is false.
Before printing the name of something while listing contents of the player (this is the e-prefixing and conditionally indenting the logographic inventory rule): [Is it possible to put the orthographic condition into the rule declaration? that would be neater.]
if the current orthography is logographic:
if hanging is true:
say ilob;
now hanging is true;
say "e ".
Chapter - Listing contents of containers and rooms
[For example, the last line in this excerpt:
>lukin e poki moku
ona li awen e moku sina.
poki moku li jo e kili, e pan, e lipu.
]
[ Indent things listed in a container. This also affects the you-can-also-see rule and the reveal any newly visible interior rule. ]
Definition: an object is a joer if it is a room or it is a container.
Before listing contents of a joer (this is the reset hanging for joers rule):
now hanging is false.
Before printing the name of something while listing contents of a joer (this is the e-prefixing and conditionally indenting joer containees rule):
if hanging is true:
say ilob;
now hanging is true;
say "e ".
[ Replace the rule for examining containers, to add a bit of indentation logic. ]
The toki pona examine containers rule is listed instead of the examine containers rule in the carry out examining rulebook.
This is the toki pona examine containers rule:
if the noun is a container:
if the noun is open or the noun is transparent:
if something described which is not scenery is in the noun and something which is not the player is in the noun:
dentally say "[noun] li jo " (A);
list the contents of the noun, as a sentence, tersely, not listing concealed items;
say ".";
now examine text printed is true;
otherwise if examine text printed is false:
if the player is in the noun:
make no decision;
say "[noun] li jo e ala." (B);
now examine text printed is true.
[ sitelen pona doesn't parenthesize well. Let's skip the parentheticals in logographic mode. ]
Rule for printing room description details of something (this is the omit contents during logographic room descriptions rule):
if the current orthography is logographic:
omit contents in listing.
Chapter - Listing contents of a supporter
[ The output of the examine supporters rule reads better if we rephrase it.
"ijo en pipi li lon supa" makes more sense to be than "supa li jo e ijo e pipi" for supporters.
This could work for containers, too… but somehow I'm more okay with containers using "jo" to describe their contents.
Like, if some bread is in my pantry, then my pantry has the bread. But if my bread is on the table, does my table really *have* the bread?
Making these judgments is part of toki pona. Here's my judgment: let's use jo for containers and lon for supporters.]
[ We want the use initial appearance in room descriptions rule to list the items *before* the supporter, but that rule doesn't make its final string an overridable Response, which makes this trickier. ]
en needed is initially false.
Before listing contents of a supporter (this is the reset en needed rule):
now en needed is false.
Before printing the name of something (called the supportee to be named) while listing contents of a supporter (this is the en-prefix listed supportees rule):
if en needed is true:
say "[if current orthography is logographic] [end if]en " (A);
otherwise:
now en needed is true.
After listing contents of a supporter (called S) (this is the specify location after supportee lists rule): [TODO is this triggered too often?]
now en needed is false; [So we don't print an extra «en», since "After listing contents of a supporter" is still "while listing contents of a supporter".]
say " li lon [S]" (A).
Chapter - Final Question Options
Section - Translate Default Question Options
To decide which topic is the topic (T - a topic): decide on T. [ Hack from https://intfiction.org/t/bubbling-beaker-awards-award-31-august-09-2024/64009/87 ]
When play begins (this is the translate the final question options into toki pona rule):
choose row with a final question wording of "RESTART" in the Table of Final Question Options;
now the final question wording entry is "[command style]open sin[roman type]";
now the topic entry is the topic "o/-- open sin";
choose row with a final question wording of "RESTORE a saved game" in the Table of Final Question Options;
now the final question wording entry is "[command style]kama e lipu tenpo[roman type]";
now the topic entry is the topic "o/-- kama e lipu tenpo/--";
choose row with a final question wording of "QUIT" in the Table of Final Question Options;
now the final question wording entry is "[command style]weka [roman type]tan musi ni";
now the topic entry is the topic "o/-- weka tan/-- musi/-- ni/--";
choose row with a final question wording of "UNDO the last command" in the Table of Final Question Options;
now the final question wording entry is "[command style]monsi [roman type]e tenpo wan";
now the topic entry is the topic "o/-- monsi e/-- tenpo/-- wan/--".
Section - Understand Understandably Ununderstanding Undoers
[ Recognize the whole ">monsi e tenpo wan" command at other times, too. Except we can't actually do that, so just tell the player to be terse. ]
After reading a command (this is the trim verbose undo command rule): [TODO replace monsi]
if the player's command matches "monsi e tenpo wan":
say "o sitelen e ni taso: [command style]monsi[roman type]";
reject the player's command.
Section - Improve Question Option Presentation
[By default the question options are separated by commas. Let's use multiple lines instead.
Instead of something like:
sina ken… >OPEN SIN, >OPEN E LIPU TENPO, >WEKA tan musi ni, anu >MONSI e tenpo wan?
Let's go with something like:
sina ken…
>OPEN SIN
>OPEN E LIPU TENPO
>WEKA tan musi ni
>MONSI e tenpo wan
The single-line output could still be good if we rephrased it a bit to have "anu" between each entry, but the multiline output has its appeal.]
The print the final question in toki pona rule is listed instead of the print the final question rule in the before handling the final question rulebook.
This is the print the final question in toki pona rule:
let named options count be 0;
repeat through the Table of Final Question Options:
if the only if victorious entry is false or the story has ended finally:
if there is a final response rule entry
or the final response activity entry [activity] is not empty:
if there is a final question wording entry, increase named options count by 1;
if the named options count is less than 1, abide by the immediately quit rule;
say "sina ken…[line break]";
repeat through the Table of Final Question Options:
if the only if victorious entry is false or the story has ended finally:
if there is a final response rule entry
or the final response activity entry [activity] is not empty:
if there is a final question wording entry:
say " ";
say final question wording entry;
decrease named options count by 1;
say line break.
Book - Input Hacks
Chapter - Allow o before commands
After reading a command (this is the o razor rule):
if "[the player's command]" matches the regular expression "^o (.+)$":
change the text of the player's command to text matching subexpression 1.
Chapter - Always interpret o commands as commands, not supplications of missing nouns
[ This is the kludgiest chapter, lacking the elegance in implementation and documentation that you might find elsewhere in this extension, stemming from a desire to fix this inadequacy:
>o lukin e
sina wile lukin seme?
>o mu
seme? sina ken ala lukin e ijo ni.
>o mu
sina mu suwi.
Here, the second command is interpreted as a continuation of the first, even though the second command's «o» should clarify it as a new command, not a noun completing the previous command.
To solve this… Well, I would think that overriding the Language Kit's LanguageIsVerb stub could work, but LanguageIsVerb doesn't seem to get called when it needs to be, unless I define «o» as a verb anyway, which I *could* do by understanding "o [text]" as a mistake, but that seems kludgy too. So we resort to overriding the entirety of NounDomain to insert a check for «o». There is probably a better way!
But while searching for a better way, I encountered an issue with the player's command becoming corrupted after the player supplies a missing noun. The fix for this *also* involves overriding NounDomain, so let's apply that too. Thus, the following code is from:
https://intfiction.org/t/disambiguation-check-failure-possibly-due-to-truncating/59441/7 (Thanks, Dr Peter Bates)
with a few lines inserted to convince the parser to interpret any command beginning with «o» as its own command. ]
Include (-
[ NounDomain domain1 domain2 context dont_ask first_word i j k l answer_words marker;
if ((parser_trace >= 4)) {
print " [NounDomain called at word ";
print wn;
print " (domain1 ";
PrintShortName(domain1);
print ", domain2 ";
PrintShortName(domain2);
print ")^";
print " ";
if (indef_mode) {
print "seeking indefinite object: ";
if (((indef_type)&(OTHER_BIT))) {
print "other ";
}
if (((indef_type)&(MY_BIT))) {
print "my ";
}
if (((indef_type)&(THAT_BIT))) {
print "that ";
}
if (((indef_type)&(PLURAL_BIT))) {
print "plural ";
}
if (((indef_type)&(LIT_BIT))) {
print "lit ";
}
if (((indef_type)&(UNLIT_BIT))) {
print "unlit ";
}
if ((indef_owner ~= 0)) {
print "owner:";
PrintShortName(indef_owner);
}
print "^";
print " number wanted: ";
if ((indef_wanted == INDEF_ALL_WANTED)) {
print "all";
} else {
print indef_wanted;
}
print "^";
print " most likely GNAs of names: ";
print indef_cases;
print "^";
} else {
print "seeking definite object^";
}
}
(match_length = 0);
(number_matched = 0);
(match_from = wn);
SearchScope(domain1, domain2, context);
if ((parser_trace >= 4)) {
print " [ND made ";
print number_matched;
print " matches]^";
}
(wn = (match_from + match_length));
if ((number_matched == 0)) {
(wn)++;
rfalse;
}
if ((match_from <= num_words)) {
if ((number_matched == 1)) {
(i = (match_list-->(0)));
return i;
}
if ((wn <= num_words)) {
(i = NextWord());
(wn)--;
if ((i ~= AND1__WD or AND2__WD or AND3__WD or comma_word or THEN1__WD or THEN2__WD or THEN3__WD or BUT1__WD or BUT2__WD or BUT3__WD)) {
if ((lookahead == ENDIT_TOKEN)) {
rfalse;
}
}
}
}
(number_of_classes = 0);
if ((number_matched == 1)) {
(i = (match_list-->(0)));
if ((((indef_mode == 1)) && ((((indef_type)&(PLURAL_BIT)) ~= 0)))) {
if ((context == MULTI_TOKEN or MULTIHELD_TOKEN or MULTIEXCEPT_TOKEN or MULTIINSIDE_TOKEN or NOUN_TOKEN or HELD_TOKEN or CREATURE_TOKEN)) {
BeginActivity(DECIDING_WHETHER_ALL_INC_ACT, i);
if (((ForActivity(DECIDING_WHETHER_ALL_INC_ACT, i)) && (RulebookFailed()))) {
rfalse;
}
EndActivity(DECIDING_WHETHER_ALL_INC_ACT, i);
}
}
}
if ((number_matched > 1)) {
(i = 1);
if ((number_matched > 1)) {
for ((j = 0):(j < (number_matched - 1)):(j)++) {
if ((Identical((match_list-->(j)), (match_list-->((j + 1)))) == 0)) {
(i = 0);
}
}
}
if (i) {
(dont_infer = 1);
}
(i = Adjudicate(context));
if ((i == -1)) {
rfalse;
}
if ((i == 1)) {
rtrue;
}
(dont_infer_pronoun = 1);
}
if ((i ~= 0)) {
if (dont_infer) {
return i;
}
if ((inferfrom == 0)) {
(inferfrom = pcount);
}
((pattern-->(pcount)) = i);
return i;
}
if (dont_ask) {
return (match_list-->(0));
}
if ((match_from > num_words)) {
jump Incomplete;
}
BeginActivity(ASKING_WHICH_DO_YOU_MEAN_ACT);
if (ForActivity(ASKING_WHICH_DO_YOU_MEAN_ACT)) {
jump SkipWhichQuestion;
}
(j = 1);
(marker = 0);
for ((i = 1):(i <= number_of_classes):(i)++) {
while (((((match_classes-->(marker)) ~= i)) && (((match_classes-->(marker)) ~= (-(i)))))) {
(marker)++;
}
if ((~~(((match_list-->(marker)) has animate)))) {
(j = 0);
}
}
if (j) {
PARSER_CLARIF_INTERNAL_RM(65);
} else {
PARSER_CLARIF_INTERNAL_RM(66);
}
(j = number_of_classes);
(marker = 0);
for ((i = 1):(i <= number_of_classes):(i)++) {
while (((((match_classes-->(marker)) ~= i)) && (((match_classes-->(marker)) ~= (-(i)))))) {
(marker)++;
}
(k = (match_list-->(marker)));
if (((match_classes-->(marker)) > 0)) {
DefArt(k);
} else {
IndefArt(k);
}
if ((i < (j - 1))) {
print ", ";
}
if ((i == (j - 1))) {
if (((KIT_CONFIGURATION_BITMAP)&(SERIAL_COMMA_TCBIT))) {
if ((j ~= 2)) {
print ",";
}
}
PARSER_CLARIF_INTERNAL_RM(72);
}
}
print "?^";
.SkipWhichQuestion;
EndActivity(ASKING_WHICH_DO_YOU_MEAN_ACT);
.WhichOne;
(answer_words = Keyboard(buffer2, parse2));
(first_word = (parse2-->(1)));
if ((first_word == ALL1__WD or ALL2__WD or ALL3__WD or ALL4__WD or ALL5__WD)) {
if ((context == MULTI_TOKEN or MULTIHELD_TOKEN or MULTIEXCEPT_TOKEN or MULTIINSIDE_TOKEN)) {
(l = (multiple_object-->(0)));
for ((i = 0):(((i < number_matched)) && (((l + i) < MATCH_LIST_WORDS))):(i)++) {
(k = (match_list-->(i)));
((multiple_object-->(((i + 1) + l))) = k);
}
((multiple_object-->(0)) = (i + l));
rtrue;
}
PARSER_CLARIF_INTERNAL_RM(67);
jump WhichOne;
}
for ((i = 1):(i <= answer_words):(i)++) {
if ((WordFrom(i, parse2) == comma_word)) {
VM_CopyBuffer(buffer, buffer2);
jump RECONSTRUCT_INPUT;
}
}
if ((first_word == 0)) {
(j = wn);
(first_word = LanguageIsVerb(buffer2, parse2, 1));
(wn = j);
}
if ((first_word ~= 0)) {
(j = (first_word->(#dict_par1)));
if ((((0 ~= ((j)&(1)))) && ((~~(LanguageVerbMayBeName(first_word)))))) {
VM_CopyBuffer(buffer, buffer2);
jump RECONSTRUCT_INPUT;
}
}
(k = (WordAddress(match_from) - buffer));
(l = ((buffer2-->(0)) + 1));
for ((j = ((buffer + INPUT_BUFFER_LEN) - 1)):(j >= ((buffer + k) + l)):(j)-- ) {
((j->(0)) = (j->((-(l)))));
}
for ((i = 0):(i < l):(i)++) {
((buffer->((k + i))) = (buffer2->((WORDSIZE + i))));
}
((buffer->(((k + l) - 1))) = 32);
((buffer-->(0)) = ((buffer-->(0)) + l));
if (((buffer-->(0)) > (INPUT_BUFFER_LEN - WORDSIZE))) {
((buffer-->(0)) = (INPUT_BUFFER_LEN - WORDSIZE));
}
.RECONSTRUCT_INPUT;
(num_words = WordCount());
(players_command = (100 + num_words));
(wn = 1);
! By Dr Peter Bates:
!########################## INSERTION COMMENCES #################################
LanguageToInformese();
VM_Tokenise(buffer, parse);
!############################ INSERTION FINISHES ###################################
(num_words = WordCount());
(players_command = (100 + num_words));
(actors_location = ScopeCeiling(player));
FollowRulebook((Activity_after_rulebooks-->(READING_A_COMMAND_ACT)));
return REPARSE_CODE;
.Incomplete;
if ((context == CREATURE_TOKEN)) {
PARSER_CLARIF_INTERNAL_RM(68, actor);
} else {
PARSER_CLARIF_INTERNAL_RM(69, actor);
}
print "^";
(answer_words = Keyboard(buffer2, parse2));
for ((i = 1):(i <= answer_words):(i)++) {
if ((WordFrom(i, parse2) == comma_word)) {
VM_CopyBuffer(buffer, buffer2);
jump RECONSTRUCT_INPUT;
}
}
(first_word = (parse2-->(1)));
if ((first_word == 0)) {
(j = wn);
(first_word = LanguageIsVerb(buffer2, parse2, 1));
(wn = j);
}
if ((first_word ~= 0)) {
!\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
! Insertion by Vivian Rose,
! to interpret any command beginning with «o» as its own command,
! even if the parser is asking for a missing noun.
if (first_word == 'o//') {
VM_CopyBuffer(buffer, buffer2);
jump RECONSTRUCT_INPUT;
}
!\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
(j = (first_word->(#dict_par1)));
if ((((0 ~= ((j)&(1)))) && ((~~(LanguageVerbMayBeName(first_word)))))) {
VM_CopyBuffer(buffer, buffer2);
jump RECONSTRUCT_INPUT;
}
}
if ((inferfrom ~= 0)) {
for ((j = inferfrom):(j < pcount):(j)++) {
if (((pattern-->(j)) == PATTERN_NULL)) {
continue;
}
(i = (WORDSIZE + (buffer-->(0))));
((buffer-->(0)))++;
((buffer->((i)++)) = 32);
if ((parser_trace >= 5)) {
print "[Gluing in inference at ";
print j;
print " with pattern code ";
print (pattern-->(j));
print "]^";
}
((parse2-->(1)) = 0);
if (((((pattern-->(j)) >= 2)) && (((pattern-->(j)) < REPARSE_CODE)))) {
if ((dont_infer_pronoun == 0)) {
PronounNotice((pattern-->(j)));
for ((k = 1):(k <= (LanguagePronouns-->(0))):(k = (k + 3))) {
if (((pattern-->(j)) == (LanguagePronouns-->((k + 2))))) {
((parse2-->(1)) = (LanguagePronouns-->(k)));
if ((parser_trace >= 5)) {
print "[Using pronoun '";
print (address) (parse2-->(1));
print "']^";
}
break;
}
}
}
} else {
((parse2-->(1)) = VM_NumberToDictionaryAddress(((pattern-->(j)) - REPARSE_CODE)));
if ((parser_trace >= 5)) {
print "[Using preposition '";
print (address) (parse2-->(1));
print "']^";
}
}
if (((parse2-->(1)) ~= 0)) {
(k = (buffer + i));
(k = Glulx_PrintAnyToArray((buffer + i), (INPUT_BUFFER_LEN - i), (parse2-->(1))));
(i = (i + k));
((buffer-->(0)) = (i - WORDSIZE));
}
}
}