home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / DNDOOR46.ZIP / DNDS5.BAS < prev    next >
BASIC Source File  |  2001-07-11  |  108KB  |  2,181 lines

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