home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / DNDOOR45.ZIP / DNDS5.BAS < prev    next >
BASIC Source File  |  2000-04-28  |  108KB  |  2,180 lines

  1.  Rem * Filename: dnds5.bas  Version: v4.5 r1.0
  2.  Rem * This subprogram contains all container, bank, and some display
  3.  Rem * and main routines.
  4.  
  5.  Rem $Include: 'dnddoor.inc'
  6.  
  7.  Rem * routine to search player and room containers for parameter name
  8.  Rem * input variables:
  9.  Rem *   Parsed.Command1 - name of container.
  10.  Rem * output variables:
  11.  Rem *   Index.Number - true if container name found.
  12.  Rem *   Type.Number - 0 for container in inventory, 1 for container in room.
  13.  
  14. Sub Examine.Container
  15.  On Local Error Resume Next ' local error resume
  16.  Type.Number=False ' store container flag
  17.  Call Check.Inventory.Container ' search player inventory containers
  18.  If Index.Number=False Then ' check player container found
  19.     Call Num ' decrement counters
  20.     Type.Number=1 ' store container flag
  21.     Call Check.Room.Container ' search room inventory containers
  22.  Endif ' end check player container found
  23. End Sub ' end routine to search inventory for container name
  24.  
  25.  Rem * routine to remove an item from player inventory and add to a container.
  26.  
  27. Sub Drop.Into.Container
  28.  On Local Error Resume Next ' local error resume
  29.  Call Parse ' get first parameter
  30.  Call Numeric ' parse parameter number from # sign
  31.  Call Check.Inventory.Treasure ' search for inventory to drop
  32.  If Index.Number=False Then ' index to treasure file not found
  33.     Outpt="You can't drop that!" ' message
  34.     Call IO.O ' send output
  35.     Exit Sub ' return from routine
  36.  Endif ' end check treasure index
  37.  Item.Number=Array.Number ' store treasure index to array
  38.  Item.Charges=Charges.Number ' store treasure charges
  39.  Item.Index=Index.Number ' store treasure index to file
  40.  Parsed.Command1=Parsed.Command2 ' get second parameter
  41.  Call Numeric ' parse parameter number from # sign
  42.  Call Examine.Container ' check player inventory and room for container
  43.  If Index.Number=False Then ' index to treasure file not found
  44.     Outpt="You can't drop that!" ' message
  45.     Call IO.O ' send output
  46.     Exit Sub ' return from routine
  47.  Endif ' end check index
  48.  If ContainerRec.Locked>False Then ' check container locked
  49.     Outpt="You can't, it's locked!" ' message
  50.     Call IO.O ' send output
  51.     Exit Sub ' return from routine
  52.  Endif ' end check container
  53.  If ContainerRec.Closed>False Then ' check container closed
  54.     Outpt="You can't, it's closed!" ' message
  55.     Call IO.O ' send output
  56.     Exit Sub ' return from routine
  57.  Endif ' end check container
  58.  Container.Number=Array.Number ' store index of inventory array of container
  59.  For Array.Counter=1 To 5 ' loop through container elements
  60.     ' find empty container element
  61.     If ContainerRec.Inventory(Array.Counter)=False Then
  62.        Container.Name$=ContainerRec.ContainerName ' store container name
  63.        Container.Name$=Rtrim$(Container.Name$) ' strip trailing blanks
  64.        If Last.Command.Number=Hide.Command Then ' last command was hide
  65.           ' set container record hide flag
  66.           ContainerRec.Invisible(Array.Counter)=True
  67.        Else ' not hide
  68.           ' set container record hide
  69.           ContainerRec.Invisible(Array.Counter)=False
  70.        Endif ' end check last command
  71.        ' store container record index
  72.        ContainerRec.Inventory(Array.Counter)=Item.Index
  73.        ' store container record charges
  74.        ContainerRec.Charges(Array.Counter)=Item.Charges
  75.        ' store container treasure name mnemonic
  76.        ContainerRec.TreasureName(Array.Counter)=TreasureRecord.ShortName
  77.        Select Case Type.Number ' select room or inventory
  78.        Case 1 ' drop item into container in room
  79.           RoomRecord.Container=ContainerRec ' set room container record
  80.           Call Share.Room.Record(Room) ' put room record
  81.        Case 0 ' dropped item in container in player inventory
  82.           ' update player container
  83.           UserRecord.Container(Container.Number)=ContainerRec
  84.        End Select ' end select container drop
  85.        Outpts=TreasureRecord.TreasureName ' store name of treasure dropped
  86.        Outpts=Rtrim$(Outpts) ' strip trailing blanks
  87.        If Last.Command.Number=Hide.Command Then ' last command hide
  88.           Inpt=" hide " ' set equal to hide
  89.        Else ' not hide
  90.           Inpt=" drop " ' set equal to drop
  91.        Endif ' end check last command
  92.        Outpt="You"+Inpt+Outpts+" in "+Container.Name$+"!" ' format message
  93.        Call IO.O ' send output
  94.        Call Discard.Inventory(Item.Number,True) ' remove item from inventory
  95.        Exit Sub ' return from routine
  96.     Endif ' end check empty container record
  97.  Next ' loop through container records
  98.  Outpt="You can't, it's full!" ' message
  99.  Call IO.O ' send output
  100. End Sub ' end drop into container routine
  101.  
  102.  Rem * routine to take an item of treasure from a container and add to
  103.  Rem * the player inventory.
  104.  
  105. Sub Take.From.Container
  106.  On Local Error Resume Next ' local error resume
  107.  Call ParseX ' parse second parameter
  108.  Call Numeric ' parse parameter number from # sign
  109.  Call Examine.Container ' check container mnemonic
  110.  If Index.Number=False Then ' cmopare treasure index
  111.     Outpt="You can't get that!" ' make message
  112.     Call IO.O ' send message
  113.     Exit Sub ' exit routine
  114.  Endif ' end compare container index
  115.  If ContainerRec.Locked>False Then ' check container locked
  116.     Outpt="You can't, it's locked!" ' message
  117.     Call IO.O ' send message
  118.     Exit Sub ' exit routine
  119.  Endif ' end check container locked
  120.  If ContainerRec.Closed>False Then ' check container closed
  121.     Outpt="You can't, it's closed!" ' message
  122.     Call IO.O ' send message
  123.     Exit Sub ' exit routine
  124.  Endif ' end check container closed
  125.  Container.Number=Array.Number ' store container index of player inventory
  126.  Container.Name$=ContainerRec.ContainerName ' store container name
  127.  Container.Name$=Rtrim$(Container.Name$) ' edit container name
  128.  Parsed.Command1=Parsed.Command2 ' get first parameter
  129.  Call Numeric ' parse parameter number from # sign
  130.  Item.Counter=False ' parsed number counter
  131.  For Array.Counter=1 To 5 ' loop through all container treasure
  132.     ' get treasure name from container
  133.     Inpt=ContainerRec.TreasureName(Array.Counter)
  134.     Inpt=Left$(Inpt,Len(Parsed.Command1)) ' truncate container treasure name
  135.     If Inpt=Parsed.Command1 Then ' compare to treasure to take
  136.        Item.Counter=Item.Counter+1 ' increment parsed counter
  137.        ' compare to parameter number
  138.        If Parse.Number=False Or Item.Counter=Parse.Number Then
  139.           ' get treasure charges
  140.           Charges.Number=ContainerRec.Charges(Array.Counter)
  141.           ' get treasure number
  142.           Index.Number=ContainerRec.Inventory(Array.Counter)
  143.           Call Read.Record(TreasureFile,Index.Number) ' get treasure record
  144.           Outpts=TreasureRecord.TreasureName ' format treasure name
  145.           Outpts=Rtrim$(Outpts) ' trim name
  146.           ' compute weight player carrying
  147.           New.Weight#=Cdbl(Int(Weight+TreasureRecord.Weight))
  148.           If New.Weight#>MaxInt Then ' check maximum integer
  149.              New.Weight#=MaxInt ' reduce to maximum integer
  150.           Endif ' end check maximum integer
  151.           Total.Weight#=Cdbl(UserRecord.Stats(1)) ' store player strength
  152.           Total.Weight#=Total.Weight#*100 ' multiply weight player can carry
  153.           If New.Weight#>Total.Weight# Then ' compare wieght player can carry
  154.              Outpt="You can't carry any more!" ' weight and make message
  155.              Call IO.O ' send message
  156.              Exit Sub ' exit routine
  157.           Endif ' end compare weight
  158.           ' add treasure to inventory
  159.           Call Add.Inventory(Index.Number,Charges.Number,Item.Added)
  160.           If Item.Added Then ' flag set to add
  161.              Call Clear.Container(Array.Counter,False) ' clear container item
  162.              Select Case Type.Number ' select room or inventory
  163.              Case 1 ' flag indicating container in room or inventory
  164.                 RoomRecord.Container=ContainerRec ' set room container record
  165.                 Call Share.Room.Record(Room) ' write room record
  166.              Case 0 ' flag indicates player record
  167.                 ' update player container
  168.                 UserRecord.Container(Container.Number)=ContainerRec
  169.              End Select ' end compare room or inventory
  170.              Outpt="You take "+Outpts+" from "+Container.Name$+"!" ' message
  171.              Call IO.O ' send message
  172.              Exit Sub ' exit routine
  173.           Endif ' end compare add flag
  174.        Endif ' end compare parsed number
  175.     Endif ' end compare treasure name
  176.  Next ' end loop through player container inventory
  177.  Outpt="You can't get that!" ' make message
  178.  Call IO.O ' send message
  179. End Sub ' end take from container routine
  180.  
  181.  Rem * sets container elements to zero.
  182.  Rem * input variables:
  183.  Rem *   Item.Number - container item to clear.
  184.  Rem *   Clear.Items - true to clear container, false to clear container item.
  185.  
  186. Sub Clear.Container(Item.Number,Clear.Items)
  187.  On Local Error Resume Next ' local error resume
  188.  If Clear.Items=False Then ' passed parameter to clear one container item 
  189.     ContainerRec.Charges(Item.Number)=False ' container element to zero
  190.     ContainerRec.Inventory(Item.Number)=False ' container element to zero
  191.     ContainerRec.Invisible(Item.Number)=False ' container element to zero
  192.     ContainerRec.TreasureName(Item.Number)=Nul ' container element to zero
  193.  Else ' passed parameter to clear entire container
  194.     ContainerRec.Closed=False ' container to zero
  195.     ContainerRec.ContainerName=Nul ' container to zero
  196.     ContainerRec.Keyed=False ' container to zero
  197.     ContainerRec.Locked=False ' container to zero
  198.     ContainerRec.ShortName=Nul ' container to zero
  199.     For Container.Item=1 To 5 ' loop through all container elements
  200.        ContainerRec.Inventory(Container.Item)=False ' reset container element
  201.        ContainerRec.Charges(Container.Item)=False ' reset container element
  202.        ContainerRec.Invisible(Container.Item)=False ' reset container element
  203.        ContainerRec.TreasureName(Container.Item)=Nul ' reset container element
  204.     Next ' end loop all container elements
  205.  Endif ' end passed parameter
  206. End Sub ' end routine to clear container
  207.  
  208.  Rem * routine to display container information.
  209.  Rem * input variables:
  210.  Rem *   ContainerRec - container record to display.
  211.  Rem *   Type.Number - item is in room/inventory.
  212.  
  213. Sub Show.Container
  214.  On Local Error Resume Next ' local error resume
  215.  If Type.Number Then ' container in room
  216.     Prefix1="It's " ' format prefix
  217.  Else ' container in inventory
  218.     Prefix1="You are carrying " ' format prefix
  219.  Endif ' end container check
  220.  Graphics.Off=True ' reset color
  221.  Outpt=Prefix1+Rtrim$(ContainerRec.ContainerName) ' make container name
  222.  If ContainerRec.Keyed Then ' check container has a lock number
  223.     Outpt=Outpt+"(#"+Right$(Str$(ContainerRec.Keyed+100000!),5)+")"
  224.  Endif ' end append container lock number
  225.  Outpt=Outpt+"." ' append to message
  226.  Call IO.O ' send message of container name
  227.  If ContainerRec.Locked>False Then ' verify container is locked
  228.     Outpt="It's locked." ' make message
  229.     Call IO.O ' send output
  230.     Exit Sub ' exit routine
  231.  Endif ' end verify locked container
  232.  If ContainerRec.Closed>False Then ' verify container is closed
  233.     Outpt="It's closed." ' make message
  234.     Call IO.O ' send output
  235.     Exit Sub ' exit routine
  236.  Endif ' end verify closed container
  237.  Outpt="It contains the following treasure:" ' message
  238.  Call IO.O ' send prefix message
  239.  Container.Count=False ' reset number of container items displayed
  240.  Outpt=Nul ' reset message of container item
  241.  For Array.Index=1 To 5 ' loop through all container items
  242.     ' store container invisibility flag
  243.     Invisible.Container=ContainerRec.Invisible(Array.Index)
  244.     ' store container inventory number
  245.     Container.Number=ContainerRec.Inventory(Array.Index)
  246.     Display.Item=True ' reset flag to display container item
  247.     If Container.Number Then ' check container item
  248.        If Invisible.Container=True Then ' verify item is invisible
  249.           If Normal.User Then ' determine non DM
  250.              Display.Item=False ' set flag not to display item
  251.           Endif ' end normal user
  252.        Endif ' end invisible item
  253.        If Display.Item=True Then ' check flag to display item
  254.           Carriage.Return=True ' set flag to disable return/linefeed
  255.           Call IO.O ' send message of previous item
  256.           ' get treasure record of container item
  257.           Call Read.Record(TreasureFile,Container.Number)
  258.           Outpts=TreasureRecord.TreasureName ' store treasure name
  259.           Outpts=Rtrim$(Outpts) ' trim name
  260.           If Invisible.Container=True Then ' compare invisible item
  261.              Outpts=Outpts+"[inv]" ' sppend invisible message
  262.           Endif ' end compare invisible
  263.           Outpt=Outpts+", " ' append comma to item name
  264.           ' increment number of items displayed
  265.           Container.Count=Container.Count+1
  266.           If Container.Count=1 Then ' check if first item displayed
  267.              Mid$(Outpt,1,1)=Ucase$(Mid$(Outpt,1,1)) ' uppercase first item
  268.           Endif ' end compare to first item
  269.        Endif ' end check display flag
  270.     Endif ' end check container item
  271.  Next ' end loop through all five items
  272.  If Container.Count=False Then ' check if any container items displayed
  273.     Outpt="Nothing at all." ' make message
  274.  Else ' check any container items displayed
  275.     Outpt=Left$(Outpt,Len(Outpt)-2)+"." ' trim comma, append period
  276.     If Container.Count>1 Then ' more than one item displayed
  277.        Outpt="and "+Outpt ' append to message
  278.     Endif ' end check item number
  279.  Endif ' end check item number
  280.  Call IO.O ' send message of last contaier item
  281.  Graphics.Off=False ' reset color
  282. End Sub ' end routine to display container information
  283.  
  284.  Rem * routine to search player inventory for container name
  285.  Rem * input variables:
  286.  Rem *   Parsed.Command1 - name of container to search for.
  287.  Rem * output variables:
  288.  Rem *   Array.Number - container number.
  289.  Rem *   Index.Number - true if container found.
  290.  Rem *   Outpts - name of container.
  291.  Rem * processing variables:
  292.  Rem *   Parse.Count - increment counter.
  293.  Rem *   Container.Name$ - container name.
  294.  
  295. Sub Check.Inventory.Container
  296.  On Local Error Resume Next ' local error resume
  297.  Index.Number=False ' reset container found flag
  298.  Parse.Count=False ' reset counter
  299.  If Parsed.Command1<>Nul Then ' check search string length
  300.     For Array.Number=1 To 3 ' loop through player inventory containers
  301.        ' store container name
  302.        Container.Name$=Rtrim$(UserRecord.Container(Array.Number).ShortName)
  303.        Outpts=Container.Name$ ' store container name
  304.        If Container.Name$<>Nul Then ' check length of container name
  305.           ' trim length of container name to length of search string
  306.           Container.Name$=Left$(Container.Name$,Len(Parsed.Command1)) ' trim
  307.           If Container.Name$=Parsed.Command1 Then ' compare container names
  308.              Parse.Count=Parse.Count+1 ' increment counter
  309.              ' check increment counter not specified,
  310.              ' or counter equals increment counter.
  311.              If Parse.Number=False Or Parse.Count=Parse.Number Then
  312.                 Index.Number=True ' set container found flag
  313.                 ' store container record
  314.                 ContainerRec=UserRecord.Container(Array.Number) ' store
  315.                 Exit For ' exit loop through player containers
  316.              Endif ' end check counters
  317.           Endif ' end compare container names
  318.        Endif ' end check container name length
  319.     Next ' end loop through player containers
  320.  Endif ' end check search string length
  321. End Sub ' end routine to search player inventory for container name
  322.  
  323.  Rem * routine to compare room container to search container name
  324.  Rem * input variables:
  325.  Rem *   Parsed.Command1 - name of container to ccompare.
  326.  Rem * output variables:
  327.  Rem *   Index.Number - room container matched.
  328.  Rem *   Outpts - name of container.
  329.  Rem * processing variables:
  330.  Rem *   Parse.Count - increment counter.
  331.  Rem *   Container.Name$ - container name.
  332.  
  333. Sub Check.Room.Container
  334.  On Local Error Resume Next ' local error resume
  335.  Index.Number=False ' reset container found flag
  336.  Parse.Count=False ' reset counter
  337.  If Parsed.Command1<>Nul Then ' check search string length
  338.     ' get room container name
  339.     Container.Name$=Rtrim$(RoomRecord.Container.ShortName)
  340.     Outpts=Container.Name$ ' store container name
  341.     If Container.Name$<>Nul Then ' check length of container name
  342.        ' trim length of container name to length of search string
  343.        Container.Name$=Left$(Container.Name$,Len(Parsed.Command1)) ' trim
  344.        If Container.Name$=Parsed.Command1 Then ' compare container names
  345.           Parse.Count=Parse.Count+1
  346.           ' check increment counter not specified,
  347.           ' or counter equals increment counter.
  348.           If Parse.Number=False Or Parse.Count=Parse.Number Then
  349.              Index.Number=True ' set container match flag
  350.              ContainerRec=RoomRecord.Container ' store container record
  351.           Endif ' end check counters
  352.        Endif ' end compare names
  353.     Endif ' end check container name
  354.  Endif ' end check search string length
  355. End Sub
  356.  
  357.  Rem * routine to remove an item of player inventory and add to room.
  358.  
  359. Sub Drop.Item
  360.  On Local Error Resume Next ' local error resume
  361.  If Normal.User=False Then ' only special characters can have objects
  362.     Call Find.Object ' check inventory for object by mnemonic name
  363.     If Index.Number Then ' returns index to objects file
  364.        Call Add.Room.Object(Index.Number,Charges.Number,Item.Added) ' add item
  365.        If Item.Added Then ' check object added flag
  366.           Call Discard.Inventory.Object(Array.Number) ' remove object
  367.           Outpt="You drop "+Outpts+"!" ' format output
  368.           Call IO.O ' send output
  369.        Else ' check item added to room
  370.           Outpt="You can't drop that!" ' message
  371.           Call IO.O ' send output
  372.        Endif ' end check item added to room objects
  373.        Exit Sub ' return from routine
  374.     Endif ' end check inventory for object
  375.  Endif ' end check character type
  376.  Call Find.Inventory ' check inventory for treasure by mnemonic name
  377.  If Index.Number Then ' returns index to treasure file
  378.     If Last.Command.Number=Hide.Command Then ' compare command to hide
  379.        Outpt="You hide "+Outpts+"!" ' format hide message
  380.        Hide.Item=Hidden.Object ' set hide flag
  381.     Else ' not hide command
  382.        Outpt="You drop "+Outpts+"!" ' format message
  383.        Hide.Item=False ' set hide flag
  384.     Endif ' end compare command
  385.     ' add item to room
  386.     Call Add.Room.Treasure(Index.Number,Charges.Number,Hide.Item,Item.Added)
  387.     If Item.Added Then ' added to room flag
  388.        Call Discard.Inventory(Array.Number,True) ' remove from player inventory
  389.     Else ' not added
  390.        Outpt="You can't drop that!" ' message
  391.     Endif ' end check room flag
  392.     Call IO.O ' send output
  393.     Exit Sub ' return from routine
  394.  Endif ' end check inventory for treasure
  395.  Call Num ' decrement parse temp
  396.  Call Check.Inventory.Container ' check player inventory for container
  397.  If Index.Number Then ' returns index of container to treasure
  398.     If Last.Command.Number=Hide.Command Then ' compare to hide command
  399.        Outpt="You can't hide that!" ' message
  400.        Call IO.O ' send output
  401.        Exit Sub ' return from routine
  402.     Endif ' end compare to hide command
  403.     If Rtrim$(RoomRecord.Container.ShortName)=Nul Then ' room container empty
  404.        ' store room container
  405.        RoomRecord.Container=UserRecord.Container(Array.Number)
  406.        Call Share.Room.Record(Room) ' record structure, put room record,
  407.        Outpts=Rtrim$(ContainerRec.ContainerName) ' message
  408.        Call Clear.Container(0,True) ' clear player container structure
  409.        UserRecord.Container(Array.Number)=ContainerRec ' clear container record
  410.        Outpt="You drop "+Outpts+"!" ' format message
  411.        Call IO.O ' send output
  412.        Exit Sub ' return from routine
  413.     Endif ' end compare room container
  414.  Endif ' end check container index
  415.  Outpt="You can't drop that!" ' message
  416.  Call IO.O ' send output
  417. End Sub ' end drop item routine
  418.  
  419.  Rem * routine to take an object or item of treasure from the room and
  420.  Rem * add to the player inventory.
  421.  
  422. Sub Take.Object
  423.  On Local Error Resume Next ' local error resume
  424.  If Normal.User=False Then ' normal players cannot take objects
  425.     Call Check.Room.Objects ' find the mnemonic of object to take
  426.     If Index.Number Then ' verify object file index
  427.        ' routine to add object to room
  428.        Call Add.Object(Index.Number,Charges.Number,Item.Added)
  429.        If Item.Added Then ' an empty object element
  430.           ' routine to remove item from room
  431.           Call Discard.Room.Object(Array.Number)
  432.           Outpt="You take "+Outpts+"!" ' format message
  433.           Call IO.O ' display message
  434.        Else ' check empty object found
  435.           Outpt="You can't carry any more!" ' format message
  436.           Call IO.O ' display message
  437.        Endif ' end compare empty object element
  438.        Exit Sub ' exit routine
  439.     Endif ' end find object to take
  440.  Endif ' end normal player
  441.  Call Check.Room.Treasure ' find mnemonic of treasure to take
  442.  If Index.Number Then ' treasure index found in room to take
  443.     ' calculate weight player is carrying
  444.     New.Weight#=Cdbl(Int(Weight+TreasureRecord.Weight))
  445.     If New.Weight#>MaxInt Then ' check maximum integer
  446.        New.Weight#=MaxInt ' reduce to maximum integer
  447.     Endif ' end check maximum integer
  448.     Total.Weight#=Cdbl(UserRecord.Stats(1)) ' store player strength
  449.     Total.Weight#=Total.Weight#*100 ' multiply to weight player can carry
  450.     If New.Weight#>Total.Weight# Then ' compare weight player can carry
  451.        Outpt="You can't carry any more!" ' weight ten times player strength
  452.        Call IO.O ' format message
  453.        Exit Sub ' exit routine
  454.     Endif ' end compare weight
  455.     If UserRecord.ClassType<AsstDM Then ' normal class prevented to take item
  456.        For Array.Counter=1 To Number.Monsters ' loop through all monsters
  457.           ' check monster can prevent
  458.           If MonsterArray(Array.Counter).Prevent Then
  459.              ' compute random percent
  460.              If Rnd<(MonsterArray(Array.Counter).PreventPercent/100) Then
  461.                 Inpt=MonsterArray(Array.Counter).MonsterName ' store name
  462.                 Inpt=Rtrim$(Inpt) ' format message
  463.                 Outpt="The "+Inpt+" prevents you from getting it!"
  464.                 Call IO.O ' send message
  465.                 Exit Sub ' exit routine
  466.              Endif ' end compare random calculation
  467.           Endif ' end compare monster to prevent taking item
  468.        Next ' end loop through all monsters in room
  469.     Endif ' end compare player class
  470.     If TreasureRecord.Coin Then ' check item is coins
  471.        Outpt="You take "+Outpts+"!" ' format message
  472.        Call IO.O ' send message
  473.        UserRecord.Gold=UserRecord.Gold+TreasureRecord.Gold ' increment gold
  474.        Outpt="You now have"+Str$(UserRecord.Gold)+" Gold!" ' message
  475.        Call IO.O ' send message
  476.        Call Discard.Room.Treasure(Array.Number) ' remove item from room
  477.        Exit Sub ' exit routine
  478.     Endif ' end compare item if coins
  479.     ' add room item to inventory
  480.     Call Add.Inventory(Index.Number,Charges.Number,Item.Added)
  481.     If Item.Added Then ' return flag indicates successful addition to inventory
  482.        Outpt="You take "+Outpts+"!" ' format message
  483.        Call IO.O ' send message
  484.        Call Discard.Room.Treasure(Array.Number) ' remove item from room
  485.     Else ' compare flag
  486.        Outpt="You can't carry any more!" ' make message
  487.        Call IO.O ' send message
  488.     Endif ' end compare flag
  489.     Exit Sub ' exit routine
  490.  Endif ' end item is treasure in room
  491.  Call Num ' decrement parse temp
  492.  Call Check.Room.Container ' verify item to take is a container
  493.  If Index.Number Then ' found container index to treasure file
  494.     ' loop through player inventory to find empty container
  495.     For Array.Number=1 To 3
  496.        ' compare container name
  497.        If Rtrim$(UserRecord.Container(Array.Number).ShortName)=Nul Then
  498.           ' store container record
  499.           UserRecord.Container(Array.Number)=ContainerRec
  500.           Outpts=Rtrim$(ContainerRec.ContainerName) ' format message
  501.           Outpt="You get "+Outpts+"!" ' make message
  502.           Call IO.O ' send message
  503.           Call Clear.Container(0,True) ' clear entire container record
  504.           RoomRecord.Container=ContainerRec ' clear room container
  505.           Call Share.Room.Record(Room) ' write room record
  506.           Exit Sub ' exit routine
  507.        Endif ' end compare empty container mnemonic name
  508.     Next ' loop through inventory
  509.  Endif ' end verify taking container
  510.  Outpt="You can't get that!" ' message
  511.  Call IO.O ' send message
  512. End Sub ' end take item routine
  513.  
  514.  Rem * routine to lock an object or container.
  515.  
  516. Sub Lock.Object
  517.  On Local Error Resume Next ' local error resume
  518.  Call Examine.Container ' check container mnemonic
  519.  If Index.Number Then ' container index to treasure file
  520.     Container.Number=Array.Number ' store container number
  521.     If ContainerRec.Locked=False Then ' container has no lock setting
  522.        Outpt="You can't lock that!" ' make message
  523.        Call IO.O ' send message
  524.        Exit Sub ' exit routine
  525.     Endif ' end compare container lock
  526.     If ContainerRec.Locked>False Then ' container lock variable is already set
  527.        Outpt="It's already locked!" ' make message
  528.        Call IO.O ' send message
  529.        Exit Sub ' exit routine
  530.     Endif ' end compare container lock
  531.     ContainerRec.Locked=1 ' set container variable to locked
  532.     ContainerRec.Closed=1 ' set container variable to locked
  533.     Select Case Type.Number ' select room or inventory
  534.     Case 1 ' container is locked in room
  535.        RoomRecord.Container=ContainerRec
  536.        Call Share.Room.Record(Room) ' write room record
  537.     Case 0 ' container is locked in player inventory
  538.        ' update player container
  539.        UserRecord.Container(Container.Number)=ContainerRec
  540.     End Select ' end compare container locked
  541.     Outpt="You lock it!" ' make message
  542.     Call IO.O ' send message
  543.     Exit Sub ' exit routine
  544.  Endif ' end check container
  545.  Call Num ' decrement parse temp
  546.  Call Examine.Objects ' check object mnemonic
  547.  If Index.Number Then ' found object index
  548.     If ObjectRecord.RoomLink=False Then ' check object is a portal
  549.        Outpt="You can't lock that!" ' make message
  550.        Call IO.O ' send message
  551.        Exit Sub ' exit routine
  552.     Endif ' end compare object portal
  553.     If ObjectRecord.DoorLock=2 Then ' object is already locked
  554.        Outpt="It's already locked!" ' make message
  555.        Call IO.O ' send message
  556.        Exit Sub ' exit routine
  557.     Endif ' end compare object lock
  558.     If ObjectRecord.DoorLock=False Then ' object has no lock setting
  559.        Outpt="You can't lock that!" ' make message
  560.        Call IO.O ' send message
  561.        Exit Sub ' exit routine
  562.     Endif ' end compare object lock
  563.     ObjectRecord.DoorLock=2 ' set object lock variable
  564.     ObjectRecord.Closed=True ' set object lock variable
  565.     Call SHare.Record(ObjectFile,Index.Number) ' write object record
  566.     Outpt="You lock it!" ' make message
  567.     Call IO.O ' send message
  568.     Exit Sub ' exit routine
  569.  Endif ' end check object
  570.  Outpt="You can't lock that!" ' make message
  571.  Call IO.O ' send message
  572. End Sub ' end routine to lock an item
  573.  
  574.  Rem * routine to unlock or picklock an object or container.
  575.  
  576. Sub Unlock.Object
  577.  On Local Error Resume Next ' local error resume
  578.  Call Examine.Container ' check container mnemonic
  579.  If Index.Number Then ' found container treasure index
  580.     Container.Number=Array.Number ' store container number
  581.     If ContainerRec.Locked=False Then ' container has no lock setting
  582.        Outpt="You can't unlock that!" ' make message
  583.        Call IO.O ' send message
  584.        Exit Sub ' exit routine
  585.     Endif ' end compare container lock
  586.     If ContainerRec.Locked<False Then ' container lock variable already set
  587.        Outpt="It's already unlocked!" ' make message
  588.        Call IO.O ' send message
  589.        Exit Sub ' exit routine
  590.     Endif ' end compare container lock
  591.     If ContainerRec.Keyed=False Then ' container has no key number
  592.        ContainerRec.Locked=True ' set container lock variable
  593.        ContainerRec.Closed=1 ' set container lock variable
  594.        Select Case Type.Number ' select room or inventory
  595.        Case 1 ' container unlocked in room
  596.           RoomRecord.Container=ContainerRec ' set room container record
  597.           Call Share.Room.Record(Room) ' write room record
  598.        Case 0 ' container is locked in player inventory
  599.           ' update player container
  600.           UserRecord.Container(Container.Number)=ContainerRec
  601.        End Select ' end store container record
  602.        Outpt="You unlock it!" ' make message
  603.        Call IO.O ' send message
  604.        Exit Sub ' exit routine
  605.     Endif ' end compare container key number
  606.     If Last.Command.Number=Picklock.Command Then ' picklock container
  607.        If UserRecord.ClassType<>Thief Then ' compare player class to thief
  608.           If Normal.User Then ' compare player type to normal
  609.              Outpt="You can't picklock doors!" ' make message
  610.              Call IO.O ' send message
  611.              Exit Sub ' exit routine
  612.           Endif ' end compare player type
  613.        Endif ' end compare class to thief
  614.        If Int(Rnd*UserRecord.Stats(1))+3<7 Then ' compute random chance
  615.           Outpt="You didn't picklock it!" ' make message
  616.           Call IO.O ' send message
  617.           Exit Sub ' exit routine
  618.        Endif ' end random chance
  619.        If Int(Rnd*UserRecord.Stats(2))+3<7 Then ' compute random chance
  620.           Outpt="You didn't picklock it!" ' make message
  621.           Call IO.O ' send message
  622.           Exit Sub ' exit routine
  623.        Endif ' end random chance
  624.        If Rnd<.2 Then ' random chance
  625.           Outpt="You didn't picklock it!" ' make message
  626.           Call IO.O ' send message
  627.           Exit Sub ' exit routine
  628.        Endif ' end chance
  629.        ContainerRec.Locked=True ' set container record to unlocked
  630.        ContainerRec.Closed=1 ' set container record to unlocked
  631.        Select Case Type.Number ' select room or inventory
  632.        Case 1 ' container unlocked in room
  633.           RoomRecord.Container=ContainerRec ' set room container record
  634.           Call Share.Room.Record(Room) ' write room record
  635.        Case 0 ' container unlocked in player inventory
  636.           ' update player container
  637.           UserRecord.Container(Container.Number)=ContainerRec
  638.        End Select ' end set container record
  639.        Outpt="You picklock it!" ' make message
  640.        Call IO.O ' send message
  641.        Exit Sub ' exit routine
  642.     Endif ' end check picklock container
  643.     ' compare player inventory key numbers to container key number
  644.     Key.Number=ContainerRec.Keyed ' store container key number to unlock
  645.     Inpt=Right$(Str$(Key.Number+100000!),5) ' format key number to string
  646.     For Inventory.Number=1 To 20 ' loop through all player inventory
  647.        ' player inventory treasure index
  648.        If UserRecord.Inv(Inventory.Number) Then
  649.           ' get treasure record
  650.           Call Read.Record(TreasureFile,UserRecord.Inv(Inventory.Number))
  651.           If TreasureRecord.Keyed Then ' compare inventory treasure to key
  652.              Container.Locked=True ' container unlocked flag
  653.              ' format key number in inventory to string
  654.              Outpts=Right$(Str$(TreasureRecord.Keyed+100000!),5)
  655.              For Digit.Counter=1 To 5 ' loop through all key number digits
  656.                 ' get value of key digit
  657.                 Key.Digit=Val(Mid$(Outpts,Digit.Counter,1))
  658.                 ' compare player inventory key digit to container key digit
  659.                 ' digits unequal
  660.                 If Key.Digit<>Val(Mid$(Inpt,Digit.Counter,1)) Then
  661.                    ' player inventory key digit 0 matches
  662.                    If Key.Digit>False Then
  663.                       ' container is not unlocked flag
  664.                       Container.Locked=False
  665.                       Exit For ' exit loop, digit mismatch
  666.                    Endif ' end compare key digit 0 matches any key number
  667.                 Endif ' end compare key digit matches specific key number
  668.              Next ' end loop through all key digits in player inventory key
  669.              ' key in player inventory found to match container
  670.              If Container.Locked Then
  671.                 ContainerRec.Locked=True ' set container unlock
  672.                 ContainerRec.Closed=1 ' set container unlock
  673.                 Select Case Type.Number ' select room or inventory
  674.                 Case 1 ' container unlocked with key in room
  675.                    RoomRecord.Container=ContainerRec ' set room container
  676.                    Call Share.Room.Record(Room) ' write room record
  677.                 Case 0 ' container unlocked with key in player inventory
  678.                    ' update player container
  679.                    UserRecord.Container(Container.Number)=ContainerRec
  680.                 End Select ' end set container record
  681.                 Outpt="You unlock it!" ' make message
  682.                 Call IO.O ' send message
  683.                 Exit Sub ' exit routine
  684.              Endif ' end compare key match
  685.           Endif ' end compare player inventory to a key
  686.        Endif ' end compare player inventory
  687.     Next ' end loop through all keys in player inventory
  688.     Outpt="You don't have the key!" ' make message
  689.     Call IO.O ' send message
  690.     Exit Sub ' exit routine
  691.  Endif ' end check container
  692.  Call Num ' decrement parse temp
  693.  Call Examine.Objects ' check object mnemonic
  694.  If Index.Number Then ' found object index
  695.     If ObjectRecord.RoomLink=False Then ' check object is a portal
  696.        Outpt="You can't unlock that!" ' make message
  697.        Call IO.O ' send message
  698.        Exit Sub ' exit routine
  699.     Endif ' end object portal
  700.     If ObjectRecord.DoorLock=False Then ' object does not lock
  701.        Outpt="You can't unlock that!" ' make message
  702.        Call IO.O ' send message
  703.        Exit Sub ' exit routine
  704.     Endif ' end object lock
  705.     If ObjectRecord.DoorLock=1 Then ' object is already unlocked
  706.        Outpt="It's already unlocked!" ' make message
  707.        Call IO.O ' send message
  708.        Exit Sub ' exit routine
  709.     Endif ' end object lock
  710.     If ObjectRecord.Keyed=False Then ' object has no key number
  711.        ObjectRecord.DoorLock=1 ' set object unlocked
  712.        ObjectRecord.Closed=True ' set object unlocked
  713.        Call SHare.Record(ObjectFile,Index.Number) ' write object record
  714.        Outpt="You unlock it!" ' make message
  715.        Call IO.O ' send message
  716.        Exit Sub ' exit routine
  717.     Endif ' end object key number
  718.     If Last.Command.Number=Picklock.Command Then ' picklock object
  719.        If ObjectRecord.Hidden Then ' object is hidden
  720.           Outpt="You can't picklock hidden doors!" ' make message
  721.           Call IO.O ' send message
  722.           Exit Sub ' exit routine
  723.        Endif ' end object hidden
  724.        If UserRecord.ClassType<>Thief Then ' check player class to thief
  725.           If Normal.User Then ' check player is normal
  726.              Outpt="You can't picklock doors!" ' make message
  727.              Call IO.O ' send message
  728.              Exit Sub ' exit routine
  729.           Endif ' end compare normal player
  730.        Endif ' end compare class type
  731.        If Int(Rnd*UserRecord.Stats(1))+3<7 Then ' compute random chance
  732.           Outpt="You didn't picklock it!" ' make message
  733.           Call IO.O ' send message
  734.           Exit Sub ' exit routine
  735.        Endif ' end random chance
  736.        If Int(Rnd*UserRecord.Stats(2))+3<7 Then ' compute random chance
  737.           Outpt="You didn't picklock it!" ' make message
  738.           Call IO.O ' send message
  739.           Exit Sub ' exit routine
  740.        Endif ' end random chance
  741.        If Rnd<.2 Then ' random chance
  742.           Outpt="You didn't picklock it!" ' make message
  743.           Call IO.O ' send message
  744.           Exit Sub ' exit routine
  745.        Endif ' end chance
  746.        ObjectRecord.DoorLock=1 ' set object unlocked
  747.        ObjectRecord.Closed=True ' set object unlocked
  748.        Call SHare.Record(ObjectFile,Index.Number) ' write object record
  749.        Outpt="You picklock it!" ' make message
  750.        Call IO.O ' send message
  751.        Exit Sub ' exit routine
  752.     Endif ' end picklock
  753.     ' compare player inventory key numbers to object key number
  754.     Inpt=Right$(Str$(ObjectRecord.Keyed+100000!),5) ' format key number
  755.     For Inventory.Number=1 To 20 ' loop through all player inventory
  756.        ' player inventory treasure index
  757.        If UserRecord.Inv(Inventory.Number) Then
  758.           ' get treasure record
  759.           Call Read.Record(TreasureFile,UserRecord.Inv(Inventory.Number))
  760.           If TreasureRecord.Keyed Then ' compare treasure to key
  761.              Container.Locked=True ' set object unlocked flag
  762.              ' format player inventory key number to string
  763.              Outpts=Right$(Str$(TreasureRecord.Keyed+100000!),5)
  764.              For Digit.Counter=1 To 5 ' loop through all key number digits
  765.                 ' get inventory key digit
  766.                 Key.Digit=Val(Mid$(Outpts,Digit.Counter,1))
  767.                 ' compare player inventory key digit to container key digit
  768.                 ' compare to object
  769.                 If Key.Digit<>Val(Mid$(Inpt,Digit.Counter,1)) Then
  770.                    If Key.Digit>False Then ' zero digit matches any key digit
  771.                       Container.Locked=False ' set object is not unlocked flag
  772.                       Exit For ' exit loop, found unmatching digit
  773.                    Endif ' end compare matching zero digit
  774.                 Endif ' end compare both digits
  775.              Next ' end loop through all digits
  776.              If Container.Locked Then ' object key number matched
  777.                 ObjectRecord.DoorLock=1 ' set object unlocked
  778.                 ObjectRecord.Closed=True ' set object unlocked
  779.                 Call SHare.Record(ObjectFile,Index.Number) ' write object record
  780.                 Outpt="You unlock it!" ' make message
  781.                 Call IO.O ' send message
  782.                 Exit Sub ' exit routine
  783.              Endif ' end matching key number
  784.           Endif ' end locate player inventory key
  785.        Endif ' end find player inventory treasure
  786.     Next ' end loop through all player inventory for keys
  787.     Outpt="You don't have the key!" ' make message
  788.     Call IO.O ' send message
  789.     Exit Sub ' exit routine
  790.  Endif ' end unlock object
  791.  Outpt="You can't unlock that!" ' make message
  792.  Call IO.O ' send message
  793. End Sub ' end routine to unlock/picklock an item or container
  794.  
  795.  Rem * routine to close an object.
  796.  
  797. Sub Close.Object
  798.  On Local Error Resume Next ' local error resume
  799.  Call Examine.Container ' check container mnemonic
  800.  If Index.Number Then ' found container index to treasure file
  801.     Container.Number=Array.Number ' store container number
  802.     If ContainerRec.Locked=False Then ' container has no lock to set
  803.        Outpt="You can't close that!" ' make message
  804.        Call IO.O ' send message
  805.        Exit Sub ' exit routine
  806.     Endif ' end container lock
  807.     If ContainerRec.Locked>False Then ' check if container already locked
  808.        Outpt="It's already closed!" ' make message
  809.        Call IO.O ' send message
  810.        Exit Sub ' exit routine
  811.     Endif ' end container lock
  812.     If ContainerRec.Closed=False Then ' container has no close setting
  813.        Outpt="You can't close that!" ' make message
  814.        Call IO.O ' send message
  815.        Exit Sub ' exit routine
  816.     Endif ' end compare closed
  817.     If ContainerRec.Closed>False Then ' container is already closed
  818.        Outpt="It's already closed!" ' make message
  819.        Call IO.O ' send message
  820.        Exit Sub ' exit routine
  821.     Endif ' end compare closed
  822.     ContainerRec.Closed=1 ' set container record closed variable
  823.     Select Case Type.Number ' select room or inventory
  824.     Case 1 ' container closed in room
  825.        RoomRecord.Container=ContainerRec ' set room container record
  826.        Call Share.Room.Record(Room) ' write room record
  827.     Case 0 ' container closed in player inventory
  828.        ' update player container
  829.        UserRecord.Container(Container.Number)=ContainerRec
  830.     End Select ' end reset container
  831.     Outpt="You close it!" ' make message
  832.     Call IO.O ' send message
  833.     Exit Sub ' exit routine
  834.  Endif ' end compare container index
  835.  Call Num ' decrement parse temp
  836.  Call Examine.Objects ' check object mnemonic
  837.  If Index.Number Then ' found object index to object file
  838.     If ObjectRecord.DoorLock<>1 Then ' compare object already locked
  839.        Outpt="You can't close that!" ' make message
  840.        Call IO.O ' send message
  841.        Exit Sub ' exit routine
  842.     Endif ' end compare lock
  843.     If ObjectRecord.Closed Then ' compare container already closed
  844.        Outpt="It's already closed!" ' make message
  845.        Call IO.O ' send message
  846.        Exit Sub ' exit routine
  847.     Endif ' end compare closed
  848.     ObjectRecord.Closed=True ' set object record closed variable
  849.     Call SHare.Record(ObjectFile,Index.Number) ' write object record
  850.     Outpt="You close it!" ' make message
  851.     Call IO.O ' send message
  852.     Exit Sub ' exit routine
  853.  Endif ' end object search
  854.  Outpt="You can't close that!" ' make message
  855.  Call IO.O ' send message
  856. End Sub ' end routine to closed an item
  857.  
  858.  Rem * routine to open an item.
  859.  
  860. Sub Open.Object
  861.  On Local Error Resume Next ' local error resume
  862.  Call Examine.Container ' check container mnemonic
  863.  If Index.Number Then ' found container index
  864.     Container.Number=Array.Number ' store container number
  865.     If ContainerRec.Locked=False Then ' container has no lock to set
  866.        Outpt="You can't open that!" ' make message
  867.        Call IO.O ' send message
  868.        Exit Sub ' exit routine
  869.     Endif ' end compare container lock
  870.     If ContainerRec.Locked>False Then ' compare container lock variable
  871.        Outpt="You can't, it's locked!" ' make message
  872.        Call IO.O ' send message
  873.        Exit Sub ' exit routine
  874.     Endif ' end compare lock
  875.     If ContainerRec.Closed=False Then ' container has no close variable to set
  876.        Outpt="You can't open that!" ' make message
  877.        Call IO.O ' send message
  878.        Exit Sub ' exit routine
  879.     Endif ' end compare close
  880.     If ContainerRec.Closed<False Then ' container is already open
  881.        Outpt="It's already open!" ' make message
  882.        Call IO.O ' send message
  883.        Exit Sub ' exit routine
  884.     Endif ' end compare close
  885.     ContainerRec.Closed=True ' set container open variable
  886.     Select Case Type.Number ' select room or inventory
  887.     Case 1 ' container is opened in room
  888.        RoomRecord.Container=ContainerRec ' reset room container
  889.        Call Share.Room.Record(Room) ' write room record
  890.     Case 0 ' container is open in inventory
  891.        ' update player container
  892.        UserRecord.Container(Container.Number)=ContainerRec
  893.     End Select ' end reset container
  894.     Outpt="You open it!" ' make message
  895.     Call IO.O ' send message
  896.     Exit Sub ' exit routine
  897.  Endif ' end compare container
  898.  Call Num ' reset parse temp
  899.  Call Examine.Objects ' check object mnemonic
  900.  If Index.Number Then ' found object index
  901.     If ObjectRecord.DoorLock<>1 Then ' compare object closed variable
  902.        Outpt="You can't open that!" ' make message
  903.        Call IO.O ' send message
  904.        Exit Sub ' exit routine
  905.     Endif ' end compare closed
  906.     If ObjectRecord.Closed=False Then ' compare object open variable
  907.        Outpt="It's already open!" ' make message
  908.        Call IO.O ' send message
  909.        Exit Sub ' exit routine
  910.     Endif ' end compare opened
  911.     ObjectRecord.Closed=False ' set object record open variable
  912.     Call SHare.Record(ObjectFile,Index.Number) ' write object record
  913.     Outpt="You open it!" ' make message
  914.     Call IO.O ' send message
  915.     Exit Sub ' exit routine
  916.  Endif ' end object index
  917.  Outpt="You can't open that!" ' make message
  918.  Call IO.O ' send message
  919. End Sub ' end routine to open an item
  920.  
  921.  Rem * routine to smash open a locked item.
  922.  
  923. Sub Smash.Object
  924.  On Local Error Resume Next ' local error resume
  925.  Call Examine.Container ' check container mnemonic
  926.  If Index.Number Then ' found container index to treasure file
  927.     Container.Number=Array.Number ' store container number
  928.     If ContainerRec.Locked=False Then ' container has no available lock
  929.        Outpt="You can't smash that!" ' make message
  930.        Call IO.O ' send message
  931.        Exit Sub ' exit routine
  932.     Endif ' end compare container lock
  933.     If ContainerRec.Locked<False Then ' lock variable is already open
  934.        Outpt="It's already unlocked!" ' make message
  935.        Call IO.O ' send message
  936.        Exit Sub ' exit routine
  937.     Endif ' end compare lock
  938.     If ContainerRec.Keyed>False Then ' container has a key number
  939.        Outpt="You can't smash that!" ' make message
  940.        Call IO.O ' send message
  941.        Exit Sub ' exit routine
  942.     Endif ' end compare key number
  943.     If Int(Rnd*UserRecord.Stats(2))+1<7 Then ' compute smash chance
  944.        Outpt="You didn't smash it open!" ' make message
  945.        Call IO.O ' send message
  946.        Exit Sub ' exit routine
  947.     Endif ' end chance
  948.     If Int(Rnd*UserRecord.Stats(1))+1<7 Then ' compare smash chance
  949.        Outpt="You didn't smash it open!" ' make message
  950.        Call IO.O ' send message
  951.        Exit Sub ' exit routine
  952.     Endif ' end chance
  953.     If Rnd<.2 Then ' random chance to smash lock
  954.        Outpt="You didn't smash it open!" ' make message
  955.        Call IO.O ' send message
  956.        Exit Sub ' exit routine
  957.     Endif ' end chance
  958.     ContainerRec.Locked=True ' set container to unlocked
  959.     ContainerRec.Closed=1 ' set container to closed
  960.     Select Case Type.Number ' select room or inventory
  961.     Case 1 ' container unlocked in room
  962.        RoomRecord.Container=ContainerRec ' set new container record
  963.        Call Share.Room.Record(Room) ' write room record
  964.     Case 0 ' container unlocked in inventory
  965.        ' update player container
  966.        UserRecord.Container(Container.Number)=ContainerRec
  967.     End Select ' end reset container
  968.     Outpt="You smash it open!" ' make message
  969.     Call IO.O ' send message
  970.     Exit Sub ' exit routine
  971.  Endif ' end compare container index
  972.  Call Num ' decrement parse temp
  973.  Call Examine.Objects ' check object mnemonic
  974.  If Index.Number Then ' found object index
  975.     If ObjectRecord.Hidden Then ' object type is hidden
  976.        Outpt="You can't smash that!" ' make message
  977.        Call IO.O ' send message
  978.        Exit Sub ' exit routine
  979.     Endif ' end object type
  980.     If ObjectRecord.RoomLink=False Then ' object is not a portal
  981.        Outpt="You can't smash that!" ' make message
  982.        Call IO.O ' send message
  983.        Exit Sub ' exit routine
  984.     Endif ' end portal
  985.     If ObjectRecord.Keyed Then ' object has a key number
  986.        Outpt="You can't smash that!" ' make message
  987.        Call IO.O ' send message
  988.        Exit Sub ' exit routine
  989.     Endif ' end object key number
  990.     If ObjectRecord.DoorLock=1 Then ' object lock is already open
  991.        Outpt="It's already unlocked!" ' make message
  992.        Call IO.O ' send message
  993.        Exit Sub ' exit routine
  994.     Endif ' end object lock
  995.     If Int(Rnd*UserRecord.Stats(2))+1<7 Then ' compute random chance
  996.        Outpt="You didn't smash it open!" ' make message
  997.        Call IO.O ' send message
  998.        Exit Sub ' exit routine
  999.     Endif ' end chance
  1000.     If Int(Rnd*UserRecord.Stats(1))+1<7 Then ' compute random chance
  1001.        Outpt="You didn't smash it open!" ' make message
  1002.        Call IO.O ' send message
  1003.        Exit Sub ' exit routine
  1004.     Endif ' end chance
  1005.     If Rnd<.2 Then ' random chance
  1006.        Outpt="You didn't smash it open!" ' make message
  1007.        Call IO.O ' send message
  1008.        Exit Sub ' exit routine
  1009.     Endif ' end chance
  1010.     ObjectRecord.DoorLock=1 ' set object record lock to open
  1011.     Call Share.Record(ObjectFile,Index.Number) ' write object record
  1012.     Outpt="You smash it open!" ' make message
  1013.     Call IO.O ' send message
  1014.     If ObjectRecord.Trap Then ' check object is trapped
  1015.        Call Traps ' initiate any object traps
  1016.     Endif ' end object trap
  1017.     Exit Sub ' exit routine
  1018.  Endif ' end object index
  1019.  Outpt="You can't smash that!" ' make message
  1020.  Call IO.O ' send message
  1021. End Sub ' end routine to smash open lock
  1022.  
  1023.  Rem * routine to search a container.
  1024.  
  1025. Sub Search.Object
  1026.  On Local Error Resume Next ' local error resume
  1027.  Call Examine.Container ' check player and room inventory for container name
  1028.  If Index.Number Then ' found container index, placed into container record
  1029.     If ContainerRec.Locked>False Then ' compare container lock
  1030.        Outpt="You can't, it's locked!" ' make message
  1031.        Call IO.O ' send message
  1032.        Exit Sub ' exit routine
  1033.     Endif ' end compare container
  1034.     If ContainerRec.Closed>False Then ' compare container closed
  1035.        Outpt="You can't, it's closed!" ' make message
  1036.        Call IO.O ' send message
  1037.        Exit Sub ' exit routine
  1038.     Endif ' end compare container
  1039.     Outpt="You search the container.." ' make message
  1040.     Call IO.O ' send message
  1041.     Graphics.Off=True ' color white
  1042.     Outpt="In it you find " ' preceding message
  1043.     Item.Counter=False ' container contents counter
  1044.     For Array.Number=1 To 5 ' loop through all container contents
  1045.        If ContainerRec.Invisible(Array.Number) Then ' compare invisible item
  1046.           ' get container treasure index
  1047.           Inventory.Number=ContainerRec.Inventory(Array.Number)
  1048.           If Inventory.Number>False And _
  1049.              Inventory.Number<=Lof(TreasureFile)/Len(TreasureRecord) Then
  1050.              ' read index from treasure file
  1051.              Call Read.Record(TreasureFile,Inventory.Number)
  1052.              If Rnd>.5 Then ' compute random chance
  1053.                 Carriage.Return=True ' supress cr/lf
  1054.                 Call IO.O ' send message
  1055.                 Outpt=TreasureRecord.TreasureName ' get treasure name found
  1056.                 Outpt=Rtrim$(Outpt)+", " ' format treasure name
  1057.                 ' increment container contents counter
  1058.                 Item.Counter=Item.Counter+1
  1059.              Endif ' end random chance
  1060.           Endif ' end check treasure file bounds
  1061.        Endif ' end compare container contents invisible
  1062.     Next ' end loop through all container contents
  1063.     If Item.Counter=False Then ' compare no contents found
  1064.        Outpt="In it you find nothing.." ' make message
  1065.        Call IO.O ' send message
  1066.        Exit Sub ' exit routine
  1067.     Endif ' end compare container content counter
  1068.     Outpt=Left$(Outpt,Len(Outpt)-2)+"." ' format message, strip trailing comma
  1069.     If Item.Counter>1 Then ' compare container content counter
  1070.        Outpt="and "+Outpt ' format message with last contents found
  1071.     Endif ' end compare content counter
  1072.     Call IO.O ' send message
  1073.     Exit Sub ' exit routine
  1074.  Endif ' end find container to search
  1075.  Outpt="You can't search that!" ' make message
  1076.  Call IO.O ' send message
  1077. End Sub ' end routine to search container
  1078.  
  1079.  Rem * routine to display verbose text on an item entered on the game prompt,
  1080.  Rem * including a room number, an object, an item of treasure, monster, and
  1081.  Rem * contents of a container.
  1082.  
  1083. Sub Display.Information
  1084.  On Local Error Resume Next ' local error resume
  1085.  If Not Normal.User Then ' check non DM
  1086.     ' convert parameter to number (i.e. Look 12)
  1087.     Room.Number!=Int(Val(Parsed.Command1))
  1088.     ' check room bounds
  1089.     If Room.Number!>False And Room.Number!<=Lof(RoomFile)/Len(RoomRecord) Then
  1090.        Swap Room.Number!, Room ' store current room number
  1091.        Call Read.Room.Record(Room) ' get room to display
  1092.        Call Show.Room ' routine to display room
  1093.        Swap Room.Number!, Room ' restore current room number
  1094.        Call Read.Room.Record(Room) ' get current room
  1095.        Exit Sub ' exit routine
  1096.     Endif ' end check room number
  1097.  Endif ' end check normal user
  1098.  Outpt=UserRecord.CodeName ' get user codename
  1099.  Call Decrypt(Outpt) ' decrypt codename
  1100.  Outpt=Left$(Outpt,Len(Parsed.Command1)) ' store parameter
  1101.  If Outpt=Parsed.Command1 Then ' compare look command to user codename
  1102.     Call Display.Stats ' display player statistics
  1103.     Exit Sub ' exit routine
  1104.  Endif ' end check command parameter
  1105.  Call Examine.Treasure ' routine to compare parameter to treasure name
  1106.  If Index.Number Then ' compare returned index to treasure file
  1107.     Call Show.Treasure ' routine to display information on an item of treasure
  1108.     Exit Sub ' exit routine
  1109.  Endif ' end compare display treasure item
  1110.  Call Num ' reduce number of item
  1111.  Call Examine.Container ' compare parameter to container name
  1112.  If Index.Number Then ' check container to display
  1113.     Call Show.Container ' routine to display information on a container
  1114.     Exit Sub ' exit routine
  1115.  Endif ' end display container
  1116.  Call Num ' reduce number of item
  1117.  Call Examine.Objects ' compare parameter to object
  1118.  If Index.Number Then ' check index to object record
  1119.     Call Show.Object ' routine to display information on an object
  1120.     Exit Sub ' exit routine
  1121.  Endif ' end check object
  1122.  Call Num ' reduce number of item
  1123.  Call Check.Monster ' compare parameter to monster name in room
  1124.  If Monster.Number Then ' check index of monster array in room
  1125.     Call Show.Monster ' routine to display information on a monster
  1126.     Exit Sub ' exit routine
  1127.  Endif ' end check monster name
  1128.  Outpt="You can't examine that!" ' make error message
  1129.  Call IO.O ' send error message
  1130. End Sub ' end routine to display item
  1131.  
  1132.  Rem * routine to display room description (short or long), objects in room,
  1133.  Rem * monsters in room, containers in room, and directions/exits from room.
  1134.  Rem * working variables:
  1135.  Rem *   Lit.Room - returned true if room is unlit.
  1136.  
  1137. Sub Show.Room
  1138.  On Local Error Resume Next ' local error resume
  1139.  Call Check.Lit.Room(Lit.Room) ' routine to determine if room is unlit
  1140.  If Lit.Room Then ' check unlit room
  1141.     Outpt="It's too dark to see!" ' make message
  1142.     Call IO.O ' send message output
  1143.     Exit Sub ' exit routine
  1144.  Endif ' end check unlit room
  1145.  Graphics.Off=True ' reser color
  1146.  ' check if user is in brief mode, or room has no long description
  1147.  Outpt=RoomRecord.LongDesc(1) ' store room short one line description
  1148.  Outpt=Rtrim$(Outpt) ' trim brief description
  1149.  ' find any null characters from old structures
  1150.  If Instr(Outpt,Chr$(0)) Then
  1151.     Outpt=Left$(Outpt,Instr(Outpt,Chr$(0))-1) ' truncate off nulls
  1152.  Endif ' end find old nulls
  1153.  If UserRecord.Brief Or Outpt=Nul Then
  1154.     If Normal.User=False Then ' compare non DM status
  1155.        Outpt="(room:"+Str$(Room)+", monclass:" ' display DM room statistics
  1156.        If Room=1 Then ' check safe haven room
  1157.           Outpt=Outpt+" <safe haven>" ' append room message
  1158.        Else ' check safe haven
  1159.           Outpt=Outpt+Str$(RoomRecord.MonsterClass) ' display room number
  1160.        Endif ' end check safe haven room number
  1161.        Outpt=Outpt+", action:"+Str$(RoomRecord.Action)+")"
  1162.        Call IO.O ' display room monster class
  1163.     Endif ' end compare normal user in brief description
  1164.     Outpt=RoomRecord.ShortDesc ' store room short one line description
  1165.     Outpt=Rtrim$(Outpt) ' trim brief description
  1166.     ' find any null characters from old structures
  1167.     If Instr(Outpt,Chr$(0)) Then
  1168.        Outpt=Left$(Outpt,Instr(Outpt,Chr$(0))-1) ' truncate off nulls
  1169.     Endif ' end find old nulls
  1170.     Call IO.O ' display room short description
  1171.  Else ' display room four line long description
  1172.     For Desc.Line=1 To 4 ' loop through all four long room description lines
  1173.        Outpt=RoomRecord.LongDesc(Desc.Line) ' get next room description line
  1174.        Outpt=Rtrim$(Outpt) ' trim room description line
  1175.        If Instr(Outpt,Chr$(0)) Then ' find any nul characters from old files
  1176.           Outpt=Left$(Outpt,Instr(Outpt,Chr$(0))-1) ' truncate off nulls
  1177.        Endif ' end find old nulls
  1178.        If Outpt=Nul Then ' check if long description ends
  1179.           Exit For ' exit long description display loop
  1180.        Endif ' end check description end
  1181.        Call IO.O ' display room description line
  1182.     Next ' end long room description loop
  1183.  Endif ' end check room description to display
  1184.  Exit.Displayed=False ' set flag for an exit displayed
  1185.  If UserRecord.Brief Then ' check user is in brief mode
  1186.     Outpt=Nul ' assign empty display string
  1187.  Else ' user is not in brief mode
  1188.     Outpt="The exits are " ' assign initial display string
  1189.  Endif ' end check brief mode
  1190.  For Direction.Number=1 To 12 ' loop through all room directions
  1191.     ' compare room structure for direction
  1192.     If RoomRecord.Direct(Direction.Number) Then
  1193.        ' append exit to string
  1194.        Outpt=Outpt+Rtrim$(Direction(Direction.Number))+", "
  1195.        Exit.Displayed=True ' set flag for an exit displayed
  1196.     Endif ' end compare room direction exists
  1197.  Next ' end loop through room directions
  1198.  If Exit.Displayed Then ' compare flag for an exit displayed
  1199.     Outpt=Left$(Outpt,Len(Outpt)-2)+"." ' truncate trailing comma, add period
  1200.     If UserRecord.Brief Then ' check user in brief mode
  1201.        Mid$(Outpt,1,1)=Ucase$(Mid$(Outpt,1,1)) ' set first letter uppercase
  1202.     Endif ' end check brief mode
  1203.     Call IO.O ' send room exit display
  1204.  Endif ' end compare exit displayed flag
  1205.  ' following displays all objects, treasure, monsters, and container in room
  1206.  If UserRecord.Brief=False Then ' check user is in brief mode
  1207.     Outpt="You see " ' assign intial string
  1208.     Carriage.Return=True ' set flag to disable return/linefeed
  1209.     Call IO.O ' send initial string
  1210.  Endif ' end check brief mode
  1211.  Outpt=Nul ' assign empty display string
  1212.  Items.Displayed=False ' reset number of items displayed
  1213.  Object.Displayed=False ' reset flag indicating an item has been displayed
  1214.  For Array.Index=1 To 20 ' loop through all 20 objects in room
  1215.     Display.Object=False ' set flag to show object
  1216.     Object.Number=RoomRecord.Object(Array.Index) ' store room object number
  1217.     ' compare range
  1218.     If Object.Number>False And _
  1219.     Object.Number<=Lof(ObjectFile)/Len(ObjectRecord) Then
  1220.        Call Read.Record(ObjectFile,Object.Number) ' get object record
  1221.        If ObjectRecord.Invisible Then ' check object is invisible
  1222.           If Normal.User Then ' verify non DM
  1223.              Display.Object=True ' set flag to show object off
  1224.           Endif ' end verify normal user
  1225.        Endif ' end check invisible object
  1226.        If ObjectRecord.Hidden Then ' check object is hidden
  1227.           If Normal.User Then ' verify non DM
  1228.              Display.Object=True ' set flag to show object off
  1229.           Endif ' end verify normal user
  1230.        Endif ' end check hidden object
  1231.        If Display.Object=False Then ' check display flag
  1232.           Carriage.Return=True ' set flag to disable return/linefeed
  1233.           Call IO.O ' send display of previous item
  1234.           ' increment number of items displayed
  1235.           Items.Displayed=Items.Displayed+1
  1236.           If Items.Displayed=1 Then ' verify first item being displayed
  1237.              If UserRecord.Brief Then ' check user in brief mode
  1238.                 Outpt="You see " ' send initial display string
  1239.                 Carriage.Return=True ' set flag to disable return/linefeed
  1240.                 Call IO.O ' send previous string
  1241.              Endif ' end check brief mode
  1242.           Endif ' end verify first item
  1243.           Outpt=ObjectRecord.ObjectName ' store object name
  1244.           Outpt=Rtrim$(Outpt) ' trim object name
  1245.           If ObjectRecord.DoorLock>1 Then ' check object is locked
  1246.              Outpt=Outpt+"[locked]" ' append message
  1247.           Else ' compare unlocked object
  1248.              If ObjectRecord.DoorLock Then ' check object has lock
  1249.                 If ObjectRecord.Closed Then ' check object is closed
  1250.                    Outpt=Outpt+"[closed]" ' append message
  1251.                 Endif ' end check closed object
  1252.              Endif ' end check object is lock
  1253.           Endif ' end check object is locked
  1254.           If ObjectRecord.Hidden Then ' check object is hidden
  1255.              Outpt=Outpt+"[hidden]" ' append message
  1256.           Else ' check object not hidden
  1257.              If ObjectRecord.Invisible Then ' check object is invisible
  1258.                 Outpt=Outpt+"[inv]" ' append message
  1259.              Endif ' end check invisible object
  1260.           Endif ' end check object hidden
  1261.           Outpt=Outpt+", " ' append comma
  1262.           Object.Displayed=True ' set flag indicating an item displayed
  1263.        Endif ' end check display flag
  1264.     Endif ' end compare object file record range
  1265.  Next ' end loop through objects in room
  1266.  For Array.Index=1 To 20 ' loop through all room treasure
  1267.     Display.Treasure=False ' set flag to display item
  1268.     Treasure.Number=RoomRecord.Treasure(Array.Index) ' store treasure number
  1269.     If Treasure.Number>False And _
  1270.     Treasure.Number<=Lof(TreasureFile)/Len(TreasureRecord) Then ' compare range
  1271.        Call Read.Record(TreasureFile,Treasure.Number) ' get treasure record
  1272.        ' compare invisible treasure flag
  1273.        If RoomRecord.Flags(Array.Index)>False Then
  1274.           If Normal.User Then ' check non DM
  1275.              Display.Treasure=True ' set flag to display item
  1276.           Endif ' end check normal user
  1277.        Endif ' end compare invisible treasure
  1278.        If TreasureRecord.Invisible Then ' check treasure is invisible
  1279.           If Normal.User Then ' check non DM
  1280.              Display.Treasure=True ' set display flag
  1281.           Endif ' end check normal user
  1282.        Endif ' end check invisible treasure
  1283.        If Display.Treasure=False Then ' compare display flag
  1284.           Carriage.Return=True ' set flag to disable return/linefeed
  1285.           Call IO.O ' display previous item
  1286.           ' increment number of items displayed
  1287.           Items.Displayed=Items.Displayed+1
  1288.           If Items.Displayed=1 Then ' check first item
  1289.              If UserRecord.Brief Then ' check user is in brief mode
  1290.                 Outpt="You see " ' make initial string
  1291.                 Carriage.Return=True ' set flag to disable return/linefeed
  1292.                 Call IO.O ' send initial string
  1293.              Endif ' end check brief mode
  1294.           Endif
  1295.           Outpt=TreasureRecord.TreasureName ' get treasure name
  1296.           Outpt=Rtrim$(Outpt) ' trim treasure name
  1297.           If TreasureRecord.Keyed Then ' append key number to treasure name
  1298.              Outpt=Outpt+"(#"+Right$(Str$(TreasureRecord.Keyed+100000!),5)+")"
  1299.           Endif ' end compare treasure key number
  1300.           If TreasureRecord.Plus Then ' append plus number to treasure name
  1301.              Outpt=Outpt+"(+"+Mid$(Str$(Abs(TreasureRecord.Plus)),2)+")"
  1302.           Endif ' end compare treasure plus
  1303.           If TreasureRecord.Spell Then ' append spell plus to treasure name
  1304.              Call Read.Record(SpellFile,TreasureRecord.Spell) 'get spell record
  1305.              Outpt=Outpt+"(+"+Mid$(Str$(SpellRecord.Level),2)+")"
  1306.           Endif ' end compare treasure spell plus
  1307.           If TreasureRecord.Locked>False Then ' check treasure is locked
  1308.              Outpt=Outpt+"[locked]" ' append message
  1309.           Else ' check treasure locks
  1310.              If TreasureRecord.Locked<False Then ' check treasure lock
  1311.                 If TreasureRecord.Closed>False Then ' check treasure is closed
  1312.                    Outpt=Outpt+"[closed]" ' append message
  1313.                 Endif ' end check closed treasure
  1314.              Endif ' end check treasure lock
  1315.           Endif ' end check locked treasure
  1316.           If TreasureRecord.Invisible Then ' check treasure is invisible
  1317.              Outpt=Outpt+"[inv]" ' append message
  1318.           Else ' treasure is not invisible
  1319.              ' check invisible
  1320.              If RoomRecord.Flags(Array.Index)=Hidden.Object Then
  1321.                 Outpt=Outpt+"[inv]" ' treasure flag, append message
  1322.              Endif ' end check invisible flag
  1323.           Endif ' end check invisible treasure
  1324.           If RoomRecord.Flags(Array.Index)=Magic.Trap Then ' check magic trap
  1325.              Outpt=Outpt+"[trap]" ' treasure flag, append message
  1326.           Endif ' end check magic trap flag
  1327.           Outpt=Outpt+", " ' append comma
  1328.           Object.Displayed=True ' set item displayed flag
  1329.        Endif ' end compare display flag
  1330.     Endif ' end compare treasure file record range
  1331.  Next ' end loop through treasure
  1332.  ContainerRec=RoomRecord.Container ' store room container into record
  1333.  If Rtrim$(ContainerRec.ShortName)<>Nul Then ' compare container name length
  1334.     Carriage.Return=True ' set flag to disable return/linefeed
  1335.     Call IO.O ' send previous string
  1336.     Items.Displayed=Items.Displayed+1 ' increment number of items displayed
  1337.     If Items.Displayed=1 Then ' check first item displayed
  1338.        If UserRecord.Brief Then ' check user is in brief mode
  1339.           Outpt="You see " ' make initial string
  1340.           Carriage.Return=True ' set flag to disable return/linefeed
  1341.           Call IO.O ' send first string
  1342.        Endif ' end check brief mode
  1343.     Endif ' end check first display item
  1344.     Outpt=Rtrim$(ContainerRec.ContainerName) ' store container name
  1345.     If ContainerRec.Locked>False Then ' check container is locked
  1346.        Outpt=Outpt+"[locked]" ' append message
  1347.     Else ' container is not locked
  1348.        If ContainerRec.Closed>False Then ' check container is closed
  1349.           Outpt=Outpt+"[closed]" ' append message
  1350.        Endif ' end check closed container
  1351.     Endif ' end check locked container
  1352.     If ContainerRec.Keyed Then ' check container has a key number
  1353.        Outpt=Outpt+"(#"+Right$(Str$(ContainerRec.Keyed+100000!),5)+")"
  1354.     Endif ' append key number to container name
  1355.     Outpt=Outpt+", " ' append comma
  1356.     Object.Displayed=True ' set an item displayed flag
  1357.  Endif ' end compare container name length
  1358.  For Monster.Number=1 To Number.Monsters ' loop through all room monsters
  1359.     Carriage.Return=True ' set flag to disable return/linefeed
  1360.     Call IO.O ' send previous string
  1361.     Items.Displayed=Items.Displayed+1 ' increment number of items displayed
  1362.     If Items.Displayed=1 Then ' check first item
  1363.        If UserRecord.Brief Then ' check user is in brief mode
  1364.           Outpt="You see " ' make initial string
  1365.           Carriage.Return=True ' set flag to disable return/linefeed
  1366.           Call IO.O ' send initial string
  1367.        Endif ' end check brief mode
  1368.     Endif ' end check first item
  1369.     Outpts=MonsterArray(Monster.Number).MonsterName ' store monster name
  1370.     Outpts=Rtrim$(Outpts) ' trim monster name
  1371.     Call The.Or.An ' routine to get prefix (a, an, the)
  1372.     Outpt=Outpt+Prefix1+Outpts+", " ' make message of monster
  1373.     Object.Displayed=True ' set an item displayed flag
  1374.  Next ' end loop through monsters in room
  1375.  If Object.Displayed=False Then ' compare flag indicating an item is displayed
  1376.     If UserRecord.Brief=False Then ' check user is in brief mode
  1377.        Outpt="nothing special." ' make last item string
  1378.     Else ' user is in brief mode
  1379.        Outpt="You see nothing." ' make entire message
  1380.     Endif ' end check brief mode
  1381.  Else ' an item was displayed
  1382.     If Outpt<>Nul Then ' compare string length
  1383.        Outpt=Left$(Outpt,Len(Outpt)-2)+"." ' trim comma, append period
  1384.        If Items.Displayed>1 Then ' check more than one item was displayed
  1385.           Outpt="and "+Outpt ' append to last item
  1386.        Endif ' end check item numbers
  1387.     Endif ' end check valid last item string
  1388.  Endif ' end check flag of items displayed
  1389.  Call IO.O ' send last display item
  1390. End Sub ' end routine to show room description, etc.
  1391.  
  1392.  Rem * routine to display player character inventory.
  1393.  
  1394. Sub Display.Inventory
  1395.  On Local Error Resume Next ' local error resume
  1396.  Graphics.Off=True ' reset color
  1397.  Outpt="You are carrying"+Str$(Weight)+" pounds of items:" ' weight message
  1398.  Call IO.O ' send output message
  1399.  Items.Displayed=False ' number of items displayed
  1400.  For Array.Index=1 To 20 ' loop through all player treasure inventory
  1401.     Treasure.Number=UserRecord.Inv(Array.Index) ' get treasure number
  1402.     If Treasure.Number Then ' compare number
  1403.        Carriage.Return=True ' disable return/linefeed
  1404.        Call IO.O ' send initial item
  1405.        Call Read.Record(TreasureFile,Treasure.Number) ' get treasure record
  1406.        Outpts=TreasureRecord.TreasureName ' store treasure name
  1407.        Outpts=Rtrim$(Outpts) ' trim name
  1408.        If TreasureRecord.Keyed Then ' append key number to treasure name
  1409.           Outpts=Outpts+"(#"+Right$(Str$(TreasureRecord.Keyed+100000!),5)+")"
  1410.        Endif ' end compare treasure key number
  1411.        If TreasureRecord.Plus Then ' append plus number to treasure name
  1412.           Outpts=Outpts+"(+"+Mid$(Str$(Abs(TreasureRecord.Plus)),2)+")"
  1413.        Endif ' end compare treasure plus
  1414.        If TreasureRecord.Spell Then ' append spell plus to treasure name
  1415.           Call Read.Record(SpellFile,TreasureRecord.Spell) ' get spell record
  1416.           Outpts=Outpts+"(+"+Mid$(Str$(SpellRecord.Level),2)+")"
  1417.        Endif ' end compare treasure spell plus
  1418.        If TreasureRecord.LightType Then ' check treasure is a light
  1419.           If UserRecord.Charges(Array.Index)<False Then ' check light charges
  1420.              Outpts=Outpts+"[lit]" ' append message
  1421.           Endif ' end check charges
  1422.        Endif ' end check light
  1423.        If TreasureRecord.Locked>False Then ' check treasure is locked
  1424.           Outpts=Outpts+"[locked]" ' append message
  1425.        Else ' check treasure locks
  1426.           If TreasureRecord.Locked<False Then ' check treasure lock
  1427.              If TreasureRecord.Closed>False Then ' check treasure is closed
  1428.                 Outpts=Outpts+"[closed]" ' append message
  1429.              Endif ' end check closed treasure
  1430.           Endif ' end check treasure lock
  1431.        Endif ' end check locked treasure
  1432.        If TreasureRecord.Invisible Then ' check treasure is invisible
  1433.           Outpts=Outpts+"[inv]" ' append message
  1434.        Endif ' end check invisible
  1435.        Outpt=Outpts+", " ' append comma
  1436.        Items.Displayed=Items.Displayed+1 ' increment item number
  1437.        If Items.Displayed=1 Then ' check first item
  1438.           Mid$(Outpt,1,1)=Ucase$(Mid$(Outpt,1,1)) ' uppercase first letter
  1439.        Endif ' end check first item
  1440.     Endif ' end compare treasure number
  1441.  Next ' end loop through inventory treasure
  1442.  For Array.Index=1 To 5 ' loop through player object inventory
  1443.     Object.Number=UserRecord.Object(Array.Index) ' get object number
  1444.     If Object.Number Then ' compare object number
  1445.        Carriage.Return=True ' disable return/linefeed
  1446.        Call IO.O ' send previous item
  1447.        Call Read.Record(ObjectFile,Object.Number) ' get object record
  1448.        Outpts=ObjectRecord.ObjectName ' store object name
  1449.        Outpts=Rtrim$(Outpts) ' trim object name
  1450.        If ObjectRecord.Invisible Then ' compare object is invisible
  1451.           Outpts=Outpts+"[inv]" ' append to object name
  1452.        Endif ' end compare object invisible
  1453.        If ObjectRecord.Keyed Then ' compare object key, append number to name
  1454.           Outpts=Outpts+"(#"+Right$(Str$(ObjectRecord.Keyed+100000!),5)+")"
  1455.        Endif ' end compare object key number
  1456.        Outpt=Outpts+", " ' append comma
  1457.        Items.Displayed=Items.Displayed+1 ' increment item number
  1458.        If Items.Displayed=1 Then ' check first item
  1459.           Mid$(Outpt,1,1)=Ucase$(Mid$(Outpt,1,1)) ' uppercase first letter
  1460.        Endif ' end check first item
  1461.     Endif ' end check object number
  1462.  Next ' end loop through object inventory
  1463.  For Array.Index=1 To 3 ' loop through all player character containers
  1464.     ' store container into record
  1465.     ContainerRec=UserRecord.Container(Array.Index)
  1466.     ' compare container name length
  1467.     If Rtrim$(ContainerRec.ShortName)<>Nul Then
  1468.        Carriage.Return=True ' disable retuen/linefeed
  1469.        Call IO.O ' send previous item
  1470.        Outpt=Rtrim$(ContainerRec.ContainerName) ' store container name
  1471.        If ContainerRec.Locked>False Then ' check container locked
  1472.           Outpt=Outpt+"[locked]" ' append message
  1473.        Else ' container not locked
  1474.           If ContainerRec.Closed>False Then ' check container closed
  1475.              Outpt=Outpt+"[closed]" ' append message
  1476.           Endif ' end check closed container
  1477.        Endif ' end check locked container
  1478.        If ContainerRec.Keyed Then ' check container key number
  1479.           Outpt=Outpt+"(#"+Right$(Str$(ContainerRec.Keyed+100000!),5)+")"
  1480.        Endif ' append container key number to message
  1481.        Outpt=Outpt+", " ' append comma
  1482.        Items.Displayed=Items.Displayed+1 ' increment item number
  1483.        If Items.Displayed=1 Then ' check first item
  1484.           Mid$(Outpt,1,1)=Ucase$(Mid$(Outpt,1,1)) ' uppercase first letter
  1485.        Endif ' end check first item
  1486.     Endif ' end compare container name length
  1487.  Next ' end loop through player containers
  1488.  If Items.Displayed=False Then ' compare items displayed
  1489.     Outpt="Nothing at all." ' display message
  1490.  Else ' some items displayed
  1491.     Outpt=Left$(Outpt,Len(Outpt)-2)+"." ' trim comma, append period
  1492.     If Items.Displayed>1 Then ' check more than one item displayed
  1493.        Outpt="and "+Outpt ' add to message
  1494.     Endif ' end check item numbers
  1495.  Endif ' end compare items
  1496.  Call IO.O ' send last item
  1497. End Sub ' end routine to display player inventory
  1498.  
  1499.  Rem * routine to sell item of treasure, object, or container.
  1500.  
  1501. Sub Pawn.Shop
  1502.  On Local Error Resume Next ' local error resume
  1503.  Sell.Container=False ' item to sell is container flag
  1504.  Call Check.Inventory.Treasure ' routine to find treasure name
  1505.  If Index.Number=False Then ' check treasure index
  1506.     Call Num ' reduce counter
  1507.     Call Check.Inventory.Container ' routine to find container name
  1508.     Sell.Container=True ' set container for sale flag
  1509.     Container.Number=Array.Number ' store container number
  1510.     If Index.Number=False Then ' check treasure index
  1511.        Outpt="The Broker says: You can't sell that!" ' make error message
  1512.        Call IO.O ' send error message
  1513.        Exit Sub ' exit routine
  1514.     Endif ' end check index
  1515.  Endif ' end check index
  1516.  Outpts=TreasureRecord.ShortName ' store treasure name being sold
  1517.  If Sell.Container Then ' check container flag
  1518.     Item.Cost#=0# ' reset price of container contents
  1519.     Outpts=ContainerRec.ShortName ' store container name
  1520.     If ContainerRec.Locked>False Then ' check container lock
  1521.        Outpt="The Broker tries the lock and says: Arrghh!! Can't open it!"
  1522.        Call IO.O ' send lock message
  1523.        Exit Sub ' exit routine
  1524.     Endif ' end check container lock
  1525.     For Array.Index=1 To 5 ' loop through container contents
  1526.        ' store treasure number
  1527.        Treasure.Number=ContainerRec.Inventory(Array.Index)
  1528.        ' verify file bounds
  1529.        If Treasure.Number>False And _
  1530.        Treasure.Number<Lof(TreasureFile)/Len(TreasureRecord) Then
  1531.           Call Read.Record(TreasureFile,Treasure.Number) ' get treasure record
  1532.           ' verify item plus is not loadable or launchable object
  1533.           If TreasureRecord.Loadable=False And TreasureRecord.Launchable=False Then
  1534.              ' check item plus or spell
  1535.              If TreasureRecord.Plus Or TreasureRecord.Spell Then 
  1536.                 ' compare charges
  1537.                 If ContainerRec.Charges(Array.Index)=False Then
  1538.                    Item.Cost#=Item.Cost#+1# ' add 1 gold for discharged item
  1539.                 Else ' compare charges
  1540.                    ' add treasure gold
  1541.                    Item.Cost#=Item.Cost#+Cdbl(Int(TreasureRecord.Gold*.95))
  1542.                 Endif ' end compare charges
  1543.              Else ' compare item plus or spell
  1544.                 ' add treasure gold
  1545.                 Item.Cost#=Item.Cost#+Cdbl(Int(TreasureRecord.Gold*.9))
  1546.              Endif ' end compare item plus or spell
  1547.           Else ' compare item plus type
  1548.              ' add treasure gold
  1549.              Item.Cost#=Item.Cost#+Cdbl(Int(TreasureRecord.Gold))
  1550.           Endif ' end check item plus type
  1551.        Endif ' end verify file bounds
  1552.     Next ' end loop through container contents
  1553.     If Item.Cost#=0# Then ' compare container content price
  1554.        Item.Cost#=1# ' reset price
  1555.        Sell.Container=1 ' sell the container
  1556.     Else ' compare contents
  1557.        Outpts="contents of the "+Outpts ' make purchase message
  1558.     Endif ' end compare container contents
  1559.  Else ' check container
  1560.     Item.Cost#=Cdbl(Int(TreasureRecord.Gold*.9)) ' calculate price of treasure item
  1561.     ' verify item plus is not loadable or launchable object
  1562.     If TreasureRecord.Loadable=False And TreasureRecord.Launchable=False Then
  1563.        If TreasureRecord.Plus Or TreasureRecord.Spell Then ' verify charges
  1564.           If UserRecord.Charges(Array.Number)=False Then ' compare charges
  1565.              Item.Cost#=1# ' set price to 1
  1566.              Outpts="broken "+Outpts ' make broken item message
  1567.           Endif ' end compare charges
  1568.        Endif ' end compare charges left
  1569.     Endif ' end verify charges
  1570.  Endif ' end check container being sold
  1571.  Outpt="The Broker says: Well, I'll give you"+Str$(Item.Cost#)+ _
  1572.  " gold for the "+Rtrim$(Lcase$(Outpts))+"." ' message of price for items
  1573.  Call IO.O ' send purchase message
  1574.  Outpt="The Broker asks: Is that a deal(y/n)? " ' make input prompt
  1575.  No.Input.Out="Y" ' default input
  1576.  Call IO.I ' get input
  1577.  If Yes Then ' compare response
  1578.     UserRecord.Gold=UserRecord.Gold+Item.Cost# ' increment player gold
  1579.     Outpt="The Broker says: Great!" ' make purchase message
  1580.     If Sell.Container=True Then ' check container
  1581.        ' sell contents of container
  1582.        For Container.Item=1 To 5 ' loop through container contents
  1583.           ' routine resets container item
  1584.           Call Clear.Container(Container.Item,False)
  1585.        Next ' end loop through container contents
  1586.        ' store container record
  1587.        UserRecord.Container(Container.Number)=ContainerRec
  1588.     Else ' check container
  1589.        ' sell container
  1590.        If Sell.Container=1 Then ' check container
  1591.           Call Clear.Container(0,True) ' clear player container structure
  1592.           UserRecord.Container(Container.Number)=ContainerRec ' clear container record
  1593.        Else ' check sell item
  1594.           ' routine removes item from player
  1595.           Call Discard.Inventory(Array.Number,True)
  1596.        Endif ' end check sell item/container
  1597.     Endif ' end check container sold
  1598.  Else ' compare repsonse
  1599.     Outpt="The Broker says: Oh well!" ' make purchase message
  1600.  Endif ' end compare response
  1601.  Call IO.O ' send purchase message
  1602. End Sub ' end routine to sell items
  1603.  
  1604.  Rem * routine for monsters to talk.
  1605.  Rem * input variables:
  1606.  Rem *   Parsed.Command1 - command parameter of monster name.
  1607.  
  1608. Sub Talk.To.Monster
  1609.  On Local Error Resume Next ' local error resume
  1610.  Call Check.Monster ' get monster number
  1611.  If Monster.Number=False Then ' check monster found
  1612.     Outpt="You can't talk to that!" ' make message
  1613.     Call IO.O ' send error message
  1614.     Exit Sub ' exit routine
  1615.  Endif ' end check monster number
  1616.  ' get random number of monster variable of monster talk record file
  1617.  Talk.Number=MonsterArray(Monster.Number).Talk(Int(Rnd*5+1))
  1618.  Outpt=Nul ' reset talk response string
  1619.  ' check bounds
  1620.  If Talk.Number>False And _
  1621.  Talk.Number<=Lof(MonTalkFile)/Len(MonsterTalkRecord) Then
  1622.     Call Read.Record(MonTalkFile,Talk.Number) ' get the random talk string
  1623.     Outpt=Rtrim$(MonsterTalkRecord.TalkMessage) ' trim talk response
  1624.  Endif ' end check monster talk file bounds
  1625.  If Outpt=Nul Then ' compare to length of string
  1626.     Outpt="The monster doesn't reply!" ' set string
  1627.  Endif ' end check string length
  1628.  Call IO.O ' send response
  1629.  Call Read.Room.Record(Room) ' get current room record
  1630.  ' compare monster number to room record talk action number
  1631.  Action.Number=RoomRecord.Action ' store room action number
  1632.  ' check file bounds
  1633.  If Action.Number>False And _
  1634.  Action.Number<=Lof(ActionFile)/Len(ActionRecord) Then
  1635.     Call Read.Record(ActionFile,Action.Number) ' read action record
  1636.     If MonsterIndex(Monster.Number)=ActionRecord.MonsterTalk Then ' compare
  1637.        Action1$="As you begin to speak," ' format action string one
  1638.        Action2$="The monster hits you for" ' format action string two
  1639.        ' routine to activate actions by specific trigger
  1640.        Call Actions(Action1$,Action2$)
  1641.     Endif ' end compare room monster talk action
  1642.  Endif ' end check file bounds
  1643. End Sub ' end routine to talk to monster
  1644.  
  1645.  Rem * routine to rust some item of player.
  1646.  Rem * input variables:
  1647.  Rem *   Room.Rust.Rate - number of rounds for rusting.
  1648.  Rem *   Rust.Rate - counter of rounds for rusting.
  1649.  
  1650. Sub Rust.Weapon
  1651.  On Local Error Resume Next ' local error resume
  1652.  If Room.Rust.Rate=False Then ' check room has rust rate
  1653.     Exit Sub ' exit routine
  1654.  Endif ' end check room rust rate
  1655.  Rust.Rate=Rust.Rate+1 ' increment rust rate counter
  1656.  If Rust.Rate<Room.Rust.Rate Then ' check rust rate counter
  1657.     Exit Sub ' exit routine
  1658.  Endif ' end check rust rate counter
  1659.  Rust.Rate=False ' reset rust rate counter
  1660.  Call Rust.Inventory(Weapon4) ' routine to rust armor
  1661.  Call Rust.Inventory(Weapon5) ' routine to rust shield
  1662.  Call Rust.Inventory(Weapon6) ' routine to rust weapon
  1663.  Call Rust.Inventory(Weapon7) ' routine to rust ring
  1664. End Sub ' end rust routine
  1665.  
  1666.  Rem * routine to rust item.
  1667.  Rem * input variables:
  1668.  Rem *   Weapon.Number - array index to treasure file record.
  1669.  
  1670. Sub Rust.Inventory(Weapon.Number)
  1671.  On Local Error Resume Next ' local error resume
  1672.  If Weapon.Number>False Then ' check treasure index
  1673.     ' store index to treasure file
  1674.     Treasure.Number=UserRecord.Inv(Weapon.Number)
  1675.     If Treasure.Number>False And _
  1676.     Treasure.Number<=Lof(TreasureFile)/Len(TreasureRecord) Then 'compare bounds
  1677.        Call Read.Record(TreasureFile,Treasure.Number) ' get treasure record
  1678.        If TreasureRecord.Rustable=True Then ' verify item can rust
  1679.           If Rnd<(TreasureRecord.RustPercent/100) Then ' check rust percent
  1680.              Outpt=TreasureRecord.ShortName ' store treasure name
  1681.              Outpt=Rtrim$(Outpt) ' trim name
  1682.              Outpt=Lcase$(Outpt) ' lowercase name
  1683.              Outpt="Your "+Outpt+" rusts!" ' make message
  1684.              Call IO.O ' send rust message
  1685.              ' remove item from inventory
  1686.              Call Discard.Inventory(Weapon.Number,True)
  1687.           Endif ' end check random rust percent
  1688.        Endif ' end verify item rusts
  1689.     Endif ' end compare file bounds
  1690.  Endif ' end check treasure index
  1691. End Sub ' end routine to rust items
  1692.  
  1693.  Rem * routine for monster to steal item from player inventory.
  1694.  Rem * input variables:
  1695.  Rem *   Room.Steal.Rate - number of rounds for stealing.
  1696.  Rem *   Steal.Rate - counter of rounds for stealing.
  1697.  
  1698. Sub Steal.Treasure
  1699.  On Local Error Resume Next ' local error resume
  1700.  If Room.Steal.Rate=False Then ' check room has steal rate
  1701.     Exit Sub ' exit routine
  1702.  Endif ' end check room steal rate
  1703.  Steal.Rate=Steal.Rate+1 ' increment steal rate counter
  1704.  If Steal.Rate<Room.Steal.Rate Then ' compare steal rates
  1705.     Exit Sub ' exit routine
  1706.  Endif ' end compare steal rates
  1707.  Steal.Rate=False ' reset steal rate counter
  1708.  If Number.Monsters=False Then ' check monsters in room
  1709.     Exit Sub ' exit routine
  1710.  Endif ' end compare monsters in room
  1711.  For Array.Index=1 To 20 ' loop through player inventory
  1712.     If UserRecord.Inv(Array.Index) Then ' check player has inventory
  1713.        Call Read.Record(TreasureFile,UserRecord.Inv(Array.Index)) ' get record
  1714.        If TreasureRecord.Stealable=True Then ' verify item can be stolen
  1715.           ' check random percentage item can be stolen
  1716.           If Rnd<(TreasureRecord.StealPercent/100) Then
  1717.              For Monster.Number=1 To Number.Monsters ' loop through monsters
  1718.                 ' check permanent
  1719.                 If MonsterArray(Monster.Number).Permanent=False Then
  1720.                    For Array.Number=1 To 5 ' loop through monsters inventory
  1721.                       ' locate empty inventory in monster
  1722.                       If MonsterArray(Monster.Number).Treasure(Array.Number)= _
  1723.                       False Then
  1724.                          ' store player inventory in monster inventory
  1725.                          MonsterArray(Monster.Number).Treasure(Array.Number)= _
  1726.                          UserRecord.Inv(Array.Index) ' store
  1727.                          ' monster name
  1728.                          Outpt=MonsterArray(Monster.Number).MonsterName
  1729.                          Outpt=Rtrim$(Outpt) ' trim name
  1730.                          Inpt=TreasureRecord.ShortName ' store treasure name
  1731.                          Inpt=Rtrim$(Inpt) ' trim name
  1732.                          Inpt=Lcase$(Inpt) ' lowercase name
  1733.                          Outpt="The "+Outpt+" steals your "+Inpt+"!" ' message
  1734.                          Call IO.O ' send stolen message
  1735.                          ' remove inventory from player
  1736.                          Call Discard.Inventory(Array.Index,True) ' remove
  1737.                          Exit Sub ' exit routine
  1738.                       Endif ' end locate emtpt monster inventory
  1739.                    Next ' end loop through monster inventory array
  1740.                 Endif ' end check permanent monster
  1741.              Next ' end loop through monsters in room
  1742.           Endif ' end random percentage for stealing inventory
  1743.        Endif ' end verify item can be stolen
  1744.     Endif ' end check player inventory
  1745.  Next ' end loop through player inventory
  1746. End Sub ' end routine to steal item from player
  1747.  
  1748.  Rem * routine to offer treasure or gold to a monster to leave the room.
  1749.  Rem * processing variables:
  1750.  Rem *   Monster.Number - number of monster.
  1751.  Rem *   UserRecord.Gold - for offering gold.
  1752.  
  1753. Sub Offer
  1754.  On Local Error Resume Next ' local error resume
  1755.  Call ParseX ' get first command parameter
  1756.  If Parser=False Then ' check parameter
  1757.     Outpt="Offer to whom?" ' make message
  1758.     Call IO.O ' send error message
  1759.     Exit Sub ' exit routine
  1760.  Endif ' end check parameter
  1761.  Call Numeric ' parse parameter number from # sign
  1762.  Call Check.Monster ' get monster number
  1763.  If Monster.Number=False Then ' check monster
  1764.     Outpt="That's not here!" ' make message
  1765.     Call IO.O ' send error message
  1766.     Exit Sub ' exit routine
  1767.  Endif ' end check monster number
  1768.  Parsed.Command1=Parsed.Command2 ' get second parameter
  1769.  Call Numeric ' parse parameter number from # sign
  1770.  Accept.Offer=False ' flag for monster to accept offer
  1771.  Player.Gold#=False ' stores amount of gold offered
  1772.  If MonsterArray(Monster.Number).Magic=False Then ' check magical monster
  1773.     If MonsterArray(Monster.Number).Permanent=False Then ' permanent monster
  1774.        Call Check.Inventory.Treasure ' parameter is item of player inventory
  1775.        If Index.Number Then ' player offers item of inventory
  1776.           Call TreasureCharges(Charges.Amount) ' get treasure item charges
  1777.           If Charges.Amount>False Then ' compare remaining charges
  1778.              If TreasureRecord.Spell Then ' check item is magical
  1779.                 Call Read.Record(SpellFile,TreasureRecord.Spell) ' get record
  1780.                 If SpellRecord.Level>=10 Then ' verify item spell level
  1781.                    Accept.Offer=True ' set accept flag
  1782.                 Endif ' end compare spell level
  1783.              Else ' check magical item
  1784.                 If TreasureRecord.Plus>=10 Then ' compare plus of item
  1785.                    ' set accept flag for plus greater than ten
  1786.                    Accept.Offer=True
  1787.                 Endif ' end check item plus
  1788.              Endif ' end check magical item
  1789.           Endif ' end compare charges
  1790.        Else ' compare parameter to offer
  1791.           ' convert offer to integer
  1792.           Offer.Amount#=Cdbl(Int(Val(Parsed.Command1)))
  1793.           If Offer.Amount#>False Then ' check value of offer
  1794.              ' compare value offered is greater than monster level
  1795.              Monster.Amount#=Cdbl(Int(MonsterArray(Monster.Number).Level*10))
  1796.              If Offer.Amount#>=Monster.Amount# Then ' compare
  1797.                 ' compute player gold
  1798.                 Player.Gold#=UserRecord.Gold-Offer.Amount#
  1799.                 If Player.Gold#>=False Then ' check player gold
  1800.                    Accept.Offer=True ' set accept flag
  1801.                 Endif ' end compare player has gold
  1802.              Endif ' end compare accept gold value offer
  1803.           Endif ' end check offer value
  1804.        Endif ' end item offered
  1805.     Endif ' end check parmanent monster
  1806.  Endif ' end check magical monster
  1807.  If Accept.Offer=False Then ' compare accept flag
  1808.     Outpt="The monster ignores your offer!" ' make message
  1809.     Call IO.O ' send message
  1810.     Exit Sub ' exit routine
  1811.  Endif ' end compare accept flag
  1812.  Call Remove.Monster ' routine to take monster out of array
  1813.  If Player.Gold# Then ' check gold offered
  1814.     UserRecord.Gold=Player.Gold# ' decrement player gold value
  1815.     Outpt="The monster takes your offer and leaves!" ' make message
  1816.     Call IO.O ' send accept message
  1817.     Exit Sub ' exit routine
  1818.  Endif ' end check gold offered
  1819.  Call Discard.Inventory(Array.Number,True) ' remove item from player inventory
  1820.  Outpt="The monster trades with you and leaves!" ' make message
  1821.  Call IO.O ' send accept message
  1822. End Sub ' end routine to offer to monster
  1823.  
  1824.  Rem * routine to determine room direction for player to move to in panic.
  1825.  
  1826. Sub Panic
  1827.  On Local Error Resume Next ' local error resume
  1828.  Directions=False ' room direction counter
  1829.  For Direction.Number=1 To 12 ' loop through all room directions
  1830.     If RoomRecord.Direct(Direction.Number) Then ' get next room direction
  1831.        Call Restrict(Direction.Number,Restricted) ' routine checks valid room
  1832.        If Restricted=False Then ' compare restriction flag
  1833.           Directions=Directions+1 ' increment direction counter
  1834.        Endif ' end compare restricted room
  1835.     Endif ' end check next room direction
  1836.  Next ' end loop through room directions
  1837.  If Directions=False Then ' compare direction counter
  1838.     Outpt="There is nowhere to run! Try Appeal.." ' make panic error message
  1839.     Call IO.O ' send panic error message
  1840.     Exit Sub ' exit routine
  1841.  Endif ' end compare direction counter
  1842.  ' calculate random number of directions to search from direction counter
  1843.  New.Direction=Int(Rnd*Directions+1) ' calculate
  1844.  Direction.Counter=False ' reset search counter
  1845.  For Direction.Number=1 To 12 ' loop through room directions
  1846.     If RoomRecord.Direct(Direction.Number) Then ' compare room direction
  1847.        Call Restrict(Direction.Number,Restricted) ' check room restriction
  1848.        If Restricted=False Then ' check restriction flag
  1849.           Direction.Counter=Directoin.Counter+1 ' increment search counter
  1850.           If Direction.Counter=New.Direction Then ' compare counters
  1851.              ' make panic message
  1852.              Outpt="You run away like a screaming madman!"
  1853.              Call IO.O ' send panic message
  1854.              Call Fumble ' routine for inventory fumble
  1855.              ' store next room direction
  1856.              Next.Room=RoomRecord.Direct(Direction.Number)
  1857.              Call Enter.Room ' routine to move player to room
  1858.              Exit For ' exit loop through room directions
  1859.           Endif ' end compare counters
  1860.        Endif ' end check restriction flag
  1861.     Endif ' end compare room direction
  1862.  Next ' end loop through room directions
  1863. End Sub ' end routine for player panic
  1864.  
  1865.  Rem * routine to move player with low statistics or in a room with no exits.
  1866.  
  1867. Sub Appeal
  1868.  On Local Error Resume Next ' local error resume
  1869.  If UserRecord.Fatigue<(UserRecord.FatigueMax*.25) Then ' compare stats
  1870.     Outpt="You are teleported elsewhere!" ' make teleport message
  1871.     Call IO.O ' send teleport message
  1872.     Next.Room=1 ' store new room number
  1873.     Teleported=True ' set teleporting flag
  1874.     Call Enter.Room ' routine moves player to room
  1875.     Exit Sub ' exit routine
  1876.  Endif ' end compare low statistics
  1877.  For Direction.Number=1 To 12 ' loop through room directions
  1878.     If RoomRecord.Direct(Direction.Number) Then ' compare room direction
  1879.        Call Restrict(Direction.Number,Restricted) ' routine checks valid room
  1880.        If Restricted=False Then ' compare restriction flag
  1881.           Outpt="There are exits in the room!" ' make error message
  1882.           Call IO.O ' send error message
  1883.           Exit Sub ' exit routine
  1884.        Endif ' end compare restriction flag
  1885.     Endif ' end compare room directions
  1886.  Next ' end loop through room directions
  1887.  For Array.Index=1 To 20 ' loop through room objects
  1888.     Object.Number=RoomRecord.Object(Array.Index) ' get object record
  1889.     ' file bounds
  1890.     If Object.Number>False And _
  1891.     Object.Number<=Lof(ObjectFile)/Len(ObjectRecord) Then
  1892.        Call Read.Record(ObjectFile,Object.Number) ' get object record
  1893.        If ObjectRecord.RoomLink>False Then ' compare object room number
  1894.           If ObjectRecord.JailTrap=False Then ' check object jail trap
  1895.              Call Restrict(12,Restricted) ' routine checks valid room to go to
  1896.              If Restricted=False Then ' compare restriction flag
  1897.                 Outpt="There are exits in the room!" ' make error message
  1898.                 Call IO.O ' send error message
  1899.                 Exit Sub ' exit routine
  1900.              Endif ' end check restriction flag
  1901.           Endif ' end check object jail trap
  1902.        Endif ' end compare object room link number
  1903.     Endif ' end check file bounds
  1904.  Next ' end loop through objects in room
  1905.  Outpt="You are teleported elsewhere!" ' make teleport message
  1906.  Call IO.O ' send teleport message
  1907.  Next.Room=1 ' store new room number
  1908.  Number.Monsters=False ' reset number of monsters
  1909.  Teleported=True ' set teleporting flag
  1910.  Call Enter.Room ' routine moves player to room
  1911. End Sub ' end routine to appeal player to new room
  1912.  
  1913.  Rem * routine to calculate bank interest.
  1914.  
  1915. Sub Bank.Interest
  1916.  On Local Error Resume Next ' local error resume
  1917.  Outpt=UserRecord.DateOn ' get player last date online
  1918.  Call Decrypt(Outpt) ' decrypt date
  1919.  If Date$<>Outpt Then ' compare date to today
  1920.     Interest.Days=DateValue(Date$)-DateValue(Outpt) ' calculate difference
  1921.     If Interest.Days>False Then ' check difference of dates
  1922.        If UserRecord.Bank>False Then ' verify players bank balance
  1923.           Total.Interest#=False ' reset total interest
  1924.           ' loop through days since last online
  1925.           For Total.Days=1 To Interest.Days
  1926.              ' compute interest for each day
  1927.              Interest#=Int(UserRecord.Bank*.065)
  1928.              ' add interest to account
  1929.              UserRecord.Bank=UserRecord.Bank+Interest#
  1930.              Total.Interest#=Total.Interest#+Interest# ' add interest to total
  1931.           Next ' end loop through dates
  1932.           If Total.Interest#>False Then ' compare total interest
  1933.              ' make new balance message
  1934.              Outpt="The bank reports interest posting of"+ _
  1935.              Str$(Total.Interest#)+" gold to your account!"
  1936.              Call IO.O ' send display message
  1937.           Endif ' end compare interest
  1938.        Endif ' end verify bank balance
  1939.        If UserRecord.Borrow>False Then ' verify players bank loan
  1940.           Total.Interest#=False ' reset total interest
  1941.           ' loop through days since last online
  1942.           For Total.Days=1 To Interest.Days
  1943.              ' compaute interest for each day
  1944.              Interest#=Int(UserRecord.Borrow*.075)
  1945.              ' add interest to loan
  1946.              UserRecord.Borrow=UserRecord.Borrow+Interest#
  1947.              Total.Interest#=Total.Interest#+Interest# ' add interest to total
  1948.           Next ' end loop through dates
  1949.           If Total.Interest#>False Then ' compare total interest
  1950.              ' make new balance message
  1951.              Outpt="The bank reports interest posting of"+ _
  1952.              Str$(Total.Interest#)+" gold to your loan!"
  1953.              Call IO.O ' send display message
  1954.           Endif ' end compare interest
  1955.        Endif ' end verify loan balance
  1956.     Endif ' end check difference of dates
  1957.  Endif ' end compare todays date
  1958.  Outpt=Date$ ' store todays date
  1959.  Call Valid(Outpt,10) ' validate date string
  1960.  Call Encrypt(Outpt,True) ' encrypt date string
  1961.  UserRecord.DateOn=Outpt ' store new date in player record
  1962.  Call Share.Record(UserFile,User.Index) ' routine to write player record
  1963. End Sub ' end routine to calculate bank balances
  1964.  
  1965.  Rem * routine to process bank commands.
  1966.  
  1967. Sub Bank
  1968.  On Local Error Resume Next ' local error resume
  1969.  Call Put.User.Record ' routine to write user record
  1970.  Do ' loop through bank menu
  1971.     Graphics.Off=False ' reset color
  1972.     Outpt="Bank menu options:" ' make display message
  1973.     Call IO.O ' send message
  1974.     Graphics.Off=True ' reset color
  1975.     Outpt="[A]ccount" ' make display message
  1976.     Call IO.O ' send message
  1977.     Outpt="[B]orrow" ' make display message
  1978.     Call IO.O ' send message
  1979.     Outpt="[D]eposit" ' make display message
  1980.     Call IO.O ' send message
  1981.     Outpt="[P]ayback" ' make display message
  1982.     Call IO.O ' send message
  1983.     Outpt="[T]ransfer" ' make display message
  1984.     Call IO.O ' send message
  1985.     Outpt="[W]ithdraw" ' make display message
  1986.     Call IO.O ' send message
  1987.     Graphics.Off=False ' reset color
  1988.     Outpt="The broker asks: What can I do for you(q to quit)? " ' input prompt
  1989.     No.Input.Out="Q" ' default input
  1990.     Call IO.I ' get user input
  1991.     Select Case Ucase$(Inpt) ' selection of bank option
  1992.     Case "A" ' option to display bank balances
  1993.        Outpt="He fumbles with his ledgers and says:" ' make display message
  1994.        Call IO.O ' send message
  1995.        Graphics.Off=True ' reset color
  1996.        Outpt="The current account interest rate is 6.5 percent." ' message
  1997.        Call IO.O ' send message
  1998.        Outpt="The current lending interest rate is 7.5 percent." ' message
  1999.        Call IO.O ' send message
  2000.        ' make display message
  2001.        Outpt="You have"+Str$(UserRecord.Gold)+ _
  2002.        " gold and"+Str$(UserRecord.Bank)+" in the bank."
  2003.        Call IO.O ' send message
  2004.        Outpt="You have borrowed"+Str$(UserRecord.Borrow)+ _
  2005.        " gold from the bank." ' make display message
  2006.        Call IO.O ' send message
  2007.     Case "B" ' option to borrow gold from bank
  2008.        Outpt="How much will you borrow(1-32767)? " ' make input prompt
  2009.        Call IO.I ' get user input
  2010.        Borrow.Amount#=Cdbl(Int(Val(Inpt))) ' convert input to double
  2011.        ' compare input range
  2012.        If Borrow.Amount#<=False Or Borrow.Amount#>MaxInt Then
  2013.           Outpt="The broker says: You can't borrow that much!" ' make message
  2014.           Call IO.O ' send message
  2015.        Else ' check input range
  2016.           Outpt="The broker hands you the gold." ' make display message
  2017.           Call IO.O ' send message
  2018.           ' add gold to player gold
  2019.           UserRecord.Gold=UserRecord.Gold+Borrow.Amount#
  2020.           ' add gold to player loan
  2021.           UserRecord.Borrow=UserRecord.Borrow+Borrow.Amount#
  2022.        Endif ' end check input range
  2023.     Case "D" ' option to deposit gold in bank
  2024.        If UserRecord.Gold<=False Then ' check player gold
  2025.           Outpt="You have no gold to deposit!" ' make display message
  2026.           Call IO.O ' send message
  2027.        Else ' check player gold
  2028.           Outpt="How much(1-"+Mid$(Str$(UserRecord.Gold),2)+")? " ' prompt
  2029.           Call IO.I ' get user input
  2030.           Deposit.Amount#=Cdbl(Int(Val(Inpt))) ' convert input to double
  2031.           ' compare input range
  2032.           If Deposit.Amount#<=False Or Deposit.Amount#>UserRecord.Gold Then
  2033.              Outpt="You don't have that much gold!" ' make display message
  2034.              Call IO.O ' send message
  2035.           Else ' check input range
  2036.              ' add gold to bank account
  2037.              UserRecord.Bank=UserRecord.Bank+Deposit.Amount#
  2038.              ' subtract gold from player
  2039.              UserRecord.Gold=UserRecord.Gold-Deposit.Amount#
  2040.              Outpt="You hand him the gold." ' make display message
  2041.              Call IO.O ' send message
  2042.           Endif ' end check input range
  2043.        Endif ' end check player gold
  2044.     Case "P" ' option to pay back loan
  2045.        If UserRecord.Borrow<=False Then ' check player loan
  2046.           Outpt="You don't have any loan with the bank!" ' make message
  2047.           Call IO.O ' send message
  2048.        Else ' check loan
  2049.           If UserRecord.Bank>False Then ' check player bank account
  2050.              Outpt="The broker asks: Pay back with your current bank account? "
  2051.              No.Input.Out="Y" ' default input
  2052.              Call IO.I ' get user input
  2053.              If Yes Then ' check input response
  2054.                 ' compute difference between player bank account and loan
  2055.                 If UserRecord.Borrow-UserRecord.Bank<=False Then ' compute
  2056.                    ' subtract loan from player bank account
  2057.                    UserRecord.Bank=UserRecord.Bank-UserRecord.Borrow ' subtract
  2058.                    UserRecord.Borrow=False ' reset loan amount
  2059.                    Outpt="The broker says: Your loan is paid off!" ' message
  2060.                    Call IO.O ' send message
  2061.                 Else ' check computation
  2062.                    ' subtract player bank account from loan
  2063.                    UserRecord.Borrow=UserRecord.Borrow-UserRecord.Bank
  2064.                    UserRecord.Bank=False ' reset player bank account
  2065.                    Outpt="The broker says: Your balance paid part of the loan!"
  2066.                    Call IO.O ' send display message
  2067.                 Endif ' end check loan/bank account difference
  2068.              Endif ' end check user input
  2069.           Endif ' end check player bank account
  2070.           If UserRecord.Borrow>False Then ' check player loan amount
  2071.              If UserRecord.Gold>False Then ' check player gold
  2072.                 Outpt="The broker asks: Pay back with your current gold? "
  2073.                 No.Input.Out="Y" ' default input
  2074.                 Call IO.I ' get user input
  2075.                 If Yes Then ' check input response
  2076.                    ' compute difference between player gold and loan
  2077.                    If UserRecord.Borrow-UserRecord.Gold<=False Then ' compute
  2078.                       ' subtract loan from player gold
  2079.                       UserRecord.Gold=UserRecord.Gold-UserRecord.Borrow
  2080.                       UserRecord.Borrow=False ' reset loan
  2081.                       Outpt="The broker says: Your loan is paid off!" ' message
  2082.                       Call IO.O ' send message
  2083.                    Else ' check computation
  2084.                       ' subtract player gold from loan
  2085.                       UserRecord.Borrow=UserRecord.Borrow-UserRecord.Gold
  2086.                       UserRecord.Gold=False ' reset player gold
  2087.                       Outpt="The broker says: Your gold paid part of the loan!"
  2088.                       Call IO.O ' send display message
  2089.                    Endif ' end loan/player gold difference
  2090.                 Endif ' end check user input
  2091.              Endif ' end check player gold
  2092.           Endif ' end check player loan
  2093.        Endif ' end check player loan
  2094.     Case "T" ' option to tranfer bank funds to another player
  2095.        If UserRecord.Bank<=False Then ' check player bank account
  2096.           Outpt="You have nothing in your account to transfer!" ' make message
  2097.           Call IO.O ' send message
  2098.        Else ' check player bank account
  2099.           Outpt="How much(1-"+Mid$(Str$(UserRecord.Bank),2)+")? " ' prompt
  2100.           Call IO.I ' get user input
  2101.           Transfer.Amount#=Cdbl(Int(Val(Inpt))) ' convert input to double
  2102.           ' check input range
  2103.           If Transfer.Amount#<=False Or Transfer.Amount#>UserRecord.Bank Then
  2104.              Outpt="You don't have that much gold in the bank!" ' make message
  2105.              Call IO.O ' send message
  2106.           Else ' check input range
  2107.              Call Share.Record(UserFile,User.Index) ' write current user record
  2108.              Outpt="Transfer to what player? " ' make input prompt
  2109.              Call IO.I ' get user input
  2110.              Inpt=Ucase$(Inpt) ' uppercase input
  2111.              Inpt=Rtrim$(Inpt) ' trim input
  2112.              Player.Found=False ' reset player found flag
  2113.              For User.Number=1 To Lof(UserFile)/Len(UserRecord) ' loop file
  2114.                 Call Read.Record(UserFile,User.Number) ' read user record
  2115.                 Outpt=UserRecord.CodeName ' store codename
  2116.                 Call Decrypt(Outpt) ' decrypt name
  2117.                 Outpt=Rtrim$(Outpt) ' trim name
  2118.                 If Outpt<>Deleted$ Then ' compare deleted codename
  2119.                    If Outpt<>Dead$ Then ' compare dead codename
  2120.                       If Outpt=Inpt Then ' compare codename to transfer
  2121.                          If User.Index<>User.Number Then ' check indexes
  2122.                             If (UserRecord.Flags And Locked.User)=False Then
  2123.                                Player.Found=True ' set player found flag
  2124.                                ' add amount to tranfer to player account
  2125.                                UserRecord.Bank=UserRecord.Bank+Transfer.Amount#
  2126.                                Call Share.Record(UserFile,User.Number) ' write
  2127.                                Exit For ' exit loop through user file
  2128.                             Endif ' end check locked user record
  2129.                          Endif ' end check indexes
  2130.                       Endif ' end check codename
  2131.                    Endif ' end check dead codename
  2132.                 Endif ' end check deleted codename
  2133.              Next ' end loop through user file records
  2134.              If Player.Found Then ' check player found flag
  2135.                 Outpt="The broker works with his ledgers for a while,"
  2136.                 Call IO.O ' send display message
  2137.                 Outpt="And says: "+Mid$(Str$(Transfer.Amount#),2)+ _
  2138.                 " gold transferred to his account."
  2139.                 Call IO.O ' send display message
  2140.              Else ' check player found flag
  2141.                 Transfer.Amount#=False ' reset gold tranfered
  2142.                 Outpt="There's nobody in my ledgers with that name!"
  2143.                 Call IO.O ' send display message
  2144.              Endif ' end check player found flag
  2145.              Call Read.Record(UserFile,User.Index) ' read current user record
  2146.              ' subtract amount tranfered
  2147.              UserRecord.Bank=UserRecord.Bank-Transfer.Amount#
  2148.           Endif ' end check input range
  2149.        Endif ' end check player bank account
  2150.     Case "W" ' option to withdraw gold from bank account
  2151.        If UserRecord.Bank<=False Then ' check bank account
  2152.           Outpt="You have nothing to withdraw!" ' make display message
  2153.           Call IO.O ' send message
  2154.        Else ' check bank account
  2155.           If UserRecord.Borrow>False Then ' check bank loan
  2156.              Outpt="You must pay back your loan first!" ' make display message
  2157.              Call IO.O ' send message
  2158.           Else ' check bank loan
  2159.              Outpt="How much(1-"+Mid$(Str$(UserRecord.Bank),2)+")? " ' prompt
  2160.              Call IO.I ' get user input
  2161.              Withdraw.Amount#=Cdbl(Int(Val(Inpt))) ' convert input to double
  2162.              If Withdraw.Amount#<=False Or _
  2163.              Withdraw.Amount#>UserRecord.Bank Then ' check input range
  2164.                 Outpt="You don't have that much gold!" ' make display message
  2165.                 Call IO.O ' send message
  2166.              Else ' check input range
  2167.                 ' subtract from bank
  2168.                 UserRecord.Bank=UserRecord.Bank-Withdraw.Amount#
  2169.                 UserRecord.Gold=UserRecord.Gold+Withdraw.Amount# ' add to gold
  2170.                 Outpt="The broker hands you the gold." ' make message
  2171.                 Call IO.O ' send message
  2172.              Endif ' end check input range
  2173.           Endif ' end check bank loan
  2174.        Endif '  end check bank account
  2175.     Case "Q" ' option to exit bank menu
  2176.        Exit Do ' exit bank menu
  2177.     End Select ' end selection of bank option
  2178.  Loop ' end loop through bank menu
  2179. End Sub ' end bank routine
  2180.