inform6lib 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c832fae34b158458f4ff2550832e9756033a725633750854d4afae675f915eab
4
- data.tar.gz: 93ce34112c5b2c236ab1eb3aa0027ee8fce90e39249c1dc5b3d3d33310142e1a
3
+ metadata.gz: 1a01e92e72e9235aa5b0e0a651ca36c75d91f78cb006b5e99a70946e40425063
4
+ data.tar.gz: acb6a79edad225ea9916ddfa0de94ffc2e27c80a4f2fe14f307d7b3624cee052
5
5
  SHA512:
6
- metadata.gz: 57c086700bcaeef38381113c158c6922983e2918ede45937a04615efc4cd0286df39eb8d8dbad06dcdfa2496bdc41d747fe029d6b6ce91537cc57b193b6deae8
7
- data.tar.gz: ddad647de642419cdf28a6b7c790a37dc443dd705bc62a017c9ef8334a6546d34a4d5ca9abdb6da8431244a05d74f37fa8e5661aaaa1f650afd310302ad8c543
6
+ metadata.gz: 5a73a47b1d651f637fea6d2c1d5d52b967bec03576ee52823aacc501ead25ed8fc5f6d308d4667b6706a804dfa8cf57727eddc8c69d9dba4efb7fe098fb95cdd
7
+ data.tar.gz: 20bd89c962dd677dd6cce6fef1f120403118f7e09b9edea39148e6579ec1e810f047b2eb5f81038efb746147df286b678f85b6dd89363a5b70ec2221aaff5cbe
data/Rakefile CHANGED
@@ -47,7 +47,7 @@ task :verify do
47
47
  system('bundle', 'exec', 'rspec', 'spec/verify_gem_spec.rb') or abort
48
48
  system('bundle', 'exec', 'rake', 'clean')
49
49
  end
50
- task verify: :explode
50
+ task verify: %i[package explode]
51
51
 
52
52
  desc 'Host dev gem'
53
53
  task :devhost do
@@ -28,12 +28,13 @@
28
28
  module Inform
29
29
  # The English module
30
30
  module English
31
- ENGLISH_DIALECT = true
31
+ DIALECT_US = true
32
32
 
33
33
  NONSENSE = 10
34
- REPEATED_ORDER = 20
34
+ REPEATED_COMMAND = 20
35
35
  NOTHING_TO_REPEAT = 21
36
36
  UNEXPECTED_COMMA = 22
37
+ MISSING_ADDRESSEE = 23
37
38
  CANT_TALK = 24
38
39
  SPEECH_THERAPY = 25
39
40
  CANNOT_UNDERSTAND = 27
@@ -73,11 +74,18 @@ module English
73
74
  @article = article
74
75
  has :scenery
75
76
  end
77
+ def description
78
+ return true if location.respond_to?(:compass_look) && location.compass_look(self)
79
+ return true if self.compass_look()
80
+ L__M(:Look, 7, self)
81
+ end
82
+ def compass_look = false
76
83
  end
77
84
 
78
85
  Compass = Inform::Ephemeral::Object.new "compass"
79
86
  Compass.has :concealed
80
87
 
88
+ unless defined?(WITHOUT_DIRECTIONS)
81
89
  Compass > $n_obj = CompassDirection.new("north") {
82
90
  name "n"
83
91
  door_dir :n_to
@@ -104,10 +112,11 @@ module English
104
112
  }
105
113
  Compass > $d_obj = CompassDirection.new("ground")
106
114
  $d_obj.with { door_dir :d_to; name ["d", "down", "floor", "below"] }
115
+ end # WITHOUT_DIRECTIONS
107
116
 
108
- $in_obj = CompassDirection.new("inside")
117
+ Compass > $in_obj = CompassDirection.new("inside")
109
118
  $in_obj.with { door_dir :in_to; name "in" }
110
- $out_obj = CompassDirection.new("outside")
119
+ Compass > $out_obj = CompassDirection.new("outside")
111
120
  $out_obj.with { door_dir :out_to; name "out" }
112
121
 
113
122
  # ------------------------------------------------------------------------------
@@ -278,10 +287,10 @@ module English
278
287
  def LanguageNumber(n)
279
288
  if n == 0; print "zero"; return false; end
280
289
  if n < 0; print "minus "; n = -n; end
281
- if n >= 1000; print LanguageNumber((n / 1000.to_f).to_i) + " thousand"; n = n % 1000; f = 1; end
290
+ if n >= 1000; LanguageNumber((n / 1000.to_f).to_i); print " thousand"; n = n % 1000; f = 1; end
282
291
  if n >= 100
283
292
  print COMMA__TX if f == 1
284
- print LanguageNumber((n / 100.to_f).to_i) + " hundred"
293
+ LanguageNumber((n / 100.to_f).to_i); print " hundred"
285
294
  n = n % 100
286
295
  f = 1
287
296
  end
@@ -333,7 +342,7 @@ module English
333
342
  i = hours % 12
334
343
  i = 12 if i == 0
335
344
  print " " if i < 10
336
- print i + ":" + (mins / 10.to_f).to_i + (mins % 10)
345
+ print i.to_s + ":" + (mins / 10.0).to_i.to_s + (mins % 10).to_s
337
346
  if (hours / 12.to_f).to_i > 0 then print " pm" else print " am" end
338
347
  end
339
348
 
@@ -589,26 +598,6 @@ module English
589
598
  if x1.has?(:supporter); println "(getting onto " + the(x1) + ")"; end
590
599
  if x1.has?(:container); println "(getting into " + the(x1) + ")"; end
591
600
  "(entering " + the(x1) + ")\n"
592
- # else # NI_BUILD_COUNT
593
- # when 6 then print "(getting "
594
- # if x1.has? :supporter
595
- # print "off "
596
- # else
597
- # print "out of "
598
- # end
599
- # print the(x1;) ")"
600
- # when 7 then if x1.has?(:supporter); println "(getting onto " + the(x1) + ")"; end
601
- # if x1.has?(:container); println "(getting into " + the(x1) + ")"; end
602
- # "(entering " + the(x1) + ")\n"
603
- # end
604
- # # defined? NI_BUILD_COUNT
605
- when 8 then s = The(player) + " gets "
606
- s << if x1.has? :supporter
607
- "onto "
608
- else
609
- "into "
610
- end
611
- s << the(x1) + "."
612
601
  end
613
602
  when :Examine then case n
614
603
  when 1 then "Darkness, noun. An absence of light to see by."
@@ -651,7 +640,7 @@ module English
651
640
  end
652
641
  when :Fill then "But there's no water here to carry."
653
642
  when :FullScore then case n
654
- when 1 then if @deadflag
643
+ when 1 then if @deadflag != 0
655
644
  print "The score was "
656
645
  else
657
646
  print "The score is "
@@ -805,9 +794,9 @@ module English
805
794
  "."
806
795
  when 5,6
807
796
  if x1 != @visibility_ceiling
808
- if x1.has? :supporter then print "On " else print "In " end
797
+ if x1.has? :supporter then print "\nOn " else print "\nIn " end
809
798
  print the(x1) + " you"
810
- else print "You" end
799
+ else print "\nYou" end
811
800
  print " can "
812
801
  print "also " if n == 5
813
802
  print "see "
@@ -820,9 +809,7 @@ module English
820
809
  else
821
810
  " here."
822
811
  end
823
- when 7 then "You see nothing of interest in that direction."
824
- when 8 then if x1.has?(:supporter); print " (on "; else; print " (in "; end
825
- print the(x1) + ")"
812
+ when 7 then "You see nothing unexpected in that direction."
826
813
  end
827
814
  when :LookUnder then case n
828
815
  when 1 then "But it's dark."
@@ -836,26 +823,14 @@ module English
836
823
  when 3 then print " You have died "
837
824
  when 4 then print " You have won "
838
825
  when 5 then print "\nWould you like to RESTART, RESTORE a saved game"
839
- # if defined? DEATH_MENTION_UNDO
840
- # print ", UNDO your last move"
841
- # end
842
- # # defined? DEATH_MENTION_UNDO
843
- print ", give the FULL score for that game" if TASKS_PROVIDED == 0
844
- # if defined? NI_BUILD_COUNT
845
- # if (@deadflag == 2 && (I7_Amusing_Provided()))
846
- # print ", see some suggestions for AMUSING things to do"
847
- # end
848
- # else
849
- # if (@deadflag == 2 && AMUSING_PROVIDED == 0)
850
- # print ", see some suggestions for AMUSING things to do"
851
- # end
852
- # end
853
- # # defined? NI_BUILD_COUNT
854
- # if defined? I7_SERIAL_COMMA
855
- # print ","
856
- # end
857
- # # defined? I7_SERIAL_COMMA
858
- " or QUIT?"
826
+ if defined?(DEATH_MENTION_UNDO)
827
+ print ", UNDO your last move"
828
+ end
829
+ print ", give the FULL score for that game" if TASKS_PROVIDED == 0
830
+ if deadflag == 2 && AMUSING_PROVIDED == 0
831
+ print ", see some suggestions for AMUSING things to do"
832
+ end
833
+ " or QUIT?"
859
834
  when 6 then "[Your interpreter does not provide \"undo\". Sorry!]"
860
835
  when 7 then "\"Undo\" failed. [Not all interpreters provide it.]"
861
836
  # when 7 then "[You cannot \"undo\" any further.]"
@@ -1030,7 +1005,7 @@ module English
1030
1005
  when 2 then "Ok."
1031
1006
  end
1032
1007
  when :Score then case n
1033
- when 1 then if @deadflag
1008
+ when 1 then if @deadflag != 0
1034
1009
  print "In that game you scored "
1035
1010
  else
1036
1011
  print "You have so far scored "
@@ -1052,14 +1027,7 @@ module English
1052
1027
  end
1053
1028
  when :Search then case n
1054
1029
  when 1 then "But it's dark."
1055
- when 2
1056
- print "There is nothing "
1057
- if x1.has? :container
1058
- print "in "
1059
- else
1060
- print "on "
1061
- end
1062
- the(x1) + "."
1030
+ when 2 then "There is nothing on " + the(x1) + "."
1063
1031
  when 3 then print "On " + the(x1)
1064
1032
  WriteListFrom(child(x1), ENGLISH_BIT + TERSE_BIT + CONCEAL_BIT + ISARE_BIT)
1065
1033
  "."
@@ -1099,7 +1067,7 @@ module English
1099
1067
  end
1100
1068
  end
1101
1069
  when :Sorry then case n
1102
- when 1 then if defined? ENGLISH_DIALECT then "Oh, don't apologize." else "Oh, don't apologise." end
1070
+ when 1 then if defined? DIALECT_US then "Oh, don't apologize." else "Oh, don't apologise." end
1103
1071
  when 2 then A(player) + " apologizes profusely."
1104
1072
  end
1105
1073
  when :Squeeze then case n
@@ -49,7 +49,7 @@ if defined? TARGET_ZCODE # offsets into Z-machine header
49
49
 
50
50
  HDR_ZCODEVERSION = 0x00 # byte
51
51
  HDR_TERPFLAGS = 0x01 # byte
52
- HDR_GAMERELEASE = 0x02 # word
52
+ HDR_GAMERELEASE = 0x02 unless defined?(HDR_GAMERELEASE) # word
53
53
  HDR_HIGHMEMORY = 0x04 # word
54
54
  HDR_INITIALPC = 0x06 # word
55
55
  HDR_DICTIONARY = 0x08 # word
@@ -57,7 +57,7 @@ HDR_OBJECTS = 0x0A # word
57
57
  HDR_GLOBALS = 0x0C # word
58
58
  HDR_STATICMEMORY = 0x0E # word
59
59
  HDR_GAMEFLAGS = 0x10 # word
60
- HDR_GAMESERIAL = 0x12 # six ASCII characters
60
+ HDR_GAMESERIAL = 0x12 unless defined?(HDR_GAMESERIAL) # six ASCII characters
61
61
  HDR_ABBREVIATIONS = 0x18 # word
62
62
  HDR_FILELENGTH = 0x1A # word
63
63
  HDR_CHECKSUM = 0x1C # word
@@ -102,7 +102,7 @@ ROM_GAMESERIAL = 0x36 # six ASCII characters
102
102
  end
103
103
  # ! defined? TARGET_
104
104
 
105
- if defined? VN_1610
105
+ unless defined? VN_1610
106
106
  Message(fatalerror: "*** Library 6/11 needs Inform v6.10 or later to work ***")
107
107
  end
108
108
  # defined? VN_1610
@@ -31,7 +31,7 @@ Default :MAX_SCORE, 0
31
31
  Default :NUMBER_TASKS, 1
32
32
  Default :OBJECT_SCORE, 4
33
33
  Default :ROOM_SCORE, 5
34
- Default :SACK_OBJECT, 0
34
+ Default :SACK_OBJECT, nil
35
35
  Default :TASKS_PROVIDED, 1
36
36
 
37
37
  # The Verbs module
@@ -708,7 +708,7 @@ if defined? DEBUG_INFIX
708
708
  # strings of text: but you can send messages, call routines or
709
709
  # assign values to variables, properties and array entries.
710
710
  # ^ ~; score++~ is one way to get on in the world.
711
- # ^ ~; deadflag = true~ is one way to get out of it.
711
+ # ^ ~; deadflag != 0 ~ is one way to get out of it.
712
712
  # ^ ~; StopDaemon(nasty little dwarf)~ will keep you from being pestered.^
713
713
  # Conditions like ~; score>20~ are also allowed and print
714
714
  # either 1 (if true) or 0 (if false).^^";