Module: Inform::Verbs
Overview
The Verbs module
Constant Summary collapse
- MAKE__TS =
true- TASK_SCORES =
{ scores: [0, 0, 0, 0] }.freeze
- TASK_DONE =
{ tasks: [] }.freeze
- LibraryMessages =
Inform::Ephemeral::Object.new
Constants included from English
English::AGAIN1__WD, English::AGAIN2__WD, English::AGAIN3__WD, English::ALL1__WD, English::ALL2__WD, English::ALL3__WD, English::ALL4__WD, English::ALL5__WD, English::AMBIGUOUS, English::AMUSING__WD, English::AND1__WD, English::AND2__WD, English::AND3__WD, English::AND__TX, English::ANIMATE_EXPECTED, English::ARE2__TX, English::ARE__TX, English::BUT1__WD, English::BUT2__WD, English::BUT3__WD, English::CANNOT_UNDERSTAND, English::CANTGO__TX, English::CANT_SEE, English::CANT_TALK, English::COMMA__TX, English::Compass, English::DARKNESS__TX, English::DEFART_PK, English::ENGLISH_DIALECT, English::EXCEPTED_UNECESSARILY, English::FORMER__TX, English::FULLSCORE1__WD, English::FULLSCORE2__WD, English::INDEFART_PK, English::IS2__TX, English::IS__TX, English::LISTAND2__TX, English::LISTAND__TX, English::LanguageAnimateGender, English::LanguageArticles, English::LanguageContractionForms, English::LanguageDescriptors, English::LanguageGNAsToArticles, English::LanguageInanimateGender, English::LanguageNumbers, English::LanguagePronouns, English::MANUAL_PRONOUNS, English::ME1__WD, English::ME2__WD, English::ME3__WD, English::MOVES__TX, English::NKEY1__KY, English::NKEY2__KY, English::NKEY__TX, English::NO1__WD, English::NO2__WD, English::NO3__WD, English::NONSENSE, English::NOTHING, English::NOTHING_TO_REPEAT, English::NOTHING__TX, English::NOT_HELD, English::NO_MULTIPLES, English::NO_OBJECT, English::NUMBER_UNRECOGNIZED, English::NumbersLanguage, English::OF1__WD, English::OF2__WD, English::OF3__WD, English::OF4__WD, English::OOPS1__WD, English::OOPS2__WD, English::OOPS3__WD, English::OR__TX, English::OTHER1__WD, English::OTHER2__WD, English::OTHER3__WD, English::PARTIALLY_UNDERSTOOD, English::PKEY1__KY, English::PKEY2__KY, English::PKEY__TX, English::POSSESS_PK, English::Prepositions, English::QKEY1__KY, English::QKEY1__TX, English::QKEY2__KY, English::QKEY2__TX, English::QUIT1__WD, English::QUIT2__WD, English::REPEATED_ORDER, English::RESTART__WD, English::RESTORE__WD, English::RKEY__TX, English::SCENERY_IS_IRRELEVANT, English::SCORE__TX, English::SPEECH_THERAPY, English::THAT__TX, English::THEN1__WD, English::THEN2__WD, English::THEN3__WD, English::THOSET__TX, English::TIME__TX, English::TOOFEW, English::TOOLITTLE, English::TOOMANY, English::TREE_ERROR, English::UNDO1__WD, English::UNDO2__WD, English::UNDO3__WD, English::UNEXPECTED_COMMA, English::UNRECOGNIZED, English::VAGUE, English::WHICH__TX, English::WHOM__TX, English::YES1__WD, English::YES2__WD, English::YES3__WD, English::YOU2__TX, English::YOUR2__TX, English::YOURSELF__TX, English::YOUR__TX, English::YOU__TX
Instance Method Summary collapse
-
#AllowPushDir ⇒ Object
—————————————————————————- Verbs which are really just stubs (anything which happens for these actions must happen in before rules) —————————————————————————-.
- #AnswerSub ⇒ Object
- #ArrivalDir(dest, source = @real_location) ⇒ Object
- #AskForSub ⇒ Object
- #AskSub ⇒ Object
- #AskToSub ⇒ Object
- #AttackSub ⇒ Object
-
#AttemptToTakeObject(item) ⇒ Object
def ObjectIsUntouchable.
- #Banner ⇒ Object
- #BlowSub ⇒ Object
- #BurnSub ⇒ Object
- #BuySub ⇒ Object
- #ClimbSub ⇒ Object
- #CloseSub ⇒ Object
-
#CommonAncestor(o1, o2) ⇒ Object
—————————————————————————- The object tree and determining the possibility of moves —————————————————————————-.
- #ConsultSub ⇒ Object
- #CutSub ⇒ Object
- #DigSub ⇒ Object
- #DisrobeSub ⇒ Object
- #DrinkSub ⇒ Object
- #DropSub ⇒ Object
- #EatSub ⇒ Object
-
#EconomyVersion(o, j, depth, senc, stack_pointer = 0, c_style = @c_style, lt_value = @lt_value, listing_together = @listing_together, listing_size = @listing_size, wlf_indent = @wlf_indent, &query) ⇒ Object
def WriteListR.
- #EmptySub ⇒ Object
- #EmptyTSub ⇒ Object
-
#EnterSub ⇒ Object
—————————————————————————- Travelling around verbs —————————————————————————-.
- #ExamineSub ⇒ Object
- #ExitSub ⇒ Object
- #FillSub ⇒ Object
- #FindVisibilityLevels ⇒ Object
- #GetOffSub ⇒ Object
- #GiveRSub ⇒ Object
-
#GiveSub ⇒ Object
—————————————————————————- Gifts —————————————————————————-.
- #GoInSub ⇒ Object
- #GonearSub ⇒ Object
- #GoSub ⇒ Object
- #GotoSub ⇒ Object
- #IndirectlyContains(o1, o2) ⇒ Object
- #InsertSub ⇒ Object
- #InvSub ⇒ Object
- #InvTallSub ⇒ Object
-
#InvWideSub ⇒ Object
—————————————————————————- Real verbs start here: Inventory —————————————————————————-.
- #JumpOverSub ⇒ Object
- #JumpSub ⇒ Object
- #KissSub ⇒ Object
- #ListenSub ⇒ Object
- #ListEqual(o1, o2, c_style = @c_style) ⇒ Object
-
#LMode1Sub ⇒ Object
—————————————————————————- Looking.
-
#LMode2Sub ⇒ Object
Verbose.
-
#LMode3Sub ⇒ Object
Superbrief.
- #Locale(descin, text1 = nil, text2 = nil, flag = false) ⇒ Object
- #LockSub ⇒ Object
- #LookSub(allow_abbrev = nil) ⇒ Object
- #LookUnderSub ⇒ Object
- #MildSub ⇒ Object
-
#MoveFloatingObjects ⇒ Object
—————————————————————————- A cunning routine (which could have been a daemon, but isn’t, for the sake of efficiency) to move objects which could be in many rooms about so that the player never catches one not in place —————————————————————————-.
- #MovePlayer(direc) ⇒ Object
-
#NextEntry(o, odepth, lt_value = @lt_value, c_style = @c_style, &_block) ⇒ Object
—————————————————————————- The WriteListFrom routine, a flexible object-lister taking care of plurals, inventory information, various formats and so on.
- #NoSub ⇒ Object
- #NoteArrival ⇒ Object
- #NotifyOffSub ⇒ Object
- #NotifyOnSub ⇒ Object
- #NotSupportingThePlayer(o) ⇒ Object
- #ObjectIsUntouchable(item, flag1 = nil, flag2 = nil, persona = nil) ⇒ Object
- #ObjectScopedBySomething(item) ⇒ Object
- #ObjectsSub ⇒ Object
- #OpenSub ⇒ Object
- #Places1Sub ⇒ Object
- #PlacesSub ⇒ Object
-
#PlayerTo(newplace, flag = 0) ⇒ Object
—————————————————————————- Two little routines for moving the player safely.
- #PraySub ⇒ Object
- #Print__Spaces(n) ⇒ Object
- #Print_ScL(obj) ⇒ Object
- #PullSub ⇒ Object
- #PushDirSub ⇒ Object
- #PushSub ⇒ Object
- #PutOnSub ⇒ Object
-
#QuitSub ⇒ Object
TODO: How could this work in a non-blocking IO system? FIXME.
- #RemoveSub ⇒ Object
- #RestartSub ⇒ Object
- #RestoreSub ⇒ Object
- #RMaybe ⇒ Object
- #RubSub ⇒ Object
- #RunTimeError(n, p1 = nil, p2 = nil) ⇒ Object
- #SaveSub ⇒ Object
-
#SayWhatsOn(descon) ⇒ Object
—————————————————————————- Describing the world.
- #ScopeSub ⇒ Object
- #ScoreArrival ⇒ Object
- #SearchSub ⇒ Object
- #SetSub ⇒ Object
- #SetToSub ⇒ Object
- #ShowRSub ⇒ Object
- #ShowSub ⇒ Object
- #SingSub ⇒ Object
- #SleepSub ⇒ Object
- #SMaybe ⇒ Object
- #SmellSub ⇒ Object
- #SorrySub ⇒ Object
- #SortOutList(obj) ⇒ Object
- #SortTogether(obj, value) ⇒ Object
- #SqueezeSub ⇒ Object
- #StrongSub ⇒ Object
- #SwimSub ⇒ Object
- #SwingSub ⇒ Object
- #SwitchoffSub ⇒ Object
- #SwitchonSub ⇒ Object
-
#TakeSub ⇒ Object
—————————————————————————- Object movement verbs —————————————————————————-.
- #task_done ⇒ Object
- #task_scores ⇒ Object
- #TasteSub ⇒ Object
- #TellSub ⇒ Object
- #ThinkSub ⇒ Object
- #ThrowAtSub ⇒ Object
- #TieSub ⇒ Object
- #TouchSub ⇒ Object
-
#TransferSub ⇒ Object
—————————————————————————- Empties and transfers are routed through the actions above —————————————————————————-.
- #TurnSub ⇒ Object
-
#UnlockSub ⇒ Object
—————————————————————————- Verbs which change the state of objects without moving them —————————————————————————-.
- #VagueGoSub ⇒ Object
- #VerifySub ⇒ Object
- #VersionSub ⇒ Object
- #VisibleContents(o) ⇒ Object
- #Vmaybe ⇒ Object
- #Vwrong ⇒ Object
- #WaitSub ⇒ Object
- #WakeOtherSub ⇒ Object
- #WakeSub ⇒ Object
- #WaveHandsSub ⇒ Object
- #WaveSub ⇒ Object
- #WearSub ⇒ Object
- #WillRecurs(o, c_style = @c_style) ⇒ Object
- #WriteAfterEntry(o, depth, stack_p, c_style = @c_style, _lt_value = @lt_value, _listing_together = @listing_together, _listing_size = @listing_size, &query) ⇒ Object
-
#WriteBeforeEntry(o, depth, sentencepos, c_style = @c_style, wlf_indent = 0) ⇒ Object
end EconomyVersion (WriteListR).
- #WriteListFrom(o, style, depth = 0, &query) ⇒ Object
- #WriteListR(o, depth, stack_pointer = 0, c_style = @c_style, lt_value = @lt_value, listing_together = @listing_together, listing_size = @listing_size, wlf_indent = @wlf_indent, &query) ⇒ Object
- #XAbstractSub ⇒ Object
- #XObj(obj, f = 0) ⇒ Object
- #XPurloinSub ⇒ Object
-
#XTestMove(obj, dest) ⇒ Object
—————————————————————————- Debugging verbs —————————————————————————-.
- #XTreeSub ⇒ Object
-
#YesOrNo ⇒ Object
TODO: Figure out how this could work in a non-blocking IO system.
- #YesSub ⇒ Object
Methods included from English
#CThatorThose, #CTheyreorThats, #IsorAre, #ItorThem, #LanguageContraction, #LanguageDirection, #LanguageNumber, #LanguageTimeOfDay, #LanguageToInformese, #LanguageVerb, #LanguageVerbIsDebugging, #LanguageVerbLikesAdverb, #LanguageVerbMayBeName, #ThatorThose, #language_lm, #library_messages
Instance Method Details
#AllowPushDir ⇒ Object
Verbs which are really just stubs (anything which happens for these
actions must happen in before rules)
2189 2190 2191 2192 2193 2194 2195 2196 2197 |
# File 'lib/inform/verblibm.h.rb', line 2189 def AllowPushDir return L__M(:PushDir, 2, noun) if parent(second) != Compass return L__M(:PushDir, 3, noun) if [$u_obj, $d_obj].include?(second) AfterRoutines(); i = noun; move i, @player invoke :Go, second if @location == thedark then move i, @real_location else move i, @location end end |
#AnswerSub ⇒ Object
2199 2200 2201 2202 |
# File 'lib/inform/verblibm.h.rb', line 2199 def AnswerSub return false if !second.nil? && RunLife(second, :Answer) L__M(:Answer, 1, noun) end |
#ArrivalDir(dest, source = @real_location) ⇒ Object
1739 1740 1741 1742 1743 1744 |
# File 'lib/inform/verblibm.h.rb', line 1739 def ArrivalDir(dest, source = @real_location) link = dest.links.find { |l| l.to == source } return nil if link.nil? # TODO: Doesn't work for door objects FIXME direc = Compass.find { |dir| dir.door_dir == link.name.to_sym } end |
#AskForSub ⇒ Object
2209 2210 2211 2212 |
# File 'lib/inform/verblibm.h.rb', line 2209 def AskForSub inv if noun == @player L__M(:Order, 1, noun) end |
#AskSub ⇒ Object
2204 2205 2206 2207 |
# File 'lib/inform/verblibm.h.rb', line 2204 def AskSub return false if RunLife(noun, :Ask) L__M(:Ask, 1, noun) end |
#AskToSub ⇒ Object
2214 2215 2216 2217 |
# File 'lib/inform/verblibm.h.rb', line 2214 def AskToSub return false if RunLife(noun, :AskTo) L__M(:Order, 1, noun) end |
#AttackSub ⇒ Object
2219 2220 2221 2222 2223 |
# File 'lib/inform/verblibm.h.rb', line 2219 def AttackSub return if ObjectIsUntouchable(noun) return false if noun.has?(:animate) && RunLife(noun, :Attack) L__M(:Attack, 1, noun) end |
#AttemptToTakeObject(item) ⇒ Object
def ObjectIsUntouchable
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
# File 'lib/inform/verblibm.h.rb', line 1291 def AttemptToTakeObject(item) # Try to transfer the given item to the player: return false # if successful, true if unsuccessful, printing a suitable message # in the latter case. # People cannot ordinarily be taken. if item == @player then println L__M(:Take, 2); return true; end if item.has? :animate then println L__M(:Take, 3, item); return true; end ancestor = CommonAncestor(@player, item) if ancestor.nil? i = ObjectScopedBySomething(item) ancestor = CommonAncestor(@player, i) if i end # Is the player indirectly inside the item? return L__M(:Take, 4, item) if ancestor == item # Does the player already directly contain the item? return L__M(:Take, 5, item) if item.in? @player # Can the player touch the item, or is there (e.g.) a closed container # in the way? return true if ObjectIsUntouchable(item, false, true) # The item is now known to be accessible. # Consult the immediate possessor of the item, if it's in a container # which the player is not in. i = parent(item) if i != ancestor && i.hasany?(:container, :supporter) after_recipient = i k = @action; @action = :LetGo j = RunRoutines(i, :before) @action = k return true if j end if item.has? :scenery then println L__M(:Take, 10, item); return true; end if item.has? :static then println L__M(:Take, 11, item); return true; end # The item is now known to be available for taking. Is the player # carrying too much? If so, possibly juggle items into the rucksack # to make room. k = 0; @player.objectloop { |j2| k += 1 if j2.hasnt? :worn } if ValueOrRun(@player, :capacity) < k # TODO: FIXME # return L__M(:Take, 12) if SACK_OBJECT.nil? # # if SACK_OBJECT.parent != @player # return L__M(:Take, 12) # end # j = nil # @player.objectloop { |k| # if k != SACK_OBJECT && k.hasnt?(:worn) && k.hasnt?(:light); j = k; end # } # # if !j.nil? # L__M(:Take, 13, j) # @keep_silent = true; Insert j, SACK_OBJECT; keep_silent = false # return true if !j < SACK_OBJECT # end # # return L__M(:Take, 12) end # Transfer the item. @player.publish L__M(:Take, 15, noun) move item, @player # Send "after" message to the object letting go of the item, if any. unless after_recipient.nil? k = @action; @action = :LetGo j = RunRoutines(after_recipient, :after) @action = k return true if j end return false end |
#Banner ⇒ Object
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 |
# File 'lib/inform/verblibm.h.rb', line 49 def Banner if defined?(Story) && !Story.nil? && !Story.empty? style :bold print Story style :roman end print Headline if defined?(Headline) && !Headline.nil? && !Headline.empty? print " by " + Story_Author if defined?(Story_Author) && !Story_Author.nil? && !Story_Author.empty? print "Release " + (HDR_GAMERELEASE & 0x03ff) print " / Serial number " print HDR_GAMESERIAL # defined?(TARGET_) print " / #{executable} v"; inversion print " Library " + LibRelease.to_s + " " if defined? STRICT_MODE print "S" end # defined? STRICT_MODE if defined? INFIX print "X" else if defined? DEBUG print "D" end # defined? DEBUG end # defined? INFIX new_line end |
#BlowSub ⇒ Object
2225 |
# File 'lib/inform/verblibm.h.rb', line 2225 def BlowSub; L__M(:Blow, 1, noun); end |
#BurnSub ⇒ Object
2227 |
# File 'lib/inform/verblibm.h.rb', line 2227 def BurnSub; L__M(:Burn, 1, noun); end |
#BuySub ⇒ Object
2229 |
# File 'lib/inform/verblibm.h.rb', line 2229 def BuySub; L__M(:Buy, 1, noun); end |
#ClimbSub ⇒ Object
2231 |
# File 'lib/inform/verblibm.h.rb', line 2231 def ClimbSub; L__M(:Climb, 1, noun); end |
#CloseSub ⇒ Object
2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 |
# File 'lib/inform/verblibm.h.rb', line 2136 def CloseSub return if ObjectIsUntouchable(noun) return L__M(:Close, 1, noun) if noun.hasnt? :openable return L__M(:Close, 2, noun) if noun.hasnt? :open take noun, :open return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Close, 4, noun) L__M(:Close, 3, noun) end |
#CommonAncestor(o1, o2) ⇒ Object
The object tree and determining the possibility of moves
1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 |
# File 'lib/inform/verblibm.h.rb', line 1180 def CommonAncestor(o1, o2) # Find the nearest object indirectly containing o1 and o2, # or return nil if there is no common ancestor. i = o1 loop do break if i.nil? j = o2 loop do break if j.nil? return i if j == i j = j.parent end i = i.parent end return nil end |
#ConsultSub ⇒ Object
2233 |
# File 'lib/inform/verblibm.h.rb', line 2233 def ConsultSub; L__M(:Consult, 1, noun); end |
#CutSub ⇒ Object
2235 |
# File 'lib/inform/verblibm.h.rb', line 2235 def CutSub; L__M(:Cut, 1, noun); end |
#DigSub ⇒ Object
2237 |
# File 'lib/inform/verblibm.h.rb', line 2237 def DigSub; L__M(:Dig, 1, noun); end |
#DisrobeSub ⇒ Object
2147 2148 2149 2150 2151 2152 2153 2154 2155 |
# File 'lib/inform/verblibm.h.rb', line 2147 def DisrobeSub return if ObjectIsUntouchable(noun) return L__M(:Disrobe, 1, noun) if noun.hasnt? :worn take noun, :worn return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Disrobe, 3, noun) L__M(:Disrobe, 2, noun) end |
#DrinkSub ⇒ Object
2239 |
# File 'lib/inform/verblibm.h.rb', line 2239 def DrinkSub; L__M(:Drink, 1, noun); end |
#DropSub ⇒ Object
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 |
# File 'lib/inform/verblibm.h.rb', line 1404 def DropSub return L__M(:PutOn, 4) if noun == @player return L__M(:Drop, 1, noun) if noun.in? @player.parent return L__M(:Drop, 2, noun) if noun.notin? @player if noun.has? :worn L__M(:Drop, 3, noun) disrobe noun return true if noun.in?(@player) && noun.has?(:worn) end move noun, @player.parent return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Drop, 5, noun) return L__M(:Drop, 4, noun) end |
#EatSub ⇒ Object
2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 |
# File 'lib/inform/verblibm.h.rb', line 2169 def EatSub return if ObjectIsUntouchable(noun) return L__M(:Eat, 1, noun) if noun.hasnt? :edible if noun.has? :worn L__M(:Drop, 3, noun) _invoke :Disrobe, noun return true if noun.has?(:worn) && noun.in?(@player) end noun.destroy return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Eat, 3, noun) L__M(:Eat, 2, noun) end |
#EconomyVersion(o, j, depth, senc, stack_pointer = 0, c_style = @c_style, lt_value = @lt_value, listing_together = @listing_together, listing_size = @listing_size, wlf_indent = @wlf_indent, &query) ⇒ Object
def WriteListR
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 |
# File 'lib/inform/verblibm.h.rb', line 624 def EconomyVersion(o, j, depth, senc, stack_pointer = 0, c_style = @c_style, lt_value = @lt_value, listing_together = @listing_together, listing_size = @listing_size, wlf_indent = @wlf_indent, &query) n = j; i = 1; j = o loop do break unless i <= n if !j.list_together.nil? || (!lt_value.nil? && [2, 3].include?(ZRegion(j.list_together)) && j.list_together == mr) senc -= 1 end mr = j.list_together j = NextEntry(j, depth, lt_value, c_style, &query) i += 1; senc += 1 end i = 1; j = o; mr = nil loop do break unless i <= senc if !j.list_together.nil? || !lt_value.nil? if j.list_together == mr # Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) next end k = NextEntry(j, depth, lt_value, c_style, &query) if k.nil? || (k.list_together != j.list_together) # Omit_WL if WriteBeforeEntry(j, depth, i - senc, c_style, wlf_indent) == 1 # Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) i += 1 next end if (c_style & NOARTICLE_BIT) != 0 then print j.name else if (c_style & DEFART_BIT) != 0 then print the(j) else print a(j) end end WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) # label Omit_EL if (c_style & ENGLISH_BIT) != 0 print AND__TX if i == (senc - 1) print COMMA__TX if i < (senc - 1) end # label Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) i += 1 next end k = ZRegion(j.list_together) if [2, 3].include?(k) Print__Spaces(2 * (depth + wlf_indent)) if (c_style & INDENT_BIT) != 0 if k == 3 q = j; l = 0 loop do q = NextEntry(q, depth, lt_value, c_style, &query); l += 1 break if q.nil? || q.list_together != j.list_together end EnglishNumber(l); print " " print j.list_together print " (" if (c_style & ENGLISH_BIT) != 0 print ":\n" if (c_style & INDENT_BIT) != 0 end q = c_style if k != 3 @inventory_stage = 1 @parser_one = j; @parser_two = depth + wlf_indent if RunRoutines(j, :list_together) == 1 # Omit__Sublist new_line if (q & NEWLINE_BIT) != 0 && (c_style & NEWLINE_BIT) == 0 c_style = q mr = j.list_together # Omit_EL if (c_style & ENGLISH_BIT) != 0 print AND__TX if i == (senc - 1) print COMMA__TX if i < (senc - 1) end # Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) i += 1 next end end # if defined? TARGET_ZCODE # push lt_value; push listing_together; push listing_size # else # defined? TARGET_GLULX # copy lt_value, sp; copy listing_together, sp; copy listing_size, sp # end # # TARGET_ZCODE # lt_value = j.list_together; listing_together = j; wlf_indent += 1 WriteListR(j, depth, stack_pointer, c_style, lt_value = j.list_together, listing_together = j, listing_size, wlf_indent + 1, &query) # ; @wlf_indent -= 1 # if defined? TARGET_ZCODE # pull listing_size; pull listing_together; pull lt_value # else # defined? TARGET_GLULX # copy sp, listing_size; copy sp, listing_together; copy sp, lt_value # end # # TARGET_ZCODE if k == 3 print ")" if (q & ENGLISH_BIT) != 0 else @inventory_stage = 2 @parser_one = j; @parser_two = depth + wlf_indent RunRoutines(j, :list_together) end # label Omit__Sublist new_line if (q & NEWLINE_BIT) != 0 && (c_style & NEWLINE_BIT) == 0 c_style = q mr = j.list_together # Omit_EL if (c_style & ENGLISH_BIT) != 0 print AND__TX if i == (senc - 1) print COMMA__TX if i < (senc - 1) end # Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) i += 1 next end # if [2, 3].include?(k) end # if !j.list_together.nil? || !lt_value.nil? # label Omit_WL if WriteBeforeEntry(j, depth, i - senc, c_style, wlf_indent) == 1 # Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) i += 1 next end if (c_style & NOARTICLE_BIT) != 0 then print j.name else if (c_style & DEFART_BIT) != 0 then print the(j) else print a(j) end end WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) # label Omit_EL if (c_style & ENGLISH_BIT) != 0 print AND__TX if i == (senc - 1) print COMMA__TX if i < (senc - 1) end # label Omit_FL j = NextEntry(j, depth, lt_value, c_style, &query) i += 1 end # loop do break unless i <= senc end |
#EmptySub ⇒ Object
1515 |
# File 'lib/inform/verblibm.h.rb', line 1515 def EmptySub; @second = $d_obj; EmptyTSub(); end |
#EmptyTSub ⇒ Object
1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 |
# File 'lib/inform/verblibm.h.rb', line 1517 def EmptyTSub return L__M(:EmptyT, 4) if noun == second return if ObjectIsUntouchable(noun) return L__M(:EmptyT, 1, noun) if noun.hasnt? :container return L__M(:EmptyT, 2, noun) if noun.hasnt? :open if second != $d_obj # && second != parent(@player) if second.hasnt? :supporter return L__M(:EmptyT, 1, second) if second.hasnt? :container return L__M(:EmptyT, 2, second) if second.hasnt? :open end end i = child(noun); k = children(noun) return L__M(:EmptyT, 3, noun) unless i loop do break if i.nil? j = i.sibling flag = false flag = true if ObjectIsUntouchable(noun) flag = true if noun.hasnt? :container flag = true if noun.hasnt? :open if second != $d_obj if second.hasnt? :supporter flag = true if second.hasnt? :container flag = true if second.hasnt? :open end end flag = true if k == 0 k -= 1 break if flag print i + ": " unless @keep_silent _invoke :Transfer, i, second i = j end end |
#EnterSub ⇒ Object
Travelling around verbs
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 |
# File 'lib/inform/verblibm.h.rb', line 1581 def EnterSub # return go noun if noun.in?(Compass) || noun.has?(:door) # TODO: FIXME return invoke(:Go, noun) if noun.in?(Compass) || noun.has?(:door) return L__M(:Enter, 1, noun) if @player.in? noun return L__M(:Enter, 2, noun) if noun.hasnt? :enterable return L__M(:Enter, 3, noun) if noun.has?(:container) && noun.hasnt?(:open) if parent(@player) != parent(noun) ancestor = CommonAncestor(@player, noun) return L__M(:Enter, 4, noun) if ancestor == @player || ancestor.nil? loop do break if @player.in?(ancestor) j = parent(@player) k = @keep_silent if parent(j) != ancestor || noun != ancestor L__M(:Enter, 6, j) @keep_silent = true end _invoke :Exit @keep_silent = k return if @player.in?(j) end return if @player.in?(noun) if noun.notin?(ancestor) j = parent(noun) loop do break if parent(j) == ancestor j = parent(j) end L__M(:Enter, 7, j) _invoke :Enter, j return if @player.notin?(j) return invoke(:Enter, noun) end end move @player, noun return true if AfterRoutines() return true if @keep_silent Locale(noun) @player.publish L__M(:Enter, 8, noun) L__M(:Enter, 5, noun) end |
#ExamineSub ⇒ Object
2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 |
# File 'lib/inform/verblibm.h.rb', line 2010 def ExamineSub return L__M(:Examine, 1) if @location == thedark unless @keep_silent if noun.has? :animate @action = :LookAt if noun.in?(@player) @player.publish A(@player) + " looks at " + hisorher(@player, noun) + "." elsif noun != @player @player.publish A(@player) + " looks over at " + a(noun) + "." end else if noun.in?(@player) @player.publish A(@player) + " examines " + hisorher(@player, noun) + "." else @player.publish A(@player) + " examines " + a(noun) + "." end end end i = noun.description # if noun.values[:description].nil? && noun.properties[:description].nil? && noun.&(:description).nil? if i.nil? return _invoke :Search, noun if noun.has? :container if noun.has? :switchable then L__M(:Examine, 3, noun); return false; end return L__M(:Examine, 2, noun) end PrintOrRun(noun, :description) L__M(:Examine, 3, noun) if noun.has? :switchable return true if AfterRoutines() end |
#ExitSub ⇒ Object
1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 |
# File 'lib/inform/verblibm.h.rb', line 1631 def ExitSub parent_obj = parent(@player) return L__M(:Exit, 4, noun) if !noun.nil? && noun != parent_obj if parent_obj == @location || (@location == thedark && parent_obj == @real_location) if @location.&(:out_to) || (@location == thedark && @real_location.&(:out_to)) invoke :Go, $out_obj end return L__M(:Exit, 1) end return L__M(:Exit, 2, parent_obj) if parent_obj.has?(:container) && parent_obj.hasnt?(:open) move @player, parent(parent_obj) stand @player return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Exit, 5, parent_obj) L__M(:Exit, 3, parent_obj) LookSub(true) end |
#FillSub ⇒ Object
2241 |
# File 'lib/inform/verblibm.h.rb', line 2241 def FillSub; L__M(:Fill, 1, noun); end |
#FindVisibilityLevels ⇒ Object
1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 |
# File 'lib/inform/verblibm.h.rb', line 1872 def FindVisibilityLevels @visibility_levels = 1 @visibility_ceiling = parent(@player) loop do break unless parent(@visibility_ceiling) && (@visibility_ceiling.hasnt?(:container) || @visibility_ceiling.hasany?(:open, :transparent)) @visibility_ceiling = parent(@visibility_ceiling) @visibility_levels += 1 end @visibility_levels end |
#GetOffSub ⇒ Object
1626 1627 1628 1629 |
# File 'lib/inform/verblibm.h.rb', line 1626 def GetOffSub _invoke :Exit if parent(@player) == noun L__M(:GetOff, 1, noun) end |
#GiveRSub ⇒ Object
1566 |
# File 'lib/inform/verblibm.h.rb', line 1566 def GiveRSub; _invoke :Give, second, noun; end |
#GiveSub ⇒ Object
Gifts
1556 1557 1558 1559 1560 1561 1562 1563 1564 |
# File 'lib/inform/verblibm.h.rb', line 1556 def GiveSub return L__M(:Give, 1, noun) if parent(noun) != @player if second == @player @player.publish A(player) + " juggles " + a(noun) + " for a second or two." return L__M(:Give, 2, noun) end return false if RunLife(second, :Give) L__M(:Give, 3, second) end |
#GoInSub ⇒ Object
1654 |
# File 'lib/inform/verblibm.h.rb', line 1654 def GoInSub; go $in_obj; end |
#GonearSub ⇒ Object
2460 2461 2462 2463 2464 2465 2466 2467 2468 |
# File 'lib/inform/verblibm.h.rb', line 2460 def GonearSub raise Parser::VerbUnrecognized unless @player.builder? x = noun loop do break if parent(x).nil? x = parent(x) end PlayerTo(x) end |
#GoSub ⇒ Object
1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 |
# File 'lib/inform/verblibm.h.rb', line 1656 def GoSub i = @player.parent return RunTimeError(10) if i.nil? RunRoutines(@player, :before) # Attempt to allow for route recollection TODO: Evaluate if necessary # first, check if any PushDir object is touchable return if !second.nil? && !second.in?(Compass) && ObjectIsUntouchable(second) old_loc = @location movewith = nil if (@location != thedark && i != @location) || (@location == thedark && i != @real_location) j = @location @location = @real_location if @location == thedark k = RunRoutines(i, :before); @location = j if k != 3 if k movewith = i; i = i.parent else L__M(:Go,1,i) unless k return true end end return L__M(:Go, 6, noun) if noun.door_dir.nil? thedir = noun.door_dir j = i.&(thedir) return true if j == true if j && j.is_a?(String) then print j.to_s; new_line; return false; end unless j if i.respond_to?(:cant_go) && i.cant_go != CANTGO__TX then PrintOrRun(i, :cant_go) else L__M(:Go,2) end return false end if j.has? :door return L__M(:Go, 2) if j.has? :concealed if j.hasnt? :open return L__M(:Go, 3, j) if noun == $u_obj return L__M(:Go, 4, j) if noun == $d_obj return L__M(:Go, 5, j) end k = RunRoutines(j,:door_to) if k == false then return L__M(:Go, 6, j) end if k == true then return true end j = k end orig_loc = @real_location @player.publish L__M(:Go, 7, noun) unless @keep_silent if movewith.nil? then move @player, j else move movewith, j end light_adjusted @player # Special addition for ensuring location is never forgotten after player logout. @player.link :location, j @player.descendants.each do |o| o.link :location, j if o.linked? :location end movewith.link :location, j if !movewith.nil? && movewith.linked?(:location) @location = j; MoveFloatingObjects(); if OffersLight(j) @location = j; @real_location = j; @lightflag = true else if old_loc == thedark DarkToDark() return true if @deadflag end @real_location = j @location = thedark; @lightflag = false end @player.publish L__M(:Go, 8, ArrivalDir(j, orig_loc)) unless @keep_silent return true if AfterRoutines() return true if @keep_silent LookSub(true) end |
#GotoSub ⇒ Object
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 |
# File 'lib/inform/verblibm.h.rb', line 2448 def GotoSub raise Parser::VerbUnrecognized unless @player.builder? log.debug "<Goto noun> #=> #{noun}" if !noun.is_a?(Inform::Object) "[Not a safe place.]" elsif noun != @player PlayerTo(noun) else "Cannot go to there." end end |
#IndirectlyContains(o1, o2) ⇒ Object
1197 1198 1199 1200 1201 |
# File 'lib/inform/verblibm.h.rb', line 1197 def IndirectlyContains(o1, o2) return true if o1 == o2 # Does o1 indirectly contain o2? (Same as testing if their common ancestor is o1.) return o1.descendants.include?(o2) # TODO: FIXME end |
#InsertSub ⇒ Object
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 |
# File 'lib/inform/verblibm.h.rb', line 1461 def InsertSub @receive_action = :Insert return drop noun if second == $d_obj || @player.in?(second) return L__M(:Drop, 1, noun) if noun.parent == second return L__M(:Insert, 1, noun) if noun.parent != @player ancestor = CommonAncestor(noun, second) return L__M(:Insert, 5, noun) if ancestor == noun return if ObjectIsUntouchable(second) if second != ancestor @action = :Receive if RunRoutines(second, :before) then @action = :Insert; return true; end @action = :Insert if second.has?(:container) && second.hasnt?(:open) return L__M(:Insert, 3, second) end end return L__M(:Insert, 2, second) if second.hasnt? :container if noun.has? :worn L__M(:Insert, 6, noun); disrobe noun; return if noun.has? :worn end if children(second) >= ValueOrRun(second, :capacity) return L__M(:Insert, 7, second) end move noun, second return true if AfterRoutines() if second != ancestor @action = :Receive if RunRoutines(second, :after) then @action = :Insert; return true; end @action = :Insert end return true if @keep_silent @player.publish L__M(:Insert, 10, noun) return L__M(:Insert, 8, noun) if @multiflag L__M(:Insert, 9, noun) end |
#InvSub ⇒ Object
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 |
# File 'lib/inform/verblibm.h.rb', line 1159 def InvSub return L__M(:Inv, 1) unless child(@player) return InvTallSub() if @inventory_style.nil? L__M(:Inv, 2) if (@inventory_style & NEWLINE_BIT) != 0 then L__M(:Inv, 3) else print " " end WriteListFrom(child(@player), @inventory_style, 1) L__M(:Inv, 4) if (@inventory_style & ENGLISH_BIT) != 0 unless defined? MANUAL_PRONOUNS @player.objectloop { |x| PronounNotice(x) } end AfterRoutines() end |
#InvTallSub ⇒ Object
1154 1155 1156 1157 |
# File 'lib/inform/verblibm.h.rb', line 1154 def InvTallSub @inventory_style = NEWLINE_BIT + RECURSE_BIT + INDENT_BIT + FULLINV_BIT invoke :Inv end |
#InvWideSub ⇒ Object
Real verbs start here: Inventory
1149 1150 1151 1152 |
# File 'lib/inform/verblibm.h.rb', line 1149 def InvWideSub @inventory_style = ENGLISH_BIT + RECURSE_BIT + FULLINV_BIT invoke :Inv end |
#JumpOverSub ⇒ Object
2245 |
# File 'lib/inform/verblibm.h.rb', line 2245 def JumpOverSub; L__M(:JumpOver, 1, noun); end |
#JumpSub ⇒ Object
2243 |
# File 'lib/inform/verblibm.h.rb', line 2243 def JumpSub; L__M(:Jump, 1, noun); end |
#KissSub ⇒ Object
2247 2248 2249 2250 2251 2252 2253 |
# File 'lib/inform/verblibm.h.rb', line 2247 def KissSub return if ObjectIsUntouchable(noun) return false if RunLife(noun, :Kiss) return L__M(:Touch, 3, noun) if noun == @player # TODO: Publish a visible message L__M(:Kiss, 1, noun) end |
#ListenSub ⇒ Object
2255 |
# File 'lib/inform/verblibm.h.rb', line 2255 def ListenSub; L__M(:Listen, 1, noun); end |
#ListEqual(o1, o2, c_style = @c_style) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/inform/verblibm.h.rb', line 162 def ListEqual(o1, o2, c_style = @c_style) return false if child(o1) && WillRecurs(o1) return false if child(o2) && WillRecurs(o2) if c_style & (FULLINV_BIT + PARTINV_BIT) != 0 return false if (o1.hasnt?(:worn) && o2.has?(:worn)) || (o2.hasnt?(:worn) && o1.has?(:worn)) return false if (o1.hasnt?(:light) && o2.has?(:light)) || (o2.hasnt?(:light) && o1.has?(:light)) if o1.has?(:container) return false if o2.hasnt?(:container) return false if o1.has?(:open) && o2.hasnt?(:open) return false if o2.has?(:open) && o1.hasnt?(:open) elsif o2.has?(:container) return false end end return Identical(o1, o2) end |
#LMode1Sub ⇒ Object
Looking. LookSub(true) is allowed to abbreviate long descriptions, but
LookSub(false) (which is what happens when the Look action is generated)
isn't. (Except that these are over-ridden by the player-set lookmode.)
1844 |
# File 'lib/inform/verblibm.h.rb', line 1844 def LMode1Sub; @lookmode = 1; print Story; L__M(:LMode1); end |
#LMode2Sub ⇒ Object
Verbose
1846 |
# File 'lib/inform/verblibm.h.rb', line 1846 def LMode2Sub; @lookmode = 2; print Story; L__M(:LMode2); end |
#LMode3Sub ⇒ Object
Superbrief
1848 |
# File 'lib/inform/verblibm.h.rb', line 1848 def LMode3Sub; @lookmode = 3; print Story; L__M(:LMode3); end |
#Locale(descin, text1 = nil, text2 = nil, flag = false) ⇒ Object
1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 |
# File 'lib/inform/verblibm.h.rb', line 1772 def Locale(descin, text1 = nil, text2 = nil, flag = false) descin.each { |o| take o, :workflag } k = 0 n = 0 descin.each do |obj| # Only doing this because the player may no longer be concealed if # the player is to be visible to other players. next if obj == @player || obj.has?(:concealed) next unless obj.hasnt?(:concealed) && NotSupportingThePlayer(obj) unless defined? MANUAL_PRONOUNS PronounNotice(obj) end give obj, :workflag k += 1 property = :initial; f2 = 0 if obj.hasnt? :scenery if (obj.has?(:door) || obj.has?(:container)) && obj.has?(:open) && obj.respond_to?(:when_open) property = :when_open; f2 = 1 elsif (obj.has?(:door) || obj.has?(:container)) && obj.hasnt?(:open) && obj.respond_to?(:when_closed) property = :when_closed; f2 = 1 elsif obj.has?(:switchable) && obj.has?(:on) && obj.respond_to?(:when_on) property = :when_on; f2 = 1 elsif obj.has?(:switchable) && obj.hasnt?(:on) && obj.respond_to?(:when_off) property = :when_off; f2 = 1 end if obj.hasnt?(:moved) || obj.respond_to?(:describe) || f2 == 1 if obj.respond_to?(:describe) && RunRoutines(obj, :describe) flag = true take obj, :workflag; k -= 1 else j = obj.&property unless j.nil? new_line PrintOrRun(obj, property) flag = true take obj, :workflag; k -= 1 SayWhatsOn(obj) if obj.has?(:supporter) && !child(obj).nil? end end end elsif obj.has?(:supporter) && !child(obj).nil? SayWhatsOn(obj) end end # descin.each do return 0 if k == 0 if !text1.nil? && !text1.empty? new_line text1 = text2 if flag print text1 + " " WriteListFrom(child(descin), ENGLISH_BIT + RECURSE_BIT + PARTINV_BIT + TERSE_BIT + CONCEAL_BIT + WORKFLAG_BIT) return k + j end if flag then println L__M(:Look, 5, descin) else println L__M(:Look, 6, descin) end end |
#LockSub ⇒ Object
2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 |
# File 'lib/inform/verblibm.h.rb', line 2084 def LockSub return if ObjectIsUntouchable(noun) return L__M(:Lock, 1, noun) if noun.hasnt? :lockable return L__M(:Lock, 2, noun) if noun.has? :locked return L__M(:Lock, 3, noun) if noun.has? :open return L__M(:Lock, 4, second) if noun.&(:with_key) != second give noun, :locked return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Lock, 6, noun) L__M(:Lock, 5, noun) end |
#LookSub(allow_abbrev = nil) ⇒ Object
1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 |
# File 'lib/inform/verblibm.h.rb', line 1884 def LookSub(allow_abbrev = nil) allow_abbrev = false if allow_abbrev.nil? return RunTimeError(10) if parent(@player).nil? if OffersLight(@real_location) @location = @real_location; @lightflag = true else @location = thedark; @lightflag = false end if @location == thedark @visibility_levels = 0 @visibility_ceiling = thedark NoteArrival() else @visibility_levels = FindVisibilityLevels() if @visibility_ceiling == @location NoteArrival() if @visibility_ceiling != @location # TODO: Remove or figure this out. log.warn "Not sure why this would ever happen" return "The visibility ceiling is no longer the same as the " + "location. This is probably a very serious error." end end end # Printing the top line: e.g. # Octagonal Room (on the table) (as Frodo) new_line style :bold color :yellow if @visibility_levels == 0 print DARKNESS__TX else if @visibility_ceiling != @location then print The(@visibility_ceiling) else print name(@visibility_ceiling) end end uncolor :yellow unstyle :bold j = 1 i = @player.parent loop do break unless j < @visibility_levels if i.has?(:supporter) L__M(:Look, 1, i) else L__M(:Look, 2, i) end j += 1 i = i.parent end L__M(:Look, 3, @player) if @print_player_flag L__M(:Look, 9, @player) if @player.respond_to?(:builder?) && @player.builder? new_line # TODO: FIXME # if @location.outside? # # PrintOrRun(region, :description) if @player.prefers? :verbose_regions # # PrintOrRun(area, :description) if @player.prefers? :verbose_areas # end # The room description (if visible) if @lookmode < 3 && @visibility_ceiling == @location if allow_abbrev == false || @lookmode == 2 || !@player.visited.include?(@location) if @location.respond_to? :describe RunRoutines(@location, :describe) else if @location.respond_to?(:description) PrintOrRun(@location, :description) else RunTimeError(11, @location) end end end end nl_flag = true if @visibility_ceiling == @location if @visibility_levels == 0 Locale(thedark) else i = @player j = @visibility_levels loop do break unless j > 0 give i, :workflag i = parent(i) j -= 1 end j = @visibility_levels loop do break unless j > 0 k = 0 i = @player loop do break unless k < j i = parent(i) k += 1 end if i.respond_to? :inside_description if nl_flag new_line else nl_flag = true end PrintOrRun(i, :inside_description) end nl_flag = true if Locale(i) j -= 1 end end LookRoutine() ScoreArrival() @action = :Look return true if AfterRoutines() false end |
#LookUnderSub ⇒ Object
2040 2041 2042 2043 2044 |
# File 'lib/inform/verblibm.h.rb', line 2040 def LookUnderSub return L__M(:LookUnder, 1) if @location == thedark @player.publish L__M(:LookUnder, 3, noun) L__M(:LookUnder, 2) end |
#MildSub ⇒ Object
2257 |
# File 'lib/inform/verblibm.h.rb', line 2257 def MildSub; L__M(:Mild, 1, noun); end |
#MoveFloatingObjects ⇒ Object
A cunning routine (which could have been a daemon, but isn't, for the
sake of efficiency) to move objects which could be in many rooms about
so that the player never catches one not in place
982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 |
# File 'lib/inform/verblibm.h.rb', line 982 def MoveFloatingObjects return if @location.nil? || @location == @player flag = false objectloop do |i| address = i.&(:found_in) if !address.nil? && i.hasnt?(:absent) && !IndirectlyContains(player, i) if ZRegion(address) == 2 if !i.&(:found_in).nil? then move i, @location else remove i end else i.&(:found_in).each do |m| if m == @location || m.in?(@location) move i, @location if i.notin? @location flag = true end end remove i if flag == false && !parent(i).nil? end end end end |
#MovePlayer(direc) ⇒ Object
1024 |
# File 'lib/inform/verblibm.h.rb', line 1024 def MovePlayer(direc); _invoke :Go, direc; _invoke :Look; end |
#NextEntry(o, odepth, lt_value = @lt_value, c_style = @c_style, &_block) ⇒ Object
The WriteListFrom routine, a flexible object-lister taking care of
plurals, inventory information, various formats and so on. This is used
by everything in the library which ever wants to list anything.
If there were no objects to list, it prints nothing and returns false;
otherwise it returns true.
o is the object, and style is a bitmap, whose bits are given by:
143 144 145 146 147 148 149 150 151 152 |
# File 'lib/inform/verblibm.h.rb', line 143 def NextEntry(o, odepth, lt_value = @lt_value, c_style = @c_style, &_block) loop do o = o.sibling return nil if o.nil? next if lt_value == true && o.list_together != lt_value next if (c_style & WORKFLAG_BIT) != 0 && odepth == 0 && o.hasnt?(:workflag) next if (c_style & CONCEAL_BIT) != 0 && o.hasany?(:concealed, :scenery) return o end end |
#NoSub ⇒ Object
2259 |
# File 'lib/inform/verblibm.h.rb', line 2259 def NoSub; L__M(:No); end |
#NoteArrival ⇒ Object
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 |
# File 'lib/inform/verblibm.h.rb', line 1860 def NoteArrival if @location == thedark @lastdesc = thedark return end return if @location == @lastdesc PrintOrRun(@location, :initial) if @location.respond_to? :initial descin = @location NewRoom() @lastdesc = descin end |
#NotifyOffSub ⇒ Object
1092 |
# File 'lib/inform/verblibm.h.rb', line 1092 def NotifyOffSub; notify_mode = 0; L__M(:NotifyOff); end |
#NotifyOnSub ⇒ Object
1091 |
# File 'lib/inform/verblibm.h.rb', line 1091 def NotifyOnSub; notify_mode = 1; L__M(:NotifyOn); end |
#NotSupportingThePlayer(o) ⇒ Object
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 |
# File 'lib/inform/verblibm.h.rb', line 1761 def NotSupportingThePlayer(o) i = parent(@player) loop do break if i.nil? || i == @visibility_ceiling return false if i == o i = parent(i) return true if !i.nil? && i.hasnt?(:supporter) end true end |
#ObjectIsUntouchable(item, flag1 = nil, flag2 = nil, persona = nil) ⇒ Object
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
# File 'lib/inform/verblibm.h.rb', line 1212 def ObjectIsUntouchable(item, flag1 = nil, flag2 = nil, persona = nil) # Determine if there's any barrier preventing the player from moving # things to "item". Return false if no barrier; otherwise print a # suitable message and return true. # If flag1 is set, do not print any message. # If flag2 is set, also apply Take/Remove restrictions. # If persona is set, use that rather than the player. flag1 = @player if flag1.nil? flag2 = @player if flag2.nil? persona = @player if persona.nil? # If the item has been added to scope by something, it's first necessary # for that something to be touchable. ancestor = CommonAncestor(persona, item) if ancestor.nil? ancestor = item loop do break unless ancestor && (i = ObjectScopedBySomething(ancestor)).nil? ancestor = parent(ancestor) end unless i.nil? return false # return false if ObjectIsUntouchable(i, flag1, flag2) # TODO: FIXME # An item immediately added to scope end else # First, a barrier between the persona and the ancestor. The persona # can only be in a sequence of enterable objects, and only closed # containers form a barrier. if persona != ancestor i = parent(persona) loop do break unless i != ancestor if i.has?(:container) && i.hasnt?(:open) return true if flag1 return L__M(:Take, 9, i) end i = parent(i) end end # Second, a barrier between the item and the ancestor. The item can # be carried by someone, part of a piece of machinery, in or on top # of something and so on. if item != ancestor i = parent(item) loop do break unless !i.nil? && i != ancestor if flag2 && i.hasnt?(:container, :supporter) # && i.hasnt?(:supporter) if i.has?(:animate) return true if flag1 return L__M(:Take, 6, i) end if i.has?(:transparent) return true if flag1 return L__M(:Take, 7, i) end return true if flag1 return L__M(:Take, 8, item) end if !i.nil? && i.has?(:container) && i.hasnt?(:open) return true if flag1 return L__M(:Take, 9, i) end i = parent(i) end end end # if ancestor.nil? return false end |
#ObjectScopedBySomething(item) ⇒ Object
1203 1204 1205 1206 1207 1208 1209 1210 |
# File 'lib/inform/verblibm.h.rb', line 1203 def ObjectScopedBySomething(item) i = item; return false unless i Inform::Object.each do |j| next unless j.respond_to?(:add_to_scope) return j if j.add_to_scope.include?(j) end return false end |
#ObjectsSub ⇒ Object
59 |
# File 'lib/inform/VerbLib.h.rb', line 59 def ObjectsSub; Objects1Sub(); end |
#OpenSub ⇒ Object
2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 |
# File 'lib/inform/verblibm.h.rb', line 2119 def OpenSub return if ObjectIsUntouchable(noun) return L__M(:Open, 1, noun) if noun.hasnt? :openable return L__M(:Open, 2, noun) if noun.has? :locked return L__M(:Open, 3, noun) if noun.has? :open give noun, :open return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Open, 6, noun) if noun.has?(:container) && noun.hasnt?(:transparent) && @location != thedark && VisibleContents(noun) != 0 && IndirectlyContains(noun, @player) return L__M(:Open, 4, noun) end L__M(:Open,5,noun) end |
#Places1Sub ⇒ Object
1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
# File 'lib/inform/verblibm.h.rb', line 1094 def Places1Sub j = 0 k = 0 L__M(:Places, 1) objectloop { |i| j += 1 if i.has?(:visited) } objectloop do |i| if i.has? :visited print i.name; k += 1 if k == j then L__M(:Places, 2); return; end if k == j - 1 then print AND__TX else print COMMA__TX end end end end |
#PlacesSub ⇒ Object
60 |
# File 'lib/inform/VerbLib.h.rb', line 60 def PlacesSub; Places1Sub(); end |
#PlayerTo(newplace, flag = 0) ⇒ Object
Two little routines for moving the player safely.
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 |
# File 'lib/inform/verblibm.h.rb', line 1009 def PlayerTo(newplace, flag = 0) move @player, newplace loop do parent_newplace = parent(newplace) break if parent_newplace.nil? newplace = parent_newplace end @location = newplace @real_location = @location; MoveFloatingObjects() AdjustLight(true) _invoke :Look if flag == 0 if flag == 1 then NoteArrival(); ScoreArrival(); end LookSub(true) if flag == 2 end |
#PraySub ⇒ Object
2261 |
# File 'lib/inform/verblibm.h.rb', line 2261 def PraySub; L__M(:Pray, 1, noun); end |
#Print__Spaces(n) ⇒ Object
239 240 241 242 |
# File 'lib/inform/verblibm.h.rb', line 239 def Print__Spaces(n) return if n == 0 spaces n end |
#Print_ScL(obj) ⇒ Object
2470 |
# File 'lib/inform/verblibm.h.rb', line 2470 def Print_ScL(obj); println (@x_scope_count += 1) + ": " + a(obj) + " (" + obj.id + ")"; end |
#PullSub ⇒ Object
2263 2264 2265 2266 2267 2268 2269 2270 2271 |
# File 'lib/inform/verblibm.h.rb', line 2263 def PullSub return if ObjectIsUntouchable(noun) return L__M(:Pull, 1, noun) if noun.has? :static return L__M(:Pull, 2, noun) if noun.has? :scenery return L__M(:Pull, 4, noun) if noun.has? :animate return true if AfterRoutines() # TODO: Publish a visible message L__M(:Pull, 3, noun) end |
#PushDirSub ⇒ Object
2283 2284 2285 2286 |
# File 'lib/inform/verblibm.h.rb', line 2283 def PushDirSub return "You'll have to stand up first." if @player.hasany? :sitting, :kneeling, :prone L__M(:PushDir, 1, noun) end |
#PushSub ⇒ Object
2273 2274 2275 2276 2277 2278 2279 2280 2281 |
# File 'lib/inform/verblibm.h.rb', line 2273 def PushSub return if ObjectIsUntouchable(noun) return L__M(:Push, 1, noun) if noun.has? :static return L__M(:Push, 2, noun) if noun.has? :scenery return L__M(:Push, 4, noun) if noun.has? :animate return true if AfterRoutines() # TODO: Publish a visible message L__M(:Push, 3, noun) end |
#PutOnSub ⇒ Object
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 |
# File 'lib/inform/verblibm.h.rb', line 1420 def PutOnSub @receive_action = :PutOn # return drop noun end if second == $d_obj || @player.in?(second) # TODO: FIXME return invoke(:Drop, noun) if second == $d_obj || @player.in?(second) return L__M(:Drop, 1, noun) if parent(noun) == second return L__M(:PutOn, 1, noun) if parent(noun) != @player ancestor = CommonAncestor(noun, second) return L__M(:PutOn, 2, noun) if ancestor == noun return if ObjectIsUntouchable(second) if second != ancestor @action = :Receive if RunRoutines(second, :before) then @action = :PutOn; return; end @action = :PutOn end return L__M(:PutOn, 3, second) if second.hasnt? :supporter return L__M(:PutOn, 4) if ancestor == @player if noun.has? :worn L__M(:PutOn, 5, noun); disrobe noun; return if noun.has? :worn end if children(second) >= ValueOrRun(second, :capacity) return L__M(:PutOn, 6, second) end move noun, second return if AfterRoutines() if second != ancestor @action = :Receive if RunRoutines(second, :after) then @action = :PutOn; return true; end @action = :PutOn end return if @keep_silent @player.publish L__M(:PutOn, 9, noun) return L__M(:PutOn, 7) if @multiflag L__M(:PutOn, 8, noun) end |
#QuitSub ⇒ Object
TODO: How could this work in a non-blocking IO system? FIXME
1050 1051 1052 1053 |
# File 'lib/inform/verblibm.h.rb', line 1050 def QuitSub L__M(:Quit, 2) __quit if YesOrNo() end |
#RemoveSub ⇒ Object
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 |
# File 'lib/inform/verblibm.h.rb', line 1391 def RemoveSub i = parent(noun) return L__M(:Remove, 1, noun) if i.has?(:container) && i.hasnt?(:open) return L__M(:Remove, 2, noun) if i != second return L__M(:Take, 6, i) if i.has? :animate return true if AttemptToTakeObject(noun) @action = :Remove; return true if AfterRoutines() @action = :Take; return true if AfterRoutines() return true if @keep_silent second = i if second.nil? || i == @location # TODO: FIXME return L__M(:Remove, 3, noun) end |
#RestartSub ⇒ Object
1055 1056 1057 1058 |
# File 'lib/inform/verblibm.h.rb', line 1055 def RestartSub L__M(:Restart, 1) __restart if YesOrNo() end |
#RestoreSub ⇒ Object
1060 1061 1062 1063 |
# File 'lib/inform/verblibm.h.rb', line 1060 def RestoreSub return if self.respond_to?(:__restore) && __restore(self.method(:RMaybe)) L__M(:Restore, 1) end |
#RMaybe ⇒ Object
1065 1066 1067 |
# File 'lib/inform/verblibm.h.rb', line 1065 def RMaybe L__M(:Restore, 2) end |
#RubSub ⇒ Object
2288 |
# File 'lib/inform/verblibm.h.rb', line 2288 def RubSub; @player.publish L__M(:Rub, 2, noun); L__M(:Rub, 1, noun); end |
#RunTimeError(n, p1 = nil, p2 = nil) ⇒ Object
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 |
# File 'lib/inform/verblibm.h.rb', line 102 def RunTimeError(n, p1 = nil, p2 = nil) if defined? DEBUG print "** Library error #{n} (p1,p2) **\n** " case n when 1 then print "preposition not found (this should not occur)" when 2 then print "Property value not routine or string: \"#{p2}\" of \"#{p1}\"" + " (#{p1})"; when 3 then print "Entry in property list not routine or string: \"#{p2}\" list of \"#{p1}\"" + " (#{p1})" when 4 then print "Too many timers/daemons are active simultaneously. " + "The limit is the library constant MAX_TIMERS (currently #{MAX_TIMERS}) " + "and should be increased" when 5 then print "Object \"#{p1}\" has no \"time_left\" property" when 7 then print "The object \"#{p1}\" can only be used as a player object if it has " + "the \"number\" property" when 8 then print "Attempt to take random entry from an empty table array" when 9 then print "#{p1} is not a valid direction property number" when 10 then print "The player-object is outside the object tree" when 11 then print "The room \"#{p1}\" has no \"description\" property" when 12 then print "Tried to set a non-existent pronoun using SetPronoun" when 13 then print "A 'topic' token can only be followed by a preposition" else print "(unexplained)"; end " **" else "** Library error #{n} (#{p1},#{p2}) **" end end |
#SaveSub ⇒ Object
1069 1070 1071 1072 |
# File 'lib/inform/verblibm.h.rb', line 1069 def SaveSub return if self.respond_to?(:__save) && __save(self.method(:SMaybe)) L__M(:Save, 1) end |
#SayWhatsOn(descon) ⇒ Object
Describing the world. SayWhatsOn(object) does just that (producing
no text if nothing except possibly "scenery" and "concealed" items are).
Locale(object) runs through the "tail end" of a Look-style room
description for the contents of the object, printing up suitable
descriptions as it goes.
1754 1755 1756 1757 1758 1759 |
# File 'lib/inform/verblibm.h.rb', line 1754 def SayWhatsOn(descon) return false if descon == parent(@player) f = descon.any? { |j| j.hasnt?(:concealed) && j.hasnt?(:scenery) } return false unless f println L__M(:Look, 4, descon) end |
#ScopeSub ⇒ Object
2472 2473 2474 2475 2476 2477 |
# File 'lib/inform/verblibm.h.rb', line 2472 def ScopeSub raise Parser::VerbUnrecognized unless @player.admin? @x_scope_count = 0 LoopOverScope(method(:Print_ScL), noun) "Nothing is in scope." if @x_scope_count == 0 end |
#ScoreArrival ⇒ Object
1850 1851 1852 1853 1854 1855 1856 1857 1858 |
# File 'lib/inform/verblibm.h.rb', line 1850 def ScoreArrival # unless @player.visited.include?(@location) # @player.visited.push @location # if @location.has? :scored # score = score + ROOM_SCORE # places_score = places_score + ROOM_SCORE # end # end end |
#SearchSub ⇒ Object
2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 |
# File 'lib/inform/verblibm.h.rb', line 2050 def SearchSub return L__M(:Search, 1, noun) if @location == thedark return if ObjectIsUntouchable(noun) f = VisibleContents(noun) if noun.has? :supporter @player.publish L__M(:Search, 8, noun) unless @keep_silent return L__M(:Search, 2, noun) if f == 0 return L__M(:Search, 3, noun) end return L__M(:Search, 4, noun) if noun.hasnt? :container return L__M(:Search, 5, noun) if noun.hasnt?(:transparent) && noun.hasnt?(:open) return true if AfterRoutines() @player.publish L__M(:Search, 8, noun) unless @keep_silent return L__M(:Search, 6, noun) if f == 0 L__M(:Search, 7, noun) end |
#SetSub ⇒ Object
2290 |
# File 'lib/inform/verblibm.h.rb', line 2290 def SetSub; L__M(:Set, 1, noun); end |
#SetToSub ⇒ Object
2292 |
# File 'lib/inform/verblibm.h.rb', line 2292 def SetToSub; L__M(:SetTo, 1, noun); end |
#ShowRSub ⇒ Object
1575 |
# File 'lib/inform/verblibm.h.rb', line 1575 def ShowRSub; _invoke :Show, second, noun; end |
#ShowSub ⇒ Object
1568 1569 1570 1571 1572 1573 |
# File 'lib/inform/verblibm.h.rb', line 1568 def ShowSub return L__M(:Show, 1, noun) if parent(noun) != @player _invoke :Examine, noun if second == @player return false if RunLife(second, :Show) L__M(:Show, 2, second) end |
#SingSub ⇒ Object
2294 |
# File 'lib/inform/verblibm.h.rb', line 2294 def SingSub; @player.publish L__M(:Sing, 2, noun); L__M(:Sing, 1, noun); end |
#SleepSub ⇒ Object
2296 |
# File 'lib/inform/verblibm.h.rb', line 2296 def SleepSub; @player.publish L__M(:Sleep, 2, noun); L__M(:Sleep, 1, noun); end |
#SMaybe ⇒ Object
1074 1075 1076 |
# File 'lib/inform/verblibm.h.rb', line 1074 def SMaybe L__M(:Save, 2) end |
#SmellSub ⇒ Object
2298 |
# File 'lib/inform/verblibm.h.rb', line 2298 def SmellSub; @player.publish L__M(:Smell, 2, noun); L__M(:Smell, 1, noun); end |
#SorrySub ⇒ Object
2300 |
# File 'lib/inform/verblibm.h.rb', line 2300 def SorrySub; @player.publish L__M(:Sorry, 2, noun); L__M(:Sorry, 1, noun); end |
#SortOutList(obj) ⇒ Object
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 |
# File 'lib/inform/verblibm.h.rb', line 201 def SortOutList(obj) # print "\n\nSorting out list from " + obj.name + "\n " # i = child(@location) # loop do # break if i.nil? # print i.name + " --> " # i = sibling(i) # end # new_line catch :AP_SOL do i = obj loop do break if i.nil? k = i.list_together unless k.nil? i = sibling(i) loop do break if i.nil? || i.list_together != k i = sibling(i) end return false if i.nil? l = sibling(i) loop do break if l.nil? if l.list_together == k SortTogether(parent(obj), k) obj = parent(child(obj)) throw AP_SOL end l = sibling(l) end end i = sibling(i) end end # AP_SOL end |
#SortTogether(obj, value) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/inform/verblibm.h.rb', line 179 def SortTogether(obj, value) # println "Sorting together possessions of " + obj + " by value " + value # x = child(obj) # loop do # break if x.nil? # println the(x) + " no: " + x + " lt: " + x.list_together # x = sibling(x) # end a = [] # out b = [] # in while child(obj) if child(obj).list_together != value a << child(obj) else b << child(obj) end child(obj).delete end b.each { |o| move o, obj } # out a.each { |o| move o, obj } # in end |
#SqueezeSub ⇒ Object
2302 2303 2304 2305 2306 2307 |
# File 'lib/inform/verblibm.h.rb', line 2302 def SqueezeSub return if ObjectIsUntouchable(noun) if noun.has? :animate then return L__M(:Squeeze, 1, noun) end return true if AfterRoutines() L__M(:Squeeze, 2, noun) end |
#StrongSub ⇒ Object
2309 |
# File 'lib/inform/verblibm.h.rb', line 2309 def StrongSub; L__M(:Strong, 1, noun); end |
#SwimSub ⇒ Object
2311 |
# File 'lib/inform/verblibm.h.rb', line 2311 def SwimSub; L__M(:Swim, 1, noun); end |
#SwingSub ⇒ Object
2313 |
# File 'lib/inform/verblibm.h.rb', line 2313 def SwingSub; L__M(:Swing, 1, noun); end |
#SwitchoffSub ⇒ Object
2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 |
# File 'lib/inform/verblibm.h.rb', line 2108 def SwitchoffSub return if ObjectIsUntouchable(noun) return L__M(:SwitchOff, 1, noun) if noun.hasnt? :switchable return L__M(:SwitchOff, 2, noun) if noun.hasnt? :on take noun, :on return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:SwitchOff, 4, noun) L__M(:SwitchOff, 3, noun) end |
#SwitchonSub ⇒ Object
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 |
# File 'lib/inform/verblibm.h.rb', line 2097 def SwitchonSub return if ObjectIsUntouchable(noun) return L__M(:SwitchOn, 1, noun) if noun.hasnt? :switchable return L__M(:SwitchOn, 2, noun) if noun.has? :on give noun, :on return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:SwitchOn, 4, noun) L__M(:SwitchOn, 3, noun) end |
#TakeSub ⇒ Object
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 |
# File 'lib/inform/verblibm.h.rb', line 1380 def TakeSub i = parent(noun) if noun.notin?(@player) || !@onotheld_mode return true if AttemptToTakeObject(noun) end return true if AfterRoutines() @notheld_mode = @onotheld_mode return true if @notheld_mode || @keep_silent L__M(:Take, 1) end |
#task_done ⇒ Object
50 51 52 |
# File 'lib/inform/VerbLib.h.rb', line 50 def task_done TASK_DONE[:tasks] end |
#task_scores ⇒ Object
44 45 46 |
# File 'lib/inform/VerbLib.h.rb', line 44 def task_scores TASK_SCORES[:scores] end |
#TasteSub ⇒ Object
2315 |
# File 'lib/inform/verblibm.h.rb', line 2315 def TasteSub; L__M(:Taste, 1, noun); end |
#TellSub ⇒ Object
2317 2318 2319 2320 2321 |
# File 'lib/inform/verblibm.h.rb', line 2317 def TellSub return L__M(:Tell, 1, noun) if noun == @player return false if RunLife(noun, :Tell) L__M(:Tell, 2, noun) end |
#ThinkSub ⇒ Object
2323 2324 2325 2326 |
# File 'lib/inform/verblibm.h.rb', line 2323 def ThinkSub @player.publish L__M(:Think, 2, noun) L__M(:Think, 1, noun) end |
#ThrowAtSub ⇒ Object
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 |
# File 'lib/inform/verblibm.h.rb', line 2328 def ThrowAtSub return if ObjectIsUntouchable(noun) unless second.nil? @action = :ThrownAt if RunRoutines(second, :before) then @action = :ThrowAt; return true; end @action = :ThrowAt end if noun.has? :worn L__M(:Drop, 3, noun) disrobe noun return true if noun.has?(:worn) && noun.in?(@player) end unless second.nil? return L__M(:ThrowAt, 1) if second.hasnt? :animate return false if RunLife(second, :ThrowAt) end L__M(:ThrowAt, 2, noun) end |
#TieSub ⇒ Object
2347 |
# File 'lib/inform/verblibm.h.rb', line 2347 def TieSub; L__M(:Tie,1,noun); end |
#TouchSub ⇒ Object
2349 2350 2351 2352 2353 2354 2355 |
# File 'lib/inform/verblibm.h.rb', line 2349 def TouchSub return L__M(:Touch, 3, noun) if noun == @player return if ObjectIsUntouchable(noun) return L__M(:Touch, 1, noun) if noun.has? :animate @player.publish L__M(:Touch,4,noun) L__M(:Touch,2,noun) end |
#TransferSub ⇒ Object
Empties and transfers are routed through the actions above
1508 1509 1510 1511 1512 1513 |
# File 'lib/inform/verblibm.h.rb', line 1508 def TransferSub return if noun.notin?(@player) && AttemptToTakeObject(noun) invoke :PutOn, noun, second if second.has? :supporter invoke :Drop, noun if second == $d_obj invoke :Insert, noun, second end |
#TurnSub ⇒ Object
2357 2358 2359 2360 2361 2362 2363 |
# File 'lib/inform/verblibm.h.rb', line 2357 def TurnSub return if ObjectIsUntouchable(noun) return L__M(:Turn, 1, noun) if noun.has? :static return L__M(:Turn, 2, noun) if noun.has? :scenery return L__M(:Turn, 4, noun) if noun.has? :animate L__M(:Turn, 3, noun) end |
#UnlockSub ⇒ Object
2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 |
# File 'lib/inform/verblibm.h.rb', line 2072 def UnlockSub return if ObjectIsUntouchable(noun) return L__M(:Unlock, 1, noun) if noun.hasnt? :lockable return L__M(:Unlock, 2, noun) if noun.hasnt? :locked return L__M(:Unlock, 3, second) if noun.&(:with_key) != second take noun, :locked return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Unlock, 5, noun) L__M(:Unlock, 4, noun) end |
#VagueGoSub ⇒ Object
1652 |
# File 'lib/inform/verblibm.h.rb', line 1652 def VagueGoSub; L__M(:VagueGo); end |
#VerifySub ⇒ Object
1078 1079 1080 1081 |
# File 'lib/inform/verblibm.h.rb', line 1078 def VerifySub return if self.respond_to?(:__verify) && __verify(self.method(:Vmaybe)) Vwrong() end |
#VersionSub ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/inform/verblibm.h.rb', line 80 def VersionSub Banner() if standard_interpreter > 0 print "Standard interpreter " + (standard_interpreter / 256) + "." + (standard_interpreter % 256) + " (" + HDR_TERPNUMBER[0] if version_number == 6 print '.' + HDR_TERPVERSION[0] else print HDR_TERPVERSION[0] end print ") / " else print "Interpreter " + HDR_TERPNUMBER[0] + " Version " if version_number == 6 print HDR_TERPVERSION[0].to_s else print HDR_TERPVERSION[0] end print " / " end end |
#VisibleContents(o) ⇒ Object
2046 2047 2048 |
# File 'lib/inform/verblibm.h.rb', line 2046 def VisibleContents(o) o ? o.count { |i| i != @player && i.hasnt?(:concealed, :scenery) } : 0 end |
#Vmaybe ⇒ Object
1083 1084 1085 |
# File 'lib/inform/verblibm.h.rb', line 1083 def Vmaybe L__M(:Verify, 1) end |
#Vwrong ⇒ Object
1087 1088 1089 |
# File 'lib/inform/verblibm.h.rb', line 1087 def Vwrong L__M(:Verify, 2) end |
#WaitSub ⇒ Object
2365 2366 2367 2368 2369 |
# File 'lib/inform/verblibm.h.rb', line 2365 def WaitSub @player.publish L__M(:Wait, 2, noun) return true if AfterRoutines() L__M(:Wait, 1, noun) end |
#WakeOtherSub ⇒ Object
2373 2374 2375 2376 2377 |
# File 'lib/inform/verblibm.h.rb', line 2373 def WakeOtherSub return if ObjectIsUntouchable(noun) return false if RunLife(noun, :WakeOther) L__M(:WakeOther, 1, noun) end |
#WakeSub ⇒ Object
2371 |
# File 'lib/inform/verblibm.h.rb', line 2371 def WakeSub; L__M(:Wake, 1, noun); end |
#WaveHandsSub ⇒ Object
2385 2386 2387 2388 2389 2390 2391 2392 2393 |
# File 'lib/inform/verblibm.h.rb', line 2385 def WaveHandsSub if noun @player.publish L__M(:WaveHands, 4, noun) L__M(:WaveHands, 3, noun) else @player.publish L__M(:WaveHands, 2, noun) L__M(:WaveHands, 1, noun) end end |
#WaveSub ⇒ Object
2379 2380 2381 2382 2383 |
# File 'lib/inform/verblibm.h.rb', line 2379 def WaveSub return L__M(:Wave, 1, noun) if !noun.nil? && (noun.has?(:clothing, :worn) || noun.notin?(@player)) @player.publish L__M(:Wave, 3, noun) L__M(:Wave, 2, noun) end |
#WearSub ⇒ Object
2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 |
# File 'lib/inform/verblibm.h.rb', line 2157 def WearSub return if ObjectIsUntouchable(noun) return L__M(:Wear, 1, noun) if noun.hasnt? :clothing return L__M(:Wear, 2, noun) if noun.parent != @player return L__M(:Wear, 3, noun) if noun.has? :worn give noun, :worn return true if AfterRoutines() return true if @keep_silent @player.publish L__M(:Wear, 5, noun) L__M(:Wear, 4, noun) end |
#WillRecurs(o, c_style = @c_style) ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/inform/verblibm.h.rb', line 154 def WillRecurs(o, c_style = @c_style) return true if (c_style & ALWAYS_BIT) != 0 return false if (c_style & RECURSE_BIT) == 0 return true if o.hasany?(:transparent, :supporter) return true if o.has?(:open, :container) return false end |
#WriteAfterEntry(o, depth, stack_p, c_style = @c_style, _lt_value = @lt_value, _listing_together = @listing_together, _listing_size = @listing_size, &query) ⇒ Object
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 |
# File 'lib/inform/verblibm.h.rb', line 828 def WriteAfterEntry(o, depth, stack_p, c_style = @c_style, _lt_value = @lt_value, _listing_together = @listing_together, _listing_size = @listing_size, &query) recurse_flag = false parenth_flag = false eldest_child = nil child_count = 0 combo = nil j = false @inventory_stage = 2 if (c_style & PARTINV_BIT) == 1 # Begin the Inform6 Ruby Port addition if o.respond_to?(:invent) && RunRoutines(o, :invent) return true if (c_style & NEWLINE_BIT) == 0 print "" return end # End the Inform6 Ruby Port addition combo = 0 combo += 1 if o.has?(:light) && @location.hasnt?(:light) combo += 2 if o.has?(:container) && o.hasnt?(:open) if o.has?(:container) && (o.has?(:open) || o.has?(:transparent)) o.objectloop do |i| if i.hasnt?(:concealed) && i.hasnt?(:scenery) j = true; break end end combo += 4 if j.nil? end L__M(:ListMiscellany, combo, o) if combo > 0 end # end of PARTINV_BIT processing if (c_style & FULLINV_BIT) != 0 if o.respond_to?(:invent) && RunRoutines(o, :invent) return true if (c_style & NEWLINE_BIT) == 0 print "" return end if o.has?(:light) && o.has?(:worn) then L__M(:ListMiscellany, 8, o); parenth_flag = true else if o.has?(:light) then L__M(:ListMiscellany, 9, o); parenth_flag = true end if o.has?(:worn) then L__M(:ListMiscellany, 10, o); parenth_flag = true end end if o.has? :container if o.has? :openable if parenth_flag then print AND__TX else L__M(:ListMiscellany, 11, o) end if o.has? :open if child(o) then L__M(:ListMiscellany, 12, o) else L__M(:ListMiscellany, 13, o) end else if o.has?(:lockable) && o.has?(:locked) then L__M(:ListMiscellany, 15, o) else L__M(:ListMiscellany, 14, o) end end parenth_flag = true else if child(o) == 0 && o.has?(:transparent) if parenth_flag then L__M(:ListMiscellany, 16, o) else L__M(:ListMiscellany, 17, o) end end end end print ")" if parenth_flag end # end of FULLINV_BIT processing if (c_style & CONCEAL_BIT) != 0 child_count = 0 o.objectloop do |p| if p.hasnt?(:concealed) && p.hasnt?(:scenery) then child_count += 1; eldest_child = p; end end else child_count = children(o); eldest_child = child(o) end if child_count != 0 && (c_style & ALWAYS_BIT) != 0 L__M(:ListMiscellany, 18, o) if (c_style & ENGLISH_BIT) != 0 recurse_flag = true end if child_count != 0 && (c_style & RECURSE_BIT) != 0 if o.has? :supporter if (c_style & ENGLISH_BIT) != 0 if (c_style & TERSE_BIT) != 0 then L__M(:ListMiscellany, 19, o) else L__M(:ListMiscellany, 20, o) end if o.has? :animate then print WHOM__TX else print WHICH__TX end end recurse_flag = true end if o.has?(:container) && (o.has?(:open) || o.has?(:transparent)) if (c_style & ENGLISH_BIT) != 0 if (c_style & TERSE_BIT) != 0 then L__M(:ListMiscellany, 21, o) else L__M(:ListMiscellany, 22, o) end if o.has? :animate then print WHOM__TX else print WHICH__TX end end recurse_flag = true end end if recurse_flag && (c_style & ENGLISH_BIT) != 0 if child_count > 1 || (eldest_child && eldest_child.has?(:pluralname)) then print ARE2__TX else print IS2__TX end end new_line if (c_style & NEWLINE_BIT) != 0 return unless recurse_flag o = child(o) # if defined? TARGET_ZCODE # push lt_value; @push listing_together; @push listing_size # else # defined? TARGET_GLULX # copy lt_value, sp; copy listing_together, sp; copy listing_size, sp # end # # TARGET_ZCODE # @lt_value = 0; @listing_together = 0; @listing_size = 0 WriteListR(o, depth + 1, stack_p, c_style, lt_value = nil, listing_together = nil, listing_size = 0, &query) # if defined? TARGET_ZCODE # pull listing_size; pull listing_together; pull lt_value # else # defined? TARGET_GLULX # copy sp, listing_size; copy sp, listing_together; copy sp, lt_value # end # # TARGET_ZCODE print ")" if (c_style & TERSE_BIT) != 0 end |
#WriteBeforeEntry(o, depth, sentencepos, c_style = @c_style, wlf_indent = 0) ⇒ Object
end EconomyVersion (WriteListR)
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
# File 'lib/inform/verblibm.h.rb', line 810 def WriteBeforeEntry(o, depth, sentencepos, c_style = @c_style, wlf_indent = 0) flag = false @inventory_stage = 1 Print__Spaces(2 * (depth + wlf_indent)) if (c_style & INDENT_BIT) != 0 if o.respond_to?(:invent) && (c_style & (PARTINV_BIT | FULLINV_BIT)) != 0 # This line changed flag = PrintOrRun(o, :invent, 1) if flag if (c_style & ENGLISH_BIT) == 1 print AND__TX if sentencepos == -1 print COMMA__TX if sentencepos < -1 end new_line if (c_style & NEWLINE_BIT) == 1 end end flag end |
#WriteListFrom(o, style, depth = 0, &query) ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/inform/verblibm.h.rb', line 244 def WriteListFrom(o, style, depth = 0, &query) if o.nil? || parent(o).nil? || (!query.nil? && parent(o).none?(&query)) print NOTHING__TX new_line if style & NEWLINE_BIT != 0 return end if o == parent(child(o)) SortOutList(o) o = parent(child(o)) end # @c_style = style # @wlf_indent = 0 WriteListR(o, depth, stack_pointer = 0, c_style = style, &query) true end |
#WriteListR(o, depth, stack_pointer = 0, c_style = @c_style, lt_value = @lt_value, listing_together = @listing_together, listing_size = @listing_size, wlf_indent = @wlf_indent, &query) ⇒ Object
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 |
# File 'lib/inform/verblibm.h.rb', line 260 def WriteListR(o, depth, stack_pointer = 0, c_style = @c_style, lt_value = @lt_value, listing_together = @listing_together, listing_size = @listing_size, wlf_indent = @wlf_indent, &query) return if o.nil? || parent(o).nil? senc = 0 if depth > 0 && o == parent(child(o)) SortOutList(o) o = parent(child(o)) end loop do return false if o.nil? if (c_style & WORKFLAG_BIT) != 0 && depth == 0 && o.hasnt?(:workflag) o = o.sibling next end if (c_style & CONCEAL_BIT) != 0 && o.hasany?(:concealed, :scenery) o = o.sibling next end if o == @player || (!query.nil? && !query.call(o)) o = o.sibling next end break end classes_p = @match_classes.is_a?(Array) ? @match_classes.dup : [] sizes_p = @match_list.is_a?(Array) ? @match_list.dup : [] i = o; j = 0; k = 0 loop do break if i.nil? classes_p[j] = 0 k += 1 if i.&:plural i = NextEntry(i, depth, lt_value, c_style, &query) j += 1 end if (c_style & ISARE_BIT) != 0 if j == 1 && o.hasnt?(:pluralname) then print IS__TX else print ARE__TX end if (c_style & NEWLINE_BIT) != 0 then println ":" else print ' ' end c_style = c_style - ISARE_BIT end stack_pointer += (j + 1) if k < 2 # It takes two to plural return EconomyVersion(o, j, depth, senc, stack_pointer, c_style, lt_value, listing_together, listing_size, wlf_indent, &query) end n = 1; i = o; k = 0 loop do break if k >= j if classes_p[k] == 0 classes_p[k] = n; sizes_p[n] = 1 l = NextEntry(i, depth, lt_value, c_style, &query) m = k + 1 loop do break if l.nil? || m >= j if classes_p[m] == 0 && i.&(:plural) && l.&(:plural) if ListEqual(i, l) sizes_p[n] += 1 classes_p[m] = n end end l = NextEntry(l, depth, lt_value, c_style, &query) m += 1 end n += 1 end i = NextEntry(i, depth, lt_value, c_style, &query) k += 1 end n -= 1 i = 1; j = o; k = 0 loop do break if i > n loop do break if (classes_p[k] == i) || (classes_p[k] == -i) k += 1; j = NextEntry(j, depth, lt_value, c_style, &query) end m = sizes_p[i] if j.nil? then mr = nil else if !j.list_together.nil? || (!lt_value.nil? && [2, 3].include?(ZRegion(j.list_together)) && j.list_together == mr) senc -= 1 end mr = j.list_together end i += 1 senc += 1 end senc -= 1 i = 1; j = o; k = 0; mr = nil loop do break if senc < 0 loop do break if (classes_p[k] == i) || (classes_p[k] == -i) k += 1; j = NextEntry(j, depth, lt_value, c_style, &query) end if j.nil? # TODO: FIXME and remove log.warn "classes_p: #{classes_p.inspect}" log.warn "classes_p k: #{k}, i: #{i}" log.warn "FIXME: Too many entries in classes_p" break end if !j.list_together.nil? || !lt_value.nil? if j.list_together == mr # Omit_FL2 i += 1 next end k2 = NextEntry(j, depth, lt_value, c_style, &query) if k2.nil? || k2.list_together != j.list_together # Omit_WL2 if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == 1 # Omit_FL2 i += 1 senc -= 1 next end if sizes_p[i] == 1 if (c_style & NOARTICLE_BIT) != 0 then print j.name else if (c_style & DEFART_BIT) != 0 then print the(j) else print a(j) end end else PrefaceByArticle(j, 1, sizes_p[i]) if (c_style & DEFART_BIT) != 0 print number(sizes_p[i]) + " " PrintOrRun(j, :plural, 1) end if sizes_p[i] > 1 && j.hasnt?(:pluralname) give j, :pluralname WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) take j, :pluralname else WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) end # Omit_EL2 if (c_style & ENGLISH_BIT) != 0 print AND__TX if senc == 1 print COMMA__TX if senc > 1 end # Omit_FL2 i += 1; senc -= 1 next end k2 = ZRegion(j.list_together) if [2, 3].include?(k2) q = j; listing_size = 1; l = k; m = i loop do break unless m < n && q.list_together == j.list_together m += 1 loop do break unless (classes_p[l] != m) && (classes_p[l] != -m) l += 1; q = NextEntry(q, depth, lt_value, c_style, &query) end listing_size += 1 if q.list_together == j.list_together end # print " [" + listing_size.to_s + "] " if listing_size == 1 # Omit_WL2 if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == 1 # Omit_FL2 i += 1; senc -= 1 next end if sizes_p[i] == 1 if (c_style & NOARTICLE_BIT) != 0 then print j.name else if (c_style & DEFART_BIT) != 0 then print the(j) else print a(j) end end else PrefaceByArticle(j, 1, sizes_p[i]) if (c_style & DEFART_BIT) != 0 print number(sizes_p[i]) + " " PrintOrRun(j, :plural, 1) end if sizes_p[i] > 1 && j.hasnt?(:pluralname) give j, :pluralname WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) take j, :pluralname else WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) end # Omit_EL2 if (c_style & ENGLISH_BIT) != 0 print AND__TX if senc == 1 print COMMA__TX if senc > 1 end # Omit_FL2 i += 1; senc -= 1 end Print__Spaces(2 * (depth + wlf_indent)) if (c_style & INDENT_BIT) != 0 if k2 == 3 q = 0 listing_size.times { |l2| q += sizes_p[l2 + i] } EnglishNumber(q); print " " print j.list_together print " (" if (c_style & ENGLISH_BIT) != 0 println ":" if (c_style & INDENT_BIT) != 0 end q = c_style if k2 != 3 @inventory_stage = 1 @parser_one = j; @parser_two = depth + wlf_indent if RunRoutines(j, :list_together) == 1 # Omit__Sublist2 new_line if (q & NEWLINE_BIT) != 0 && (c_style & NEWLINE_BIT) == 0 c_style = q mr = j.list_together # Omit_EL2 if (c_style & ENGLISH_BIT) != 0 print AND__TX if senc == 1 print COMMA__TX if senc > 1 end i += 1; senc -= 1 next end end # if defined? TARGET_ZCODE # push lt_value; push listing_together; push listing_size; # else # TARGET_GLULX # copy lt_value, sp; copy listing_together, sp; copy listing_size, sp # end # # defined? TARGET_GLULX # @lt_value = j.list_together; @listing_together = j; @wlf_indent += 1 WriteListR(j, depth, stack_pointer, c_style, lt_value = j.list_together, listing_together = j, listing_size, wlf_indent + 1, &query) # ; @wlf_indent -= 1 # if defined? TARGET_ZCODE # pull listing_size; pull listing_together; pull lt_value # else # TARGET_GLULX # copy sp, listing_size # copy sp, listing_together # copy sp, lt_value # end # # TARGET_ZCODE if k2 == 3 print ")" if (q & ENGLISH_BIT) != 0 else @inventory_stage = 2 @parser_one = j; @parser_two = depth + wlf_indent RunRoutines(j, :list_together) end # label Omit__Sublist2 new_line if (q & NEWLINE_BIT) != 0 && (c_style & NEWLINE_BIT) == 0 c_style = q mr = j.list_together # Omit_EL2 if (c_style & ENGLISH_BIT) != 0 print AND__TX if senc == 1 print COMMA__TX if senc > 1 end i += 1; senc -= 1 next end end # if !j.list_together.nil? || !lt_value.nil? # label Omit_WL2 if WriteBeforeEntry(j, depth, -senc, c_style, wlf_indent) == 1 # Omit_FL2 i += 1; senc -= 1 next end if sizes_p[i] == 1 if (c_style & NOARTICLE_BIT) != 0 then print j.name else if (c_style & DEFART_BIT) != 0 then print the(j) else print a(j) end end else PrefaceByArticle(j, 1, sizes_p[i]) if (c_style & DEFART_BIT) != 0 print number(sizes_p[i]) + " " PrintOrRun(j, :plural, 1) end if sizes_p[i] > 1 && j.hasnt?(:pluralname) give j, :pluralname WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) take j, :pluralname else WriteAfterEntry(j, depth, stack_pointer, c_style, lt_value, listing_together, listing_size) end # label Omit_EL2 if (c_style & ENGLISH_BIT) != 0 print AND__TX if senc == 1 print COMMA__TX if senc > 1 end # label Omit_FL2 i += 1; senc -= 1 end # loop return true end |
#XAbstractSub ⇒ Object
2414 2415 2416 2417 2418 |
# File 'lib/inform/verblibm.h.rb', line 2414 def XAbstractSub return if XTestMove(noun, second) move noun, second "[Abstracted.]" end |
#XObj(obj, f = 0) ⇒ Object
2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 |
# File 'lib/inform/verblibm.h.rb', line 2426 def XObj(obj, f = 0) if parent(obj) then print a(obj) else print obj end print " (#{obj.id}) " print "(in #{parent(obj)} #{parent(obj).id})" if f == 1 && parent(obj) new_line return true if child(obj).nil? if obj.is_a?(Class) WriteListFrom(child(obj), NEWLINE_BIT + INDENT_BIT + ALWAYS_BIT + NOARTICLE_BIT, 1) else WriteListFrom(child(obj), NEWLINE_BIT + INDENT_BIT + ALWAYS_BIT + FULLINV_BIT, 1) end new_line end |
#XPurloinSub ⇒ Object
2420 2421 2422 2423 2424 |
# File 'lib/inform/verblibm.h.rb', line 2420 def XPurloinSub return if XTestMove(noun, player) move noun, player; give noun, :moved; take noun, :concealed "[Purloined.]" end |
#XTestMove(obj, dest) ⇒ Object
Debugging verbs
2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 |
# File 'lib/inform/verblibm.h.rb', line 2401 def XTestMove(obj, dest) if obj.is_a?(InformLibrary) || obj == LibraryMessages || obj.is_a?(Inform::Ephemeral::Object) println "[Can't move #{obj.name}: it's a system object.]" return true end loop do break if dest.nil? println "[Can't move #{obj.name}: it would contain itself.]" if dest == obj dest = parent(dest) end false end |
#XTreeSub ⇒ Object
2440 2441 2442 2443 2444 2445 2446 |
# File 'lib/inform/verblibm.h.rb', line 2440 def XTreeSub raise Parser::VerbUnrecognized unless @player.builder? return XObj(noun, 1) unless noun.nil? objectloop { |i| XObj(i) if i.object? && parent(i).nil? } end |
#YesOrNo ⇒ Object
TODO: Figure out how this could work in a non-blocking IO system. FIXME The read method would have to create an evented future promise or something. That seems like it would cause this code to block on the read command, and avoiding such blocking behavior was the entire point of using Netty.
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 |
# File 'lib/inform/verblibm.h.rb', line 1035 def YesOrNo loop do @input = __read DrawStatusLine() if !location.nil? && !parent(@player).nil? j = @input unless @input.empty? # at least one word entered i = @input.split.first return true if [YES1__WD, YES2__WD, YES3__WD].include?(i) return false if [NO1__WD, NO2__WD, NO3__WD].include?(i) end L__M(:Quit, 1); print "> " end end |
#YesSub ⇒ Object
2395 |
# File 'lib/inform/verblibm.h.rb', line 2395 def YesSub; L__M(:Yes); end |