inform6lib 0.1.4 → 0.1.6
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 +4 -4
- data/lib/inform/parserm.h.rb +70 -44
- data/lib/inform/verblibm.h.rb +48 -15
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a40c23e7e9dcb8a291939c84699bdb885ca9101117b214875ec1ac6019ca486a
|
|
4
|
+
data.tar.gz: 500c0ba61643ccfd81a11ba98aac6a1152a59e644b5a871f1ffdbdc4fdfee4ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2ab599b6af58b719f1e24bdb5ed7ac08ece5139139499bf50f8817380c0e3ed4e7a67b38d5b5a17c17bf18760411a1086d3d2412981f419f886e96b3cfc7c3c
|
|
7
|
+
data.tar.gz: be343e7f21440e7c127b3ff51c53c7d558bab0032767aa218a95b88e289eb2cfc1b9797508bba8df9e21a0aa0348fc3251568b4577d48c535e4ee6512ae0de25
|
data/lib/inform/parserm.h.rb
CHANGED
|
@@ -251,11 +251,11 @@ module Parser
|
|
|
251
251
|
@the_timers = []
|
|
252
252
|
@active_timers # Number of timers/daemons actives
|
|
253
253
|
|
|
254
|
-
@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
|
|
258
|
-
@things_score
|
|
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
|
|
@@ -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
|
|
@@ -5050,14 +5062,23 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5050
5062
|
@player.unmute if @player.respond_to?(:unmute) && deadflag != 0
|
|
5051
5063
|
enqueue(command: @buffer.dup)
|
|
5052
5064
|
|
|
5053
|
-
if deadflag
|
|
5054
|
-
|
|
5055
|
-
:death
|
|
5056
|
-
end
|
|
5065
|
+
return session.state if deadflag == 0 && respond_to?(:session) && !session.nil?
|
|
5066
|
+
return __method__ if deadflag == 0
|
|
5057
5067
|
|
|
5058
|
-
|
|
5068
|
+
AfterLife() if deadflag != 2
|
|
5069
|
+
return :playing if deadflag == 0
|
|
5059
5070
|
|
|
5060
|
-
|
|
5071
|
+
OBIT_HEAD()
|
|
5072
|
+
println ScoreSub()
|
|
5073
|
+
DisplayStatus()
|
|
5074
|
+
log.debug "#{@player} is entering the death state" # TODO: Remove
|
|
5075
|
+
RRQPL()
|
|
5076
|
+
end
|
|
5077
|
+
|
|
5078
|
+
def death
|
|
5079
|
+
return :playing if deadflag == 0
|
|
5080
|
+
|
|
5081
|
+
AfterGameOver()
|
|
5061
5082
|
end
|
|
5062
5083
|
|
|
5063
5084
|
def stop
|
|
@@ -5098,37 +5119,26 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5098
5119
|
|
|
5099
5120
|
@results = [nil, 0, nil, nil]; @meta = false
|
|
5100
5121
|
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
# rubocop: disable Lint/UnreachableLoop
|
|
5104
|
-
while @deadflag == 0 # everything happens in this loop
|
|
5105
|
-
return very__late__error()
|
|
5106
|
-
end
|
|
5107
|
-
# rubocop: enable Lint/UnreachableLoop
|
|
5108
|
-
# end
|
|
5122
|
+
return late__error() if @deadflag == 0
|
|
5123
|
+
|
|
5109
5124
|
AfterLife() if deadflag != 2
|
|
5110
|
-
|
|
5125
|
+
if deadflag == 0
|
|
5126
|
+
very__late__error()
|
|
5127
|
+
return late__error()
|
|
5128
|
+
end
|
|
5111
5129
|
|
|
5112
5130
|
OBIT_HEAD()
|
|
5113
|
-
ScoreSub()
|
|
5131
|
+
println ScoreSub()
|
|
5114
5132
|
DisplayStatus()
|
|
5115
|
-
|
|
5133
|
+
RRQPL()
|
|
5116
5134
|
end
|
|
5117
5135
|
|
|
5118
5136
|
def very__late__error
|
|
5119
|
-
if @
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
rescue NoVerbRoutine, NotImplemented
|
|
5125
|
-
"Sorry, that action is not yet implemented."
|
|
5126
|
-
rescue NoMethodError => e
|
|
5127
|
-
parser_error e, "Sorry, there was a program error involving a missing method."
|
|
5128
|
-
rescue TypeError => e
|
|
5129
|
-
parser_error e, "Sorry, there was a program error involving the wrong type of object."
|
|
5130
|
-
rescue StandardError => e
|
|
5131
|
-
parser_error e, "Sorry, there was an unhandled program error."
|
|
5137
|
+
return if @deadflag != 0
|
|
5138
|
+
return if @score == @last_score
|
|
5139
|
+
|
|
5140
|
+
NotifyTheScore() if @notify_mode == true
|
|
5141
|
+
@last_score = @score
|
|
5132
5142
|
end
|
|
5133
5143
|
|
|
5134
5144
|
def late__error
|
|
@@ -5260,6 +5270,14 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5260
5270
|
return L__M(:Miscellany, NO_OBJECT)
|
|
5261
5271
|
rescue CycleError
|
|
5262
5272
|
return L__M(:Miscellany, TREE_ERROR)
|
|
5273
|
+
rescue NoVerbRoutine, NotImplemented
|
|
5274
|
+
"Sorry, that action is not yet implemented."
|
|
5275
|
+
rescue NoMethodError => e
|
|
5276
|
+
parser_error e, "Sorry, there was a program error involving a missing method."
|
|
5277
|
+
rescue TypeError => e
|
|
5278
|
+
parser_error e, "Sorry, there was a program error involving the wrong type of object."
|
|
5279
|
+
rescue StandardError => e
|
|
5280
|
+
parser_error e, "Sorry, there was an unhandled program error."
|
|
5263
5281
|
end
|
|
5264
5282
|
# def late__error
|
|
5265
5283
|
|
|
@@ -5487,23 +5505,25 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5487
5505
|
end
|
|
5488
5506
|
|
|
5489
5507
|
def RRQPL
|
|
5490
|
-
L__M(:Miscellany, 5)
|
|
5491
|
-
|
|
5508
|
+
print L__M(:Miscellany, 5)
|
|
5509
|
+
:death
|
|
5492
5510
|
end
|
|
5493
5511
|
|
|
5494
5512
|
def AfterGameOver
|
|
5495
|
-
return if defined?(MULTI_PLAYER)
|
|
5496
|
-
|
|
5513
|
+
return :playing if defined?(MULTI_PLAYER)
|
|
5514
|
+
|
|
5497
5515
|
@temp_global = 0
|
|
5498
|
-
i = @
|
|
5516
|
+
i = @buffer.to_s.split(WordOrCommaSplitPattern).first.to_s.downcase
|
|
5499
5517
|
if [QUIT1__WD, QUIT2__WD].include?(i)
|
|
5500
|
-
|
|
5518
|
+
return __quit
|
|
5501
5519
|
end
|
|
5502
5520
|
if i == RESTART__WD
|
|
5503
|
-
|
|
5521
|
+
return __restart
|
|
5504
5522
|
end
|
|
5505
5523
|
if i == RESTORE__WD
|
|
5506
5524
|
RestoreSub()
|
|
5525
|
+
return :playing if deadflag == 0
|
|
5526
|
+
|
|
5507
5527
|
return RRQPL()
|
|
5508
5528
|
end
|
|
5509
5529
|
if [FULLSCORE1__WD, FULLSCORE2__WD].include?(i) && TASKS_PROVIDED == 0
|
|
@@ -5514,8 +5534,8 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5514
5534
|
new_line; Amusing()
|
|
5515
5535
|
return RRQPL()
|
|
5516
5536
|
end
|
|
5517
|
-
L__M(:Miscellany, 8)
|
|
5518
|
-
|
|
5537
|
+
print L__M(:Miscellany, 8)
|
|
5538
|
+
:death
|
|
5519
5539
|
end
|
|
5520
5540
|
alias RRQL AfterGameOver
|
|
5521
5541
|
|
|
@@ -5533,8 +5553,8 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5533
5553
|
if i.hasnt?(:moved)
|
|
5534
5554
|
give i, :moved
|
|
5535
5555
|
if i.has?(:scored)
|
|
5536
|
-
|
|
5537
|
-
|
|
5556
|
+
@score = @score + OBJECT_SCORE
|
|
5557
|
+
@things_score = @things_score + OBJECT_SCORE
|
|
5538
5558
|
end
|
|
5539
5559
|
end
|
|
5540
5560
|
end
|
|
@@ -5659,6 +5679,8 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5659
5679
|
obj = @real_location if obj == thedark && prop.notin?(:initial, :short_name, :description, :life)
|
|
5660
5680
|
return false if prop.nil?
|
|
5661
5681
|
|
|
5682
|
+
# TODO: Is this really necessary?
|
|
5683
|
+
obj.safe_refresh if obj.respond_to?(:safe_refresh)
|
|
5662
5684
|
value = obj.&(prop)
|
|
5663
5685
|
return print_routine_result(value) unless value.nil?
|
|
5664
5686
|
|
|
@@ -5679,6 +5701,7 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5679
5701
|
end
|
|
5680
5702
|
@the_timers << obj
|
|
5681
5703
|
obj.&(:time_left, timer)
|
|
5704
|
+
return
|
|
5682
5705
|
end
|
|
5683
5706
|
|
|
5684
5707
|
def StopTimer(obj)
|
|
@@ -5689,17 +5712,20 @@ class InformLibrary < Inform::Ephemeral::Object
|
|
|
5689
5712
|
end
|
|
5690
5713
|
@the_timers.delete(obj)
|
|
5691
5714
|
obj.&(:time_left, 0)
|
|
5715
|
+
return
|
|
5692
5716
|
end
|
|
5693
5717
|
|
|
5694
5718
|
def StartDaemon(obj)
|
|
5695
5719
|
return false if @the_timers.include?(obj)
|
|
5696
5720
|
RunTimeError(4) if @the_timers.length >= MAX_TIMERS
|
|
5697
5721
|
@the_timers << obj
|
|
5722
|
+
return
|
|
5698
5723
|
end
|
|
5699
5724
|
|
|
5700
5725
|
def StopDaemon(obj)
|
|
5701
5726
|
return false unless @the_timers.include?(obj)
|
|
5702
5727
|
@the_timers.delete(obj)
|
|
5728
|
+
return
|
|
5703
5729
|
end
|
|
5704
5730
|
|
|
5705
5731
|
# ----------------------------------------------------------------------------
|
data/lib/inform/verblibm.h.rb
CHANGED
|
@@ -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) ==
|
|
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) ==
|
|
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) ==
|
|
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) ==
|
|
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) ==
|
|
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
|
|
@@ -1030,8 +1030,7 @@ module Verbs
|
|
|
1030
1030
|
# TODO: Figure out how this could work in a non-blocking IO system. FIXME
|
|
1031
1031
|
# The read method would have to create an evented future promise or
|
|
1032
1032
|
# something. That seems like it would cause this code to block on the
|
|
1033
|
-
# read command
|
|
1034
|
-
# of using Netty.
|
|
1033
|
+
# read command.
|
|
1035
1034
|
def YesOrNo
|
|
1036
1035
|
loop do
|
|
1037
1036
|
@input = __read
|
|
@@ -1158,7 +1157,7 @@ module Verbs
|
|
|
1158
1157
|
def Achieved(num)
|
|
1159
1158
|
if task_done[num].nil?
|
|
1160
1159
|
task_done[num] = true
|
|
1161
|
-
score = score + TaskScore(num)
|
|
1160
|
+
@score = @score + TaskScore(num)
|
|
1162
1161
|
end
|
|
1163
1162
|
end
|
|
1164
1163
|
|
|
@@ -1178,8 +1177,8 @@ module Verbs
|
|
|
1178
1177
|
end
|
|
1179
1178
|
|
|
1180
1179
|
def FullScoreSub
|
|
1181
|
-
ScoreSub()
|
|
1182
|
-
return false if score == 0 || TASKS_PROVIDED == 1
|
|
1180
|
+
println ScoreSub()
|
|
1181
|
+
return false if @score == 0 || TASKS_PROVIDED == 1
|
|
1183
1182
|
new_line
|
|
1184
1183
|
L__M(:FullScore, 1)
|
|
1185
1184
|
for i in 0..NUMBER_TASKS
|
|
@@ -1188,15 +1187,15 @@ module Verbs
|
|
|
1188
1187
|
PrintTaskName(i)
|
|
1189
1188
|
end
|
|
1190
1189
|
end
|
|
1191
|
-
if things_score != 0
|
|
1192
|
-
PANum(things_score)
|
|
1190
|
+
if @things_score != 0
|
|
1191
|
+
PANum(@things_score)
|
|
1193
1192
|
L__M(:FullScore, 2)
|
|
1194
1193
|
end
|
|
1195
|
-
if places_score != 0
|
|
1196
|
-
PANum(places_score)
|
|
1194
|
+
if @places_score != 0
|
|
1195
|
+
PANum(@places_score)
|
|
1197
1196
|
L__M(:FullScore, 3)
|
|
1198
1197
|
end
|
|
1199
|
-
new_line; PANum(score); L__M(:FullScore, 4)
|
|
1198
|
+
new_line; PANum(@score); L__M(:FullScore, 4)
|
|
1200
1199
|
end
|
|
1201
1200
|
|
|
1202
1201
|
# ----------------------------------------------------------------------------
|
|
@@ -2399,6 +2398,38 @@ module Verbs
|
|
|
2399
2398
|
# Debugging verbs
|
|
2400
2399
|
# ----------------------------------------------------------------------------
|
|
2401
2400
|
|
|
2401
|
+
# if defined?(DEBUG)
|
|
2402
|
+
|
|
2403
|
+
def TraceOnSub; @parser_trace=1; "[Trace on.]"; end
|
|
2404
|
+
|
|
2405
|
+
def TraceLevelSub
|
|
2406
|
+
@parser_trace = @noun
|
|
2407
|
+
print "[Parser tracing set to level #{@parser_trace} .]\n"
|
|
2408
|
+
end
|
|
2409
|
+
|
|
2410
|
+
def TraceOffSub; @parser_trace=0; "Trace off."; end
|
|
2411
|
+
|
|
2412
|
+
def RoutinesOnSub; @debug_flag = @debug_flag | 1; "[Message listing on.]"; end
|
|
2413
|
+
|
|
2414
|
+
def RoutinesOffSub; @debug_flag = @debug_flag & 14; "[Message listing off.]"; end
|
|
2415
|
+
|
|
2416
|
+
def ActionsOnSub; @debug_flag = @debug_flag | 2; "[Action listing on.]"; end
|
|
2417
|
+
|
|
2418
|
+
def ActionsOffSub; @debug_flag = @debug_flag & 13; "[Action listing off.]"; end
|
|
2419
|
+
|
|
2420
|
+
def TimersOnSub; @debug_flag = @debug_flag | 4; "[Timers listing on.]"; end
|
|
2421
|
+
|
|
2422
|
+
def TimersOffSub; @debug_flag = @debug_flag & 11; "[Timers listing off.]"; end
|
|
2423
|
+
|
|
2424
|
+
def ChangesOnSub; @debug_flag = @debug_flag | 8; "[Changes listing on.]"; end
|
|
2425
|
+
|
|
2426
|
+
def ChangesOffSub; @debug_flag = @debug_flag & 7; "[Changes listing off.]"; end
|
|
2427
|
+
|
|
2428
|
+
def PredictableSub
|
|
2429
|
+
setrandom(100)
|
|
2430
|
+
"[Random number generator now predictable.]"
|
|
2431
|
+
end
|
|
2432
|
+
|
|
2402
2433
|
def XTestMove(obj, dest)
|
|
2403
2434
|
if obj.is_a?(InformLibrary) || obj == LibraryMessages || obj.is_a?(Inform::Ephemeral::Object)
|
|
2404
2435
|
println "[Can't move #{obj.name}: it's a system object.]"
|
|
@@ -2473,6 +2504,8 @@ module Verbs
|
|
|
2473
2504
|
"Nothing is in scope." if @x_scope_count == 0
|
|
2474
2505
|
end
|
|
2475
2506
|
|
|
2507
|
+
# end # defined?(DEBUG)
|
|
2508
|
+
|
|
2476
2509
|
# ----------------------------------------------------------------------------
|
|
2477
2510
|
# Finally: the mechanism for library text (the text is in the language defn)
|
|
2478
2511
|
# ----------------------------------------------------------------------------
|
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.
|
|
4
|
+
version: 0.1.6
|
|
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.
|
|
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.
|