inform6lib 0.1.3 → 0.1.5

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: 1a01e92e72e9235aa5b0e0a651ca36c75d91f78cb006b5e99a70946e40425063
4
- data.tar.gz: acb6a79edad225ea9916ddfa0de94ffc2e27c80a4f2fe14f307d7b3624cee052
3
+ metadata.gz: fc0a615fe20b2f83055cddf811f048a2a49484ffadf36f6530484f17dff94ee6
4
+ data.tar.gz: 68f0f81e22933676a396445659d4e5ab73caadc799612c1e67f21036ad4aefa8
5
5
  SHA512:
6
- metadata.gz: 5a73a47b1d651f637fea6d2c1d5d52b967bec03576ee52823aacc501ead25ed8fc5f6d308d4667b6706a804dfa8cf57727eddc8c69d9dba4efb7fe098fb95cdd
7
- data.tar.gz: 20bd89c962dd677dd6cce6fef1f120403118f7e09b9edea39148e6579ec1e810f047b2eb5f81038efb746147df286b678f85b6dd89363a5b70ec2221aaff5cbe
6
+ metadata.gz: d8240c06d833b2ccdf0e0051a5e61c774c40178d919e9a39029d6935157e7d0b72b8553efaa11cc80f7ee9c1a65b28ec763ac4b2d92f56b536df7ed0ae230047
7
+ data.tar.gz: 312174cb06f649bc4d8e192fe901bfdf97b9a72d7d679bdbc6d9bbf9d9855d305ee01388cfd92706a8a7e71c7360cdf6da19d8c95ed583f65a12a96b26dd8e14
@@ -251,11 +251,11 @@ module Parser
251
251
  @the_timers = []
252
252
  @active_timers # Number of timers/daemons actives
253
253
 
254
- @score # The current score
254
+ @score = 0 # The current score
255
255
  @last_score # Score last turn (for testing for changes)
256
256
  @notify_mode = true # Score notification
257
- @places_score # Contribution to score made by visiting
258
- @things_score # Contribution made by acquisition
257
+ @places_score = 0 # Contribution to score made by visiting
258
+ @things_score = 0 # Contribution made by acquisition
259
259
 
260
260
  # ------------------------------------------------------------------------------
261
261
  # The player
@@ -4768,7 +4768,7 @@ module Parser
4768
4768
  when String then print "<string ~#{o}~>"; return true
4769
4769
  when NilClass then print "<illegal object number " + o + ">"; return true
4770
4770
  end
4771
- if o == player then print YOURSELF__TX; return true; end
4771
+ if o == @player then print YOURSELF__TX; return true; end
4772
4772
  if defined? LanguagePrintShortName
4773
4773
  return true if LanguagePrintShortName(o)
4774
4774
  end # LanguagePrintShortName
@@ -4823,12 +4823,24 @@ module Parser
4823
4823
  PrefaceByArticle(o, 0); @indef_mode = i;
4824
4824
  end
4825
4825
 
4826
+ def PrintShortName(o)
4827
+ i = @indef_mode; @indef_mode = nil
4828
+ PSN__(o); @indef_mode = i
4829
+ end
4830
+
4831
+ def EnglishNumber(n); LanguageNumber(n); end
4832
+
4826
4833
  def NumberWord(o)
4827
4834
  n = LanguageNumbers.find { |k, _v| k == o }
4828
4835
  return n.last if !n.nil? && !n.empty? # TODO: Be more syntactically precise
4829
4836
  return 0
4830
4837
  end
4831
4838
 
4839
+ def RandomEntry(tab)
4840
+ return RunTimeError(8) if !tab.respond_to?(:empty?) || tab.empty?
4841
+ tab.sample
4842
+ end
4843
+
4832
4844
  # ----------------------------------------------------------------------------
4833
4845
 
4834
4846
  # The ParserError error class
@@ -5529,12 +5541,12 @@ class InformLibrary < Inform::Ephemeral::Object
5529
5541
 
5530
5542
  def NoteObjectAcquisitions
5531
5543
  return if defined?(MULTI_PLAYER)
5532
- player.objectloop do |i|
5544
+ @player.objectloop do |i|
5533
5545
  if i.hasnt?(:moved)
5534
5546
  give i, :moved
5535
5547
  if i.has?(:scored)
5536
- self.score = self.score + OBJECT_SCORE
5537
- self.things_score = self.things_score + OBJECT_SCORE
5548
+ @score = @score + OBJECT_SCORE
5549
+ @things_score = @things_score + OBJECT_SCORE
5538
5550
  end
5539
5551
  end
5540
5552
  end
@@ -5557,7 +5569,7 @@ class InformLibrary < Inform::Ephemeral::Object
5557
5569
  def LoopOverScope(routine, act)
5558
5570
  p1 = @parser_one; sr = @scope_reason; a = @actor; al = @actors_location
5559
5571
  @parser_one = routine;
5560
- if act.nil? then @actor = act else @actor = player end
5572
+ if act.nil? then @actor = act else @actor = @player end
5561
5573
  @actors_location = ScopeCeiling(@actor)
5562
5574
  @scope_reason = scope_reason = LOOPOVERSCOPE_REASON
5563
5575
  SearchScope(@actors_location, @actor, scope_reason)
@@ -5659,6 +5671,8 @@ class InformLibrary < Inform::Ephemeral::Object
5659
5671
  obj = @real_location if obj == thedark && prop.notin?(:initial, :short_name, :description, :life)
5660
5672
  return false if prop.nil?
5661
5673
 
5674
+ # TODO: Is this really necessary?
5675
+ obj.safe_refresh if obj.respond_to?(:safe_refresh)
5662
5676
  value = obj.&(prop)
5663
5677
  return print_routine_result(value) unless value.nil?
5664
5678
 
@@ -5679,6 +5693,7 @@ class InformLibrary < Inform::Ephemeral::Object
5679
5693
  end
5680
5694
  @the_timers << obj
5681
5695
  obj.&(:time_left, timer)
5696
+ return
5682
5697
  end
5683
5698
 
5684
5699
  def StopTimer(obj)
@@ -5689,17 +5704,20 @@ class InformLibrary < Inform::Ephemeral::Object
5689
5704
  end
5690
5705
  @the_timers.delete(obj)
5691
5706
  obj.&(:time_left, 0)
5707
+ return
5692
5708
  end
5693
5709
 
5694
5710
  def StartDaemon(obj)
5695
5711
  return false if @the_timers.include?(obj)
5696
5712
  RunTimeError(4) if @the_timers.length >= MAX_TIMERS
5697
5713
  @the_timers << obj
5714
+ return
5698
5715
  end
5699
5716
 
5700
5717
  def StopDaemon(obj)
5701
5718
  return false unless @the_timers.include?(obj)
5702
5719
  @the_timers.delete(obj)
5720
+ return
5703
5721
  end
5704
5722
 
5705
5723
  # ----------------------------------------------------------------------------
@@ -385,7 +385,7 @@ module Verbs
385
385
  if k2.nil? || k2.list_together != j.list_together
386
386
  # Omit_WL2
387
387
 
388
- if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == 1
388
+ if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == true
389
389
  # Omit_FL2
390
390
  i += 1
391
391
  senc -= 1
@@ -446,7 +446,7 @@ module Verbs
446
446
  if listing_size == 1
447
447
  # Omit_WL2
448
448
 
449
- if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == 1
449
+ if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == true
450
450
  # Omit_FL2
451
451
  i += 1; senc -= 1
452
452
  next
@@ -574,7 +574,7 @@ module Verbs
574
574
 
575
575
  # label Omit_WL2
576
576
 
577
- if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == 1
577
+ if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == true
578
578
  # Omit_FL2
579
579
  i += 1; senc -= 1
580
580
  next
@@ -651,7 +651,7 @@ module Verbs
651
651
  if k.nil? || (k.list_together != j.list_together)
652
652
  # Omit_WL
653
653
 
654
- if WriteBeforeEntry(j, depth, i - senc, c_style, wlf_indent) == 1
654
+ if WriteBeforeEntry(j, depth, i - senc, c_style, wlf_indent) == true
655
655
  # Omit_FL
656
656
  j = NextEntry(j, depth, lt_value, c_style, &query)
657
657
  i += 1
@@ -775,7 +775,7 @@ module Verbs
775
775
 
776
776
  # label Omit_WL
777
777
 
778
- if WriteBeforeEntry(j, depth, i - senc, c_style, wlf_indent) == 1
778
+ if WriteBeforeEntry(j, depth, i - senc, c_style, wlf_indent) == true
779
779
  # Omit_FL
780
780
  j = NextEntry(j, depth, lt_value, c_style, &query)
781
781
  i += 1
@@ -1158,7 +1158,7 @@ module Verbs
1158
1158
  def Achieved(num)
1159
1159
  if task_done[num].nil?
1160
1160
  task_done[num] = true
1161
- score = score + TaskScore(num)
1161
+ @score = @score + TaskScore(num)
1162
1162
  end
1163
1163
  end
1164
1164
 
@@ -1179,7 +1179,7 @@ module Verbs
1179
1179
 
1180
1180
  def FullScoreSub
1181
1181
  ScoreSub()
1182
- return false if score == 0 || TASKS_PROVIDED == 1
1182
+ return false if @score == 0 || TASKS_PROVIDED == 1
1183
1183
  new_line
1184
1184
  L__M(:FullScore, 1)
1185
1185
  for i in 0..NUMBER_TASKS
@@ -1188,15 +1188,15 @@ module Verbs
1188
1188
  PrintTaskName(i)
1189
1189
  end
1190
1190
  end
1191
- if things_score != 0
1192
- PANum(things_score)
1191
+ if @things_score != 0
1192
+ PANum(@things_score)
1193
1193
  L__M(:FullScore, 2)
1194
1194
  end
1195
- if places_score != 0
1196
- PANum(places_score)
1195
+ if @places_score != 0
1196
+ PANum(@places_score)
1197
1197
  L__M(:FullScore, 3)
1198
1198
  end
1199
- new_line; PANum(score); L__M(:FullScore, 4)
1199
+ new_line; PANum(@score); L__M(:FullScore, 4)
1200
1200
  end
1201
1201
 
1202
1202
  # ----------------------------------------------------------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inform6lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nels Nelson
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
- rubygems_version: 4.0.16
53
+ rubygems_version: 4.0.24
54
54
  specification_version: 4
55
55
  summary: The Inform6 Library Ruby Port is a faithful port of the Inform6 interactive
56
56
  fiction standard library in Ruby.