 Rem File: Showroom.bas - for Cmd*.bas modules
 Rem $Include: 'dndbbs.inc'

Sub Show.Room
 On Local Error Goto ErrorTrp36
 Call Check.Lit.Room(Var)
 If Var Then
    Strng="It's too dark to see!"
    Call IO.O
    Exit Sub
 Endif
 Graphics.Off=True
 Call Display.Room.Debug
 Call Display.Room.Desc
 Call Display.Room.Exits

 ' online users
 Temp1=False
 Call Search.Mess(-1!)
 Strng=Nul
 For Temp5=1 To MaxNodes
    If Temp5<>Node Then
       If Rtrim$(Node.Work.Array1(Temp5))<>Nul Then
	  TempX=True
          Call Read.Message.Record(MessWorkFile1,Temp5+1)
	  If MessWorkRecord1.Invisible Then
	     If Normal.User Then
		TempX=False
	     Endif
             If Node.Work.Array2(Temp5)>32000 Then ' ghod
                TempX=False
             Endif
	  Endif
          If MessWorkRecord1.Monitor Then
             TempX=False
	  Endif
	  If TempX Then
	     Carriage.Return=True
	     Call IO.O
	     Temp1=Temp1+1

	     Strng=Rtrim$(Node.Work.Array1(Temp5))
	     Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))

             Var6=Node.Work.Array2(Temp5)
             Select Case Var6
             Case 0
                Strng2="zero"
             Case 1 To 10
                Strng2=Rtrim$(Numeral(Var6))
             Case Else
                Strng2=Form$(Cdbl(Var6))
             End Select

             If Node.Work.Array2(Temp5)>0 Then
                Strng=Strng+" (level "+Strng2+")"
             Endif

             Strng=Strng+" [online]"

             If Node.Work.Array2(Temp5)=0 Then
                Strng=Strng+" [dead]"
             Endif

	     If MessWorkRecord1.Invisible Then
                Strng=Strng+" [inv]"
	     Endif
             Strng=Strng+", "
	  Endif
       Endif
    Endif
 Next
 If Temp1 Then
    Strng=Left$(Strng,Len(Strng)-2)
 Endif
 If Temp1>1 Then
    Strng="and "+Strng+" are here!"
    Call IO.O
 Else
    If Temp1=1 Then
       Strng=Strng+" is here!"
       Call IO.O
    Endif
 Endif
 If UserRecord.Brief=False Then
    Strng="You see "
    Carriage.Return=True
    Call IO.O
 Endif
 Allow.Break=True
 Break=False
 Strng=Nul
 Strng2=Nul
 Temp8=False
 Temp9=False

 ' offline users
 Allow.Break=True
 If Break Then
    Goto End.Display
 Endif
 Break=False
 If Config2(19) Then
    For User.Temp=1! To Lof(MessWorkFile4)/MessWorkRecLen4
       Call Read.Record(MessWorkFile4,User.Temp)
       If MessWorkRecord4.Room=Room Then
          If MessWorkRecord4.Index<>User.Index Then
             Call Read.Record(UserFile2,MessWorkRecord4.Index)
             ' find team member
             Var4=False
             For Var!=1! To Lof(TeamFile)/TeamRecLen
                Call Read.Record(TeamFile,Var!)
                If TeamRecord.Deleted=False Then
                   For VarY=1 To MaxTeamMembers
                      If TeamRecord.UserIndex(VarY)=MessWorkRecord4.Index Then
                         If TeamRecord.Activated(VarY) Then
                            ' see if offline user is in current user team
                            For VarZ=1 To MaxTeamMembers
                               If TeamRecord.UserIndex(VarZ)=User.Index Then
                                  Var4=True
                                  Exit For
                               Endif
                            Next
                            If Var4 Then
                               Exit For
                            Endif
                         Endif
                      Endif
                      If Var4 Then
                         Exit For
                      Endif
                   Next
                Endif
                If Var4 Then
                   Exit For
                Endif
             Next
             If Break Then
                Goto End.Display
             Endif
             Var=True
             If UserRecord2.Invisible Then
                If Normal.User Then
                   Var=False
                Endif
             Endif
             If Var Then
                Temp9=Temp9+1
                If Temp9=1 Then
                   If UserRecord.Brief Then
                      Strng="You see "
                      Carriage.Return=True
                      If Break Then
                         Goto End.Display
                      Endif
                      Call IO.O
                   Endif
                Endif
                Call Convert.ANSI(True,VarQ,VarR)
                Carriage.Return=True
                Graphics.On=True
                Call IO.O
                Graphics.On=False
                If Len(Strng2) Then
                   Carriage.Return=True
                   Strng=Strng2
                   Call IO.O
                Endif
                Out3=Lcase$(Rtrim$(UserRecord2.CodeName))
                Mid$(Out3,1,1)=Ucase$(Mid$(Out3,1,1))
                Strng=Rtrim$(UserRecord2.Prefix1)+Out3

                Strng2=Nul

                Var6=UserRecord2.Level
                Select Case Var6
                Case 0
                   Strng3="zero"
                Case 1 To 10
                   Strng3=Rtrim$(Numeral(Var6))
                Case Else
                   Strng3=Form$(Cdbl(Var6))
                End Select

                If UserRecord2.Level>0 Then
                   Strng2=" (level "+Strng3+")"
                Endif

                Strng2=Strng2+" [offline]"
                If Var4 Then
                   Strng2=Strng2+" [team]"
                Endif
                If UserRecord2.Level=0 Then
                   Strng2=Strng2+" [dead]"
                Endif
                If UserRecord2.Invisible Then
                   Strng2=Strng2+" [inv]"
                Endif
                Strng2=Strng2+", "
                Temp8=True
             Endif
          Endif
       Endif
    Next
 Endif

 ' online monsters
 Allow.Break=True
 If Break Then
    Goto End.Display
 Endif
 Break=False
 If Config2(19) Then
    For Monster.Temp=1! To Lof(MessWorkFile3)/MessWorkRecLen3
       Call Read.Record(MessWorkFile3,Monster.Temp)
       If MessWorkRecord3.Room=Room Then
          TempZ=False
          ' invisible monster
          If MessWorkRecord3.Monster.Invisible Then
             If Normal.User Then
                TempZ=True
            Endif
          Endif
          If TempZ=False Then
             Carriage.Return=True
             If Break Then
                Goto End.Display
             Endif
             Call Convert.ANSI(True,VarQ,VarR)
             Carriage.Return=True
             Graphics.On=True
             Call IO.O
             Graphics.On=False
             If Len(Strng2) Then
                Carriage.Return=True
                Strng=Strng2
                Call IO.O
             Endif
             Strng2=Nul
             Temp9=Temp9+1
             If Temp9=1 Then
                If UserRecord.Brief Then
                   Strng="You see "
                   Carriage.Return=True
                   If Break Then
                      Goto End.Display
                   Endif
                   Call IO.O
                Endif
             Endif
             Call The.Or.An
             Out3=Ltrim$(Rtrim$(MessWorkRecord3.Monster.Prefix1))
             Out3=Out3+Rtrim$(MessWorkRecord3.Monster.MonsterName)
             Strng=Prefix1+Out3
             If MessWorkRecord3.Monster.Permanent=-2 Then
                Strng2=" [perm]"
             Endif
             If MessWorkRecord3.Monster.Invisible Then
                Strng2=" [inv]"
             Endif
             Strng2=Strng2+", "
             Temp8=True
          Endif
       Endif
    Next
 Endif

 ' room inventory
 If Config2(20) Then
    Temp5!=RoomRecord.First
    If Temp5! Then
       Do While Lost.Carrier=False
          Call Read.Record(RoomInvFile,Temp5!)
          If MessWorkRecord6.Room=SFalse Then
             Exit Do
          Endif
          Temp6!=MessWorkRecord6.Next
          Temp2!=MessWorkRecord6.Index
          If MessWorkRecord6.Room<SFalse Then
             ' trapped objects
             If MessWorkRecord6.Plus=Magic.Trap Then
                If Normal.User=False Then
                   Carriage.Return=True
                   If Break Then
                      Goto End.Display
                   Endif
                   Call IO.O
                   If Len(Strng2) Then
                      Carriage.Return=True
                      Strng=Strng2
                      Call IO.O
                   Endif
                   Temp9=Temp9+1
                   If Temp9=1 Then
                      If UserRecord.Brief Then
                         Strng="You see "
                         Carriage.Return=True
                         If Break Then
                            Goto End.Display
                         Endif
                         Call IO.O
                      Endif
                   Endif
                   Temp10=MessWorkRecord6.Charges
                   Strng="a magical trap ["+Mid$(Str$(Temp10),2)+" hits]"
                   Strng2=", "
                   Temp8=True
                Endif
             Endif
          Endif
          ' objects
          If Temp2!<SFalse Then
             Temp2!=Abs(Temp2!)
             If Temp2!>SFalse And Temp2!<=Lof(ObjectFile)/ObjectRecLen Then
                TempZ=False
                ' hidden/invisible objects
                Call Read.Record(ObjectFile,Temp2!)
                If MessWorkRecord6.Plus=Hidden.Object Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If ObjectRecord.Invisible Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If ObjectRecord.Hidden Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If TempZ=False Then
                   Carriage.Return=True
                   If Break Then
                      Goto End.Display
                   Endif
                   Call Convert.ANSI(True,VarQ,VarR)
                   Carriage.Return=True
                   Graphics.On=True
                   Call IO.O
                   Graphics.On=False
                   If Len(Strng2) Then
                      Carriage.Return=True
                      Strng=Strng2
                      Call IO.O
                   Endif
                   Temp9=Temp9+1
                   If Temp9=1 Then
                      If UserRecord.Brief Then
                         Strng="You see "
                         Carriage.Return=True
                         If Break Then
                            Goto End.Display
                         Endif
                         Call IO.O
                      Endif
                   Endif
                   Strng=Rtrim$(ObjectRecord.Prefix1)
                   Strng=Strng+Rtrim$(ObjectRecord.ObjectName)
                   Strng2=Nul
                   If ObjectRecord.DoorLock>1 Then
                      Strng2=Strng2+" [locked]"
                   Else
                      If ObjectRecord.DoorLock Then
                         If ObjectRecord.Closed Then
                            Strng2=Strng2+" [closed]"
                         Endif
                      Endif
                   Endif
                   If ObjectRecord.Hidden Then
                      Strng2=Strng2+" [hidden]"
                   Else
                      If ObjectRecord.Invisible Then
                         Strng2=Strng2+" [inv]"
                      Else
                         If MessWorkRecord6.Plus=Hidden.Object Then
                            Strng2=Strng2+" [inv]"
                         Endif
                      Endif
                   Endif
                   If Sysop And Debug.Mode Then
                      Strng3=Rtrim$(ObjectRecord.PortalPassword)
                      If Len(Strng3) Then
                         Call Crypto(Strng3)
                         Strng2=Strng2+" {"+Lcase$(Strng3)+"}"
                      Endif
                   Endif
                   Strng2=Strng2+", "
                   Temp8=True
                Endif
             Endif
          Else
             ' treasure
             If Temp2!>SFalse And Temp2!<=Lof(TreasureFile)/TreasureRecLen Then
                Call Read.Record(TreasureFile,Temp2!)
                TempZ=False
                If MessWorkRecord6.Plus>=Hidden.Object Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                Call Read.Record(TreasureFile,Temp2!)
                If TreasureRecord.Invisible Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If TempZ=False Then
                   Carriage.Return=True
                   If Break Then
                      Goto End.Display
                   Endif
                   Call Convert.ANSI(True,VarQ,VarR)
                   Carriage.Return=True
                   Graphics.On=True
                   Call IO.O
                   Graphics.On=False
                   If Len(Strng2) Then
                      Carriage.Return=True
                      Strng=Strng2
                      Call IO.O
                   Endif
                   Temp9=Temp9+1
                   If Temp9=1 Then
                      If UserRecord.Brief Then
                         Strng="You see "
                         Carriage.Return=True
                         If Break Then
                            Goto End.Display
                         Endif
                         Call IO.O
                      Endif
                   Endif
                   Strng=Rtrim$(TreasureRecord.Prefix1)
                   Strng=Strng+Rtrim$(TreasureRecord.TreasureName)
                   Strng2=Nul
                   Temp1=TreasureRecord.Plus
                   If Temp1 Then
                      Call Treasure.Plus
                      If Out2<>Nul Then
                         Strng2=Strng2+" "+Out2
                      Endif
                   Endif
                   If TreasureRecord.Vehicle Then
                      If Temp1>False Then
                         Strng2=Strng2+" (+"+Mid$(Str$(Temp1),2)+")"
                      Endif
                   Endif
                   If TreasureRecord.Spell Then
                      Call Read.Record(SpellFile,TreasureRecord.Spell)
                      Strng2=Strng2+" (+"+Mid$(Str$(SpellRecord.Level),2)+")"
                   Endif
                   If TreasureRecord.LightType Then
                      If MessWorkRecord6.Charges<False Then
                         Strng2=Strng2+" [lit]"
                      Endif
                   Endif
                   If TreasureRecord.Invisible Then
                      Strng2=Strng2+" [inv]"
                   Else
                      If MessWorkRecord6.Plus=Hidden.Object Then
                         Strng2=Strng2+" [inv]"
                      Endif
                   Endif
                   If MessWorkRecord6.Plus=Magic.Trap Then
                      Strng2=Strng2+" [trap]"
                   Endif
                   If MessWorkRecord6.Plus=Magically.Hidden Then
                      Strng2=Strng2+" [inv(magic)]"
                   Endif
                   Strng2=Strng2+", "
                   Temp8=True
                Endif
             Endif
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp5!=Temp6!
       Loop
    Endif
 Endif

 ' containers
 Allow.Break=True
 If Break Then
    Goto End.Display
 Endif
 Break=False
 Temp5!=RoomRecord.First2
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Temp5!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             TempZ=False
             If ContainerRecord.InvisibleContainer Then
                If Normal.User Then
                   TempZ=True
                Endif
             Endif
             If Rtrim$(ContainerRecord.ContainerName)=Nul Then
                TempZ=True
             Endif
             If TempZ=False Then
                Carriage.Return=True
                If Break Then
                   Goto End.Display
                Endif
                Call Convert.ANSI(True,VarQ,VarR)
                Carriage.Return=True
                Graphics.On=True
                Call IO.O
                Graphics.On=False
                If Len(Strng2) Then
                   Carriage.Return=True
                   Strng=Strng2
                   Call IO.O
                Endif
                Temp9=Temp9+1
                If Temp9=1 Then
                   If UserRecord.Brief Then
                      Strng="You see "
                      Carriage.Return=True
                      If Break Then
                         Goto End.Display
                      Endif
                      Call IO.O
                   Endif
                Endif
                Strng=Rtrim$(ContainerRecord.Prefix1)
                Strng=Strng+Rtrim$(Lcase$(ContainerRecord.ContainerName))
                Temp8=True
                Strng2=Nul
                If ContainerRecord.Locked=True Then
                   Strng2=Strng2+" [locked]"
                Endif
                If ContainerRecord.Locked=1 Then
                   If ContainerRecord.Closed Then
                      Strng2=Strng2+" [closed]"
                   Endif
                Endif
                If ContainerRecord.InvisibleContainer Then
                   Strng2=Strng2+" [inv]"
                Endif
                If ContainerRecord.KeyNumber Then
                   Strng2=Strng2+" (#"+Right$(Mid$(Str$(ContainerRecord.KeyNumber+1000000!),2),6)+")"
                Endif
                Strng2=Strng2+", "
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Var6!
    Loop
 Endif
 If Break Then
    Goto End.Display
 Endif

 ' display coins
 Call Find.Coins(VarQ,0)
 If VarQ Then
    Temp8=True
    Call Convert.ANSI(True,VarX,VarY)
    Carriage.Return=True
    Graphics.On=True
    Call IO.O
    Graphics.On=False
    If Len(Strng2) Then
       Carriage.Return=True
       Strng=Strng2
       Call IO.O
    Endif
    If VarQ=1 Then
       Strng2="some coins, "
    Else
       Strng2=Mid$(Str$(VarQ),2)+" piles of coins, "
    Endif
    Temp9=Temp9+1
    If Temp9=1 Then
       If UserRecord.Brief Then
          Strng="You see "
          Carriage.Return=True
          If Break Then
             Goto End.Display
          Endif
          Call IO.O
       Endif
    Endif
 Endif
 If Break Then
    Goto End.Display
 Endif

 ' display hidden coins
 Call Find.Coins(VarQ,-1)
 If VarQ Then
    Temp6=False
    If Sysop Then
       Temp8=True
       Call Convert.ANSI(True,VarX,VarY)
       Carriage.Return=True
       Graphics.On=True
       Call IO.O
       Graphics.On=False
       If Len(Strng2) Then
          Carriage.Return=True
          Strng=Strng2
          Call IO.O
       Endif
       If VarQ=1 Then
          Strng2="some coins [inv], "
       Else
          Strng2=Mid$(Str$(VarQ),2)+" piles of coins [inv], "
       Endif
       Temp9=Temp9+1
       If Temp9=1 Then
          If UserRecord.Brief Then
             Strng="You see "
             Carriage.Return=True
             If Break Then
                Goto End.Display
             Endif
             Call IO.O
          Endif
       Endif
    Endif
    If Break Then
       Goto End.Display
    Endif
 Endif

 If Temp8=False Then
    If UserRecord.Brief=False Then
       Strng="nothing special."
    Else
       Strng="You see nothing."
    Endif
 Else
    If Temp9>1 Then
       Strng="and "+Strng
    Endif
 Endif

End.Display:
 Allow.Break=False
 Break=False
 Call Convert.ANSI(True,VarQ,VarR)
 Carriage.Return=True
 Graphics.On=True
 Call IO.O
 Graphics.On=False
 If Len(Strng2) Then
    Strng=Left$(Strng2,Len(Strng2)-2)+"."
 Else
    Strng="."
 Endif
 Call IO.O
ErrorRsm36:
 Exit Sub
ErrorTrp36:
 Resume ErrorRsm36
End Sub

Sub Display.Room.Debug
 On Local Error Goto ErrorTrp36c
 If Debug.Mode Then
    Graphics.Off=True
    Strng="Debug: (room: "+Form$(Cdbl(Room))+","
    Call Safe.Room
    If TempA Then
       Strng=Strng+" <safe haven>,"
    Else
       If RoomRecord.MonClass=0 Then
          Strng=Strng+" monclass: 0,"
       Else
          Strng=Strng+" monclass: "+Form$(Cdbl(RoomRecord.MonClass))+","
       Endif
    Endif
    If RoomRecord.Action=0 Then
       Strng=Strng+" action: 0)."
    Else
       Strng=Strng+" action: "+Form$(Cdbl(RoomRecord.Action))+")."
    Endif
    Call IO.O
 Endif
ErrorRsm36c:
 Exit Sub
ErrorTrp36c:
 Resume ErrorRsm36c
End Sub

Sub Display.Room.Desc
 On Local Error Goto ErrorTrp36d
 TempX=False
 If UserRecord.Brief=False Then
    For TempY=1 To 19
       TempZ!=RoomRecord.LongDesc(TempY)
       If TempZ!>SFalse And TempZ!<=Lof(RoomDescFile)/RoomDescLen Then
          Call Read.Record(RoomDescFile,TempZ!)
          Strng=BufferRecord.Buffer
          Strng=Rtrim$(Strng)
          Call Convert.String
          Call Convert.ANSI(True,VarQ,VarR)
	  TempX=True
          Graphics.On=True
	  Call IO.O
          Graphics.On=False
       Endif
    Next
 Endif
 If TempX=False Then
    Strng=RoomRecord.ShortDesc
    Strng=Rtrim$(Strng)
    If Instr(Strng,Chr$(0)) Then
       Strng=Left$(Strng,Instr(Strng,Chr$(0))-1)
    Endif
    If Len(Strng) Then
       Call Convert.String
       Call Convert.ANSI(True,VarQ,VarR)
       Graphics.On=True
       Call IO.O
       Graphics.On=False
    Endif
 Endif
ErrorRsm36d:
 Exit Sub
ErrorTrp36d:
 Resume ErrorRsm36d
End Sub

Sub Display.Room.Exits
 On Local Error Goto ErrorTrp36e
 Temp=False
 If Config2(18) Then
    VarQ=False
    Var!=RoomRecord.Action
    If Var!>SFalse And Var!<=Lof(ActionFile)/ActionRecLen Then
       Call Read.Record(ActionFile,Var!)
       VarQ=ActionRecord.Hidden
    Endif
    If UserRecord.Brief Then
       Strng=Nul
    Else
       Strng="The exits are "
    Endif
    For Temp5=1 To MaxDirections
       If RoomRecord.Direct(Temp5) Then
          If (VarQ And 2^Temp5)=False Then
             Strng=Strng+Rtrim$(Direction(Temp5))+", "
             Temp=True
          Endif
       Endif
    Next
    Var$=Rtrim$(RoomRecord.Custom1)
    If Var$=String$(12,Chr$(0)) Then
       Var$=Nul
    Else
       If Len(Var$) Then
          If RoomRecord.Direct(13)>SFalse Then
             If (VarQ And 2^13)=False Then
                Strng=Strng+Lcase$(Rtrim$(Var$))+", "
                Temp=True
             Endif
          Endif
       Endif
    Endif
    Var$=Rtrim$(RoomRecord.Custom2)
    If Var$=String$(12,Chr$(0)) Then
       Var$=Nul
    Else
       If Len(Var$) Then
          If RoomRecord.Direct(14)>SFalse Then
             If (VarQ And 2^14)=False Then
                Strng=Strng+Lcase$(Rtrim$(Var$))+", "
                Temp=True
             Endif
          Endif
       Endif
    Endif
    Call Find.Custom(Var, Var$)
    If Var Then
       Temp=True
       Strng=Strng+Var$
    Endif
    If Temp Then
       Strng=Left$(Strng,Len(Strng)-2)+"."
       If UserRecord.Brief Then
	  Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
       Endif
       Call IO.O
    Endif
 Endif
ErrorRsm36e:
 Exit Sub
ErrorTrp36e:
 Resume ErrorRsm36e
End Sub

Sub Find.Custom(Var, Var$)
 On Local Error Goto Err.Trp19a
 Var=False
 Var1=0
 Var$=""
 Filename=DND.Path+"custom.dat"
 If Dir$(Filename)<>"" Then
    Close #TempFile1
    Open Filename For Input Shared As #TempFile1
    Do
       If Eof(TempFile1) Then Exit Do
       Input #TempFile1,Var1$,Var1!,Var2!,X,Y
       If Var1!=Room Then
          If X=0 Then ' invisible
             Var=True
             Var$=Var$+Lcase$(Var1$)+", "
          Endif
       Endif
    Loop
 Endif
Err.Rsm19a:
 Exit Sub
Err.Trp19a:
 Resume Err.Rsm19a
End Sub

Sub Reset.Room.Rates
 On Local Error Goto ErrorTrp36z
 Room.Monster.Rate=Config2(11)
 Room.Health.Rate=Config2(10)
 Call Read.Record(RoomFile,Room)
 Var!=RoomRecord.Action
 If Var!>SFalse And Var!<=Lof(ActionFile)/ActionRecLen Then
    Call Read.Record(ActionFile,Var!)
    If ActionRecord.RustRate>False Then
       Room.Rust.Rate=ActionRecord.RustRate
    Endif
    If ActionRecord.StealRate>False Then
       Room.Steal.Rate=ActionRecord.StealRate
    Endif
    If ActionRecord.EncounterRate Then
       Room.Monster.Rate=ActionRecord.EncounterRate
    Endif
    If ActionRecord.HealthRate Then
       Room.Health.Rate=ActionRecord.HealthRate
    Endif
 Endif
ErrorRsm36z:
 Exit Sub
ErrorTrp36z:
 Resume ErrorRsm36z
End Sub

Sub Display.Sorted.Room
 On Local Error Goto ErrorTrp36b
 Call Check.Lit.Room(Var)
 If Var Then
    Strng="It's too dark to see!"
    Call IO.O
    Exit Sub
 Endif
 Graphics.Off=True
 Call Display.Room.Debug
 Call Display.Room.Desc
 Call Display.Room.Exits
 Temp9=False
 TempD=16
 Redim Sort.Array1(1 To 16) As String*32, _
 Sort.Array2(1 To 16) As Integer
 VarX=Parse.Temp
 Select Case Parse.Temp
 Case 0
    Gosub Read.Online.Players
    Gosub Read.Offline.Players
    Gosub Read.Monsters
    Gosub Read.Objects
    Gosub Read.Treasure
    Gosub Read.Containers
 Case 1
    Gosub Read.Online.Players
 Case 2
    Gosub Read.Offline.Players
 Case 3
    Gosub Read.Monsters
 Case 4
    Gosub Read.Objects
 Case 5
    Gosub Read.Treasure
 Case 6
    Gosub Read.Containers
 Case 7
    Call Find.Coins(VarQ1,0) ' visible
    Call Find.Coins(VarQ2,-1) ' invisible
    If VarQ1=0 And VarQ2=0 Then
       Strng="You see nothing."
       Call IO.O
       Exit Sub
    Endif
    Strng=Nul
    If VarQ1 Then
       If VarQ1=1 Then
          Strng="You see some coins"
       Else
          Strng="You see"+Str$(VarQ1)+" piles of coins"
       Endif
    Endif
    If VarQ2 Then
       If Sysop Then
          If VarQ2=1 Then
             If VarQ1 Then
                Strng=Strng+", and some coins [inv]"
             Else
                Strng="You see some coins [inv]"
             Endif
          Else
             If VarQ1 Then
                Strng=Strng+", and"+Str$(VarQ2)+" piles of coins [inv]"
             Else
                Strng="You see"+Str$(VarQ2)+" piles of coins [inv]"
             Endif
          Endif
       Endif
    Endif
    Strng=Strng+"."
    Call IO.O
    Exit Sub
 Case Else
    Strng="You see nothing."
    Call IO.O
    Exit Sub
 End Select
 If Temp9=False Then
    Strng="You see nothing."
    Call IO.O
 Else
    Call Sort.Inv(True)
    Call Display.Sorted.Array(True)
 Endif
 Erase Sort.Array1,Sort.Array2
 Exit Sub

Read.Online.Players:
 Call Search.Mess(-1!)
 For Temp5=1 To MaxNodes
    If Temp5<>Node Then
       If Rtrim$(Node.Work.Array1(Temp5))<>Nul Then
	  TempX=True
          Call Read.Message.Record(MessWorkFile1,Temp5+1)
	  If MessWorkRecord1.Invisible Then
	     If Normal.User Then
		TempX=False
	     Endif
             If Node.Work.Array2(Temp5)>32000 Then ' ghod
                TempX=False
             Endif
	  Endif
          If MessWorkRecord1.Monitor Then
             TempX=False
	  Endif
	  If TempX Then
             TempA=True
             Strng=Lcase$(Node.Work.Array1(Temp5))
             Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
             Call Add.Sort.Inv
	  Endif
       Endif
    Endif
 Next
 Return

Read.Offline.Players:
 If Config2(19) Then
    For User.Temp=1! To Lof(MessWorkFile4)/MessWorkRecLen4
       Call Read.Record(MessWorkFile4,User.Temp)
       If MessWorkRecord4.Room=Room Then
          Call Read.Record(UserFile2,MessWorkRecord4.Index)
          Strng=Lcase$(UserRecord2.CodeName)
          Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
          TempA=True
          Call Add.Sort.Inv
       Endif
    Next
 Endif
 Return

Read.Objects:
 If Config2(20) Then
    Temp5!=RoomRecord.First
    If Temp5! Then
       Do While Lost.Carrier=False
          Call Read.Record(RoomInvFile,Temp5!)
          If MessWorkRecord6.Room=SFalse Then
             Exit Do
          Endif
          Temp6!=MessWorkRecord6.Next
          Temp2!=MessWorkRecord6.Index
          If Temp2!<SFalse Then
             Temp2!=Abs(Temp2!)
             If Temp2!>SFalse And Temp2!<=Lof(ObjectFile)/ObjectRecLen Then
                TempZ=False
                Call Read.Record(ObjectFile,Temp2!)
                If MessWorkRecord6.Plus=Hidden.Object Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If ObjectRecord.Invisible Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If ObjectRecord.Hidden Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If TempZ=False Then
                   TempA=False
                   Strng=Lcase$(Rtrim$(ObjectRecord.ShortName))
                   Call Add.Sort.Inv
                Endif
             Endif
	  Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp5!=Temp6!
       Loop
    Endif
 Endif
 Return

Read.Treasure:
 If Config2(20) Then
    Temp5!=RoomRecord.First
    If Temp5! Then
       Do While Lost.Carrier=False
          Call Read.Record(RoomInvFile,Temp5!)
          If MessWorkRecord6.Room=SFalse Then
             Exit Do
          Endif
          Temp6!=MessWorkRecord6.Next
          Temp2!=MessWorkRecord6.Index
          If Temp2!>SFalse Then
             If Temp2!>SFalse And Temp2!<=Lof(TreasureFile)/TreasureRecLen Then
                TempZ=False
                Call Read.Record(TreasureFile,Temp2!)
                If MessWorkRecord6.Plus=Hidden.Object Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If TreasureRecord.Invisible Then
                   If Normal.User Then
                      TempZ=True
                   Endif
                Endif
                If TempZ=False Then
                   TempA=False
                   Strng=Lcase$(Rtrim$(TreasureRecord.ShortName))
                   Call Add.Sort.Inv
                Endif
             Endif
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp5!=Temp6!
       Loop
    Endif
 Endif
 Return

Read.Monsters:
 If Config2(19) Then
    For Monster.Temp=1! To Lof(MessWorkFile3)/MessWorkRecLen3
       Call Read.Record(MessWorkFile3,Monster.Temp)
       If MessWorkRecord3.Room=Room Then
          Strng=Lcase$(Rtrim$(MessWorkRecord3.Monster.MonsterName))
          TempA=False
          Call Add.Sort.Inv
       Endif
    Next
 Endif
 Return

Read.Containers:
 Temp5!=RoomRecord.First2
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Temp5!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             TempZ=False
             If ContainerRecord.InvisibleContainer Then
                If Normal.User Then
                   TempZ=True
                Endif
             Endif
             If Rtrim$(ContainerRecord.ContainerName)=Nul Then
                TempZ=True
             Endif
             If TempZ=False Then
                TempA=False
                Strng=Lcase$(Rtrim$(ContainerRecord.ContainerShort))
                Call Add.Sort.Inv
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Var6!
    Loop
 Endif
 Return
ErrorRsm36b:
 Exit Sub
ErrorTrp36b:
 Resume ErrorRsm36b
End Sub

Sub Add.Sort.Inv
 On Local Error Goto Err.Trp5c
 If TempA=False Then
    For Temp8=1 To Temp9
       Out3=Rtrim$(Sort.Array1(Temp8))
       If Strng=Out3 Then
          Sort.Array2(Temp8)=Sort.Array2(Temp8)+1
          Exit Sub
       Endif
    Next
 Endif
 If Temp9=1024 Then
    Exit Sub
 Endif
 Temp9=Temp9+1
 If Temp9>TempD Then
    TempD=TempD+16
    Redim Preserve Sort.Array1(1 To TempD) As String*32, _
    Sort.Array2(1 To TempD) As Integer
 Endif
 Sort.Array1(Temp9)=Strng
 If TempA Then
    Sort.Array2(Temp9)=True
 Else
    Sort.Array2(Temp9)=1
 Endif
Err.Rsm5c:
 Exit Sub
Err.Trp5c:
 Resume Err.Rsm5c
End Sub

Sub Sort.Inv(Var)
 On Local Error Goto ErrorTrp36f
 If Var Then
    For Temp1=1 To Temp9
       For Temp2=Temp1+1 To Temp9
          If Sort.Array2(Temp1)>Sort.Array2(Temp2) Then
             Swap Sort.Array1(Temp1),Sort.Array1(Temp2)
             Swap Sort.Array2(Temp1),Sort.Array2(Temp2)
          Endif
       Next
    Next
 Endif
 For Temp1=1 To Temp9
    If Sort.Array2(Temp1)>False Then
       Exit For
    Endif
    For Temp2=Temp1+1 To Temp9
       If Sort.Array2(Temp2)<False Then
          If Sort.Array1(Temp1)>Sort.Array1(Temp2) Then
             Swap Sort.Array1(Temp1),Sort.Array1(Temp2)
             Swap Sort.Array2(Temp1),Sort.Array2(Temp2)
          Endif
       Endif
    Next
 Next
 VarX=Temp1
 For Temp1=VarX To Temp9
    For Temp2=Temp1+1 To Temp9
       If Sort.Array1(Temp1)>Sort.Array1(Temp2) Then
          Swap Sort.Array1(Temp1),Sort.Array1(Temp2)
          Swap Sort.Array2(Temp1),Sort.Array2(Temp2)
       Endif
    Next
 Next
ErrorRsm36f:
 Exit Sub
ErrorTrp36f:
 Resume ErrorRsm36f
End Sub

Sub Display.Sorted.Array(Var)
 On Local Error Goto ErrorTrp36g
 Allow.Break=True
 If Var Then
    Carriage.Return=True
    Strng="You see "
    Call IO.O
 Endif
 For Temp8=1 To Temp9
    TempD=Sort.Array2(Temp8)
    Var$=Rtrim$(Sort.Array1(Temp8))
    Select Case TempD
    Case -1
       Strng=Var$
    Case 1
       Call Singular.Name(Var$,Strng)
    Case Is>1
       Call Plural.Name(Var$,Strng)
    End Select
    If TempD=True Then
       Out2=Nul
    Else
       Out2=Mid$(Str$(TempD),2)+" "
    Endif
    If Temp8<Temp9 Then
       Carriage.Return=True
       Strng=Out2+Strng+", "
    Else
       If Var=0 Then
          Strng=Out2+Strng+"."
          Call IO.O
          Exit For
       Endif
       VarQ=0
       If Parse.Temp=0 Then
          Call Find.Coins(VarQ,0)
       Endif
       If VarQ Then
          Strng=Out2+Strng+", "
          If VarQ=1 Then
             Strng=Strng+"and some coins."
          Else
             Strng=Strng+"and"+Str$(VarQ)+" piles of coins."
          Endif
       Else
          If Temp9>1 Then
             Strng="and "+Out2+Strng+"."
          Else
             Strng=Out2+Strng+"."
          Endif
       Endif
    Endif
    If Break Then
       Exit For
    Endif
    Call IO.O
 Next
 Allow.Break=False
 Break=False
ErrorRsm36g:
 Exit Sub
ErrorTrp36g:
 Resume ErrorRsm36g
End Sub

' count coin piles in room.
'   VarZ2=-1 hidden
'   VarZ=piles
Sub Find.Coins(VarZ,VarZ2)
 On Local Error Goto ErrorTrp36x
 VarZ=0
 Close #TempFile1
 FileName=DND.Path+"coins.dat"
 Open FileName For Random Shared As #TempFile1 Len=16
 Field #TempFile1, 4 As R$, 8 As G$, 2 As P1$, 2 As P2$
 V! = Lof(TempFile1)/16
 For X!=1! To V!
    GET #TempFile1, X!
    If CVS(R$)=Room Then
       If Cvi(P1$)=VarZ2 Then
          VarZ=VarZ+1
       Endif
    Endif
 Next
ErrorRsm36x:
 Exit Sub
ErrorTrp36x:
 Resume ErrorRsm36x
End Sub

' display nearby users offline and online
'   var=-1  offline
'   var=0  online
Sub Display.Users(Var)
 On Local Error Goto Err.Trp3
 ' check offline user fights
 If Var Then
    If Config2(55)=False Then
       Exit Sub
    Endif
 Endif
 ' scan all nearby rooms
 For Temp1=1 To MaxDirections+2 ' plus custom
    Var2!=RoomRecord.Direct(Temp1)
    If Var2!>SFalse And Var2!<>Room Then
       For Temp3!=1! To Lof(UserFile2)/UserRecLen
          If Temp3!<>User.Index Then
             Call Read.Record(UserFile2,Temp3!)
             Out2=UserRecord2.Codename
             If Left$(Out2,9)<>Deleted$ Then
                If UserRecord2.Level>False Then ' dead user
                   If Var Then
                      ' check user Temp3! is offline
                      Call Search.Mess(Temp3!)
                      If Temp!=SFalse Then
                         ' check offline user Temp3! is in room Var2!
                         Call Check.User2(Var2!)
                         If User.Temp Then
                            ' check offline user is in safe.room
                            TempA=False
                            If Var2!=1! Then
                               TempA=True
                            Else
                               Var1$=","+Rtrim$(Room.Array(11))+","
                               Var2$=","+Mid$(Str$(Var2!),2)+","
                               If Instr(Var1$,Var2$) Then
                                  TempA=True
                               Endif
                            Endif
                            If TempA=False Then
                               If UserRecord2.Invisible=False Then
                                  Strng="There is an offline player nearby!"
                                  Call IO.O
                                  Exit Sub
                               Endif
                            Endif
                         Endif
                      Endif
                   Else
                      ' check online user Temp3! is in room Var2!
                      Call Search.Mess(Temp3!)
                      If Temp!=Var2! Then
                         ' check user is in vehicle
                         TempZ=True
                         If Vehicle1 Then
                            Call Read.Record(RoomInvFile,Vehicle1)
                            If MessWorkRecord6.User=TempB! Then
                               TempZ=False
                            Else
                               Call Read.Record(TreasureFile,Vehicle3)
                               If TreasureRecord.Occupants>False Then
                                  For Var2=1 To 4
                                     If MessWorkRecord6.Temp(Var2)=TempB! Then
                                        TempZ=False
                                        Exit For
                                     Endif
                                  Next
                               Endif
                            Endif
                         Endif
                         If TempZ Then
                            If UserRecord2.Invisible=False Then
                               Strng="There is an online player nearby!"
                               Call IO.O
                               Exit Sub
                            Endif
                         Endif
                      Endif
                   Endif
                Endif
             Endif
          Endif
       Next
    Endif
 Next
Err.Rsm3:
 Exit Sub
Err.Trp3:
 Resume Err.Rsm3
End Sub

' check offline user Temp3! is in room Var2!
Sub Check.User2(Var2!)
 On Local Error Goto ErrorTrp21
 ' check user is offline
 User.Temp=SFalse
 For Temp5!=1! To Lof(MessWorkFile4)/MessWorkRecLen4
    Call Read.Record(MessWorkFile4,Temp5!)
    If MessWorkRecord4.Room=Var2! Then
       If MessWorkRecord4.Index=Temp3! Then
          Goto Check.Team
       Endif
    Endif
 Next
 Exit Sub
Check.Team:
 ' check user is on team
 For Var!=1! To Lof(TeamFile)/TeamRecLen
    Call Read.Record(TeamFile,Var!)
    If TeamRecord.Deleted=False Then
       For VarY=1 To MaxTeamMembers
          If TeamRecord.UserIndex(VarY)=User.Index Then
             For VarZ=1 To MaxTeamMembers
                If TeamRecord.UserIndex(VarZ)=Temp3! Then
                   If TeamRecord.Activated(VarZ) Then
                      Exit Sub
                   Endif
                Endif
             Next
          Endif
       Next
    Endif
 Next
 User.Temp=Temp5!
 Exit Sub
ErrorRsm21:
 Exit Sub
ErrorTrp21:
 Resume ErrorRsm21
End Sub

Sub Check.Lit.Room(Var)
 On Local Error Goto ErrorTrp34
 Var=False ' default lit room
 Call Read.Record(RoomFile,Room)
 Temp2!=RoomRecord.Action
 If Temp2!<=SFalse Or Temp2!>Lof(ActionFile)/ActionRecLen Then
    Exit Sub
 Endif
 Call Read.Record(ActionFile,Temp2!)
 If ActionRecord.Attribute1=LitRoom Then
    Exit Sub
 Endif
 Var=True ' unlit room
 For Temp5!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
    Call Read.Record(MessWorkFile6,Temp5!)
    If MessWorkRecord6.User=User.Index Then
       Temp7!=MessWorkRecord6.Index
       If Temp7!>SFalse And Temp7!<=Lof(TreasureFile)/TreasureRecLen Then
          Call Read.Record(TreasureFile,Temp7!)
          If TreasureRecord.LightType Then
             If MessWorkRecord6.Charges<False Then
                Var=False
                Exit Sub
             Endif
	  Endif
       Else
          If Temp7!<SFalse Then
             Call Read.Record(ObjectFile,Abs(Temp7!))
             If ObjectRecord.LightRoom Then
                If ObjectRecord.LightTime=False Then
                   Var=False
                   Exit Sub
                Else
                   Var1!=Csng(ObjectRecord.FromHour*3600!+ObjectRecord.FromMin*60!)
                   Var2!=Csng(ObjectRecord.ToHour*3600!+ObjectRecord.ToMin*60!)
                   If Var1!>SFalse Or Var2!>SFalse Then
                      Call Check.Time2(Var2,Var1!,Var2!)
                      If Var2=-1 Then ' inside range
                         Var=False
                         Exit Sub
                      Endif
                   Endif
                Endif
             Endif
          Endif
       Endif
    Endif
 Next
 Temp5!=RoomRecord.First
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(RoomInvFile,Temp5!)
       If MessWorkRecord6.Room=SFalse Then
          Exit Do
       Endif
       Temp6!=MessWorkRecord6.Next
       Temp7!=MessWorkRecord6.Index
       If Temp7!>SFalse Then
          Call Read.Record(TreasureFile,Temp7!)
          If TreasureRecord.LightType Then
             If MessWorkRecord6.Charges<False Then
                Var=False
                Exit Sub
             Endif
          Endif
       Else
          If Temp7!<SFalse Then
             Call Read.Record(ObjectFile,Abs(Temp7!))
             If ObjectRecord.SwitchLight Then
                Var=False
                Exit Sub
             Else
                If ObjectRecord.LightRoom Then
                   If ObjectRecord.LightTime=False Then
                      Var=False
                      Exit Sub
                   Else
                      Var1!=Csng(ObjectRecord.FromHour*3600!+ObjectRecord.FromMin*60!)
                      Var2!=Csng(ObjectRecord.ToHour*3600!+ObjectRecord.ToMin*60!)
                      If Var1!>SFalse Or Var2!>SFalse Then
                         Call Check.Time2(Var2,Var1!,Var2!)
                         If Var2=-1 Then ' inside range
                            Var=False
                            Exit Sub
                         Endif
                      Endif
                   Endif
                Endif
             Endif
	  Endif
       Endif
       If Temp6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Temp6!
    Loop
 Endif
ErrorRsm34:
 Exit Sub
ErrorTrp34:
 Resume ErrorRsm34
End Sub

Sub Plural.Name(Var1$,Var2$)
 On Local Error Goto ErrorTrp5a
 Var2$=Var1$
 If Right$(Var1$,2)="ey" Then ' key
    Var2$=Var1$+"s"
    Exit Sub
 Endif
 Select Case Right$(Var1$,1)
 Case "s"
    If Instr("aeiou",Mid$(Var1$,Len(Var1$)-1,1)) Then
       Var2$=Var1$+"es"
    Endif
 Case "y"
    Var2$=Left$(Var1$,Len(Var1$)-1)+"ies"
 Case "i","x"
    Var2$=Var1$+"es"
 Case Else
    Var2$=Var1$+"s"
 End Select
ErrorRsm5a:
 Exit Sub
ErrorTrp5a:
 Resume ErrorRsm5a
End Sub

Sub Singular.Name(Var1$,Var2$)
 On Local Error Goto ErrorTrp5b
 Var2$=Var1$
 If Right$(Var1$,1)="s" Then
    If Instr("aeiou",Mid$(Var1$,Len(Var1$)-1,1))=False Then
       Var2$=Left$(Var1$,Len(Var1$)-1)
    Endif
 Endif
ErrorRsm5b:
 Exit Sub
ErrorTrp5b:
 Resume ErrorRsm5b
End Sub

Sub Treasure.Plus
 On Local Error Goto ErrorTrp26
 Out2=Nul
 Select Case TreasureRecord.WeaponNumber
 Case 7 ' weapon
    Call Item.Plus(1,Temp1,Out2)
 Case 5 ' shield
    Call Item.Plus(2,Temp1,Out2)
 Case 1 ' armor
    Call Item.Plus(3,Temp1,Out2)
 Case 4, 9 ' ring
    Call Item.Plus(4,Temp1,Out2)
 End Select
ErrorRsm26:
 Exit Sub
ErrorTrp26:
 Resume ErrorRsm26
End Sub

Sub Item.Plus(Var1,Var2,Var$)
 On Local Error Goto ErrorTrp25
 Select Case Var1
 Case 1
    If Config2(96) Then
       VarX=Config2(97)+Var2
    Else
       VarX=Config2(97)-Var2
    Endif
 Case 2
    If Config2(98) Then
       VarX=Config2(99)+Var2
    Else
       VarX=Config2(99)-Var2
    Endif
 Case 3
    If Config2(100) Then
       VarX=Config2(101)+Var2
    Else
       VarX=Config2(101)-Var2
    Endif
 Case 4
    If Config2(102) Then
       VarX=Config2(103)+Var2
    Else
       VarX=Config2(103)-Var2
    Endif
 Case Else
    Var$=Nul
    Exit Sub
 End Select
 Select Case VarX
 Case Is<False
    Var$="("+Str$(VarX)+")"
 Case Is>False
    Var$="(+"+Mid$(Str$(VarX),2)+")"
 Case Else
    Var$="(+0)"
 End Select
ErrorRsm25:
 Exit Sub
ErrorTrp25:
 Resume ErrorRsm25
End Sub

Sub A.Or.An
 On Local Error Goto ErrorTrp5z
 Prefix1="a "
 Var2$=Lcase$(Strng3)
 Var2$=Left$(Var2$,1)
 If Instr("aeiou",Var2$) Then
    Prefix1="an "
 Endif
ErrorRsm5z:
 Exit Sub
ErrorTrp5z:
 Resume ErrorRsm5z
End Sub

Sub The.Or.An
 On Local Error Goto ErrorTrp5
 If MessWorkRecord3.Monster.Permanent<True Then
    Prefix1="the "
 Else
    Var2$=MessWorkRecord3.Monster.MonsterName
    If Left$(Var2$,4)="the " Then
       Prefix1=Nul
    Else
       Prefix1="a "
       Var2$=Left$(Var2$,1)
       If Instr("aeiou",Var2$) Then
          Prefix1="an "
       Endif
    Endif
 Endif
ErrorRsm5:
 Exit Sub
ErrorTrp5:
 Resume ErrorRsm5
End Sub

Sub Him.Her
 On Local Error Goto ErrorTrp4
 Prefix1="him"
 If UserRecord2.ClassType=Lady Then
    Prefix1="her"
 Endif
ErrorRsm4:
 Exit Sub
ErrorTrp4:
 Resume ErrorRsm4
End Sub

Sub He.She
 On Local Error Goto ErrorTrp3
 Prefix1="He"
 If UserRecord2.ClassType=Lady Then
    Prefix1="She"
 Endif
ErrorRsm3:
 Exit Sub
ErrorTrp3:
 Resume ErrorRsm3
End Sub

Sub Display.Sorted.Inv
 On Local Error Goto Err.Trp5a
 Call Pack.Containers
 Call Count.Inventory
 If TempD!=0! Then
    Exit Sub
 Endif
 Temp9=False
 TempD=16
 Redim Sort.Array1(1 To 16) As String*32, _
 Sort.Array2(1 To 16) As Integer
 For Temp5!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
    Call Read.Record(MessWorkFile6,Temp5!)
    If MessWorkRecord6.User=User.Index Then
       VarQ!=MessWorkRecord6.Index
       If VarQ!>SFalse And VarQ!<=Lof(TreasureFile)/TreasureRecLen Then
          Call Read.Record(TreasureFile,VarQ!)
          Strng=Lcase$(Rtrim$(TreasureRecord.ShortName))
          TempA=False
          Call Add.Sort.Inv
       Endif
    Endif
 Next
 For Temp5!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
    Call Read.Record(MessWorkFile6,Temp5!)
    If MessWorkRecord6.User=User.Index Then
       VarQ!=MessWorkRecord6.Index
       If VarQ!<SFalse Then
          VarQ!=Abs(VarQ!)
          If VarQ!>SFalse And VarQ!<=Lof(ObjectFile)/ObjectRecLen Then
             Call Read.Record(ObjectFile,VarQ!)
             Strng=Lcase$(Rtrim$(ObjectRecord.ShortName))
             TempA=False
             Call Add.Sort.Inv
          Endif
       Endif
    Endif
 Next
 Temp5!=UserRecord.First2
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Temp5!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             If Rtrim$(ContainerRecord.ContainerName)<>Nul Then
                Strng=Lcase$(Rtrim$(ContainerRecord.ContainerShort))
                TempA=False
                Call Add.Sort.Inv
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Var6!
    Loop
 Endif
 If Temp9=False Then
    Strng="Nothing at all."
    Call IO.O
 Else
    Call Sort.Inv(False)
    Call Display.Sorted.Array(False)
 Endif
 Erase Sort.Array1,Sort.Array2
Err.Rsm5a:
 Exit Sub
Err.Trp5a:
 Resume Err.Rsm5a
End Sub

Sub Pack.Containers
 On Local Error Goto Err.Trp5b
 For Var!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
    Call Read.Record(MessWorkFile6,Var!)
    If MessWorkRecord6.User=User.Index Then
       Temp5!=MessWorkRecord6.Index
       If Temp5!>SFalse And Temp5!<=Lof(TreasureFile)/TreasureRecLen Then
          Call Read.Record(TreasureFile,Temp5!)
          If TreasureRecord.Container Then
             Call Drop.Container.In.User(Temp5!)
             MessWorkRecord6.User=SFalse
             Call Write.Record(MessWorkFile6,Var!)
          Endif
       Endif
    Endif
 Next
Err.Rsm5b:
 Exit Sub
Err.Trp5b:
 Resume Err.Rsm5b
End Sub

Sub Count.Inventory
 On Local Error Goto Err.Trp5d
 TempD!=SFalse
 For Temp5!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
    Call Read.Record(MessWorkFile6,Temp5!)
    If MessWorkRecord6.User=User.Index Then
       TempD!=TempD!+1!
    Endif
 Next
 Temp5!=UserRecord.First2
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Temp5!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             If Rtrim$(ContainerRecord.ContainerName)<>Nul Then
                TempD!=TempD!+1!
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Var6!
    Loop
 Endif
 Select Case TempD!
 Case 0!
    Strng="You are carrying zero items."
    Call IO.O
    Exit Sub
 Case 1!
    Strng2=" one item"
 Case 2! To 10!
    Strng2=" "+Rtrim$(Numeral(Cint(TempD!)))+" items"
 Case Else
    If Instr(Str$(Cdbl(TempD!)),"D") Then
       Var$=Str$(TempD!)
    Else
       Var$=" "+Form$(Cdbl(TempD!))
    Endif
    Strng2=Var$+" items"
 End Select
 Graphics.Off=True

 If Weight<DFalse Then
    Weight=DFalse
 Endif
 If Instr(Str$(Weight),"D") Then
    Var$=Str$(Weight)
 Else
    Var$=" "+Form$(Weight)
 Endif

 Strng="You are carrying"+Strng2+" weighing"+Var$+" gold:"
 Call IO.O
 If TempD!>32766! Then ' int-1
    Strng="You sure have a lot of items in your inventory!!"
    Call IO.O
    Call More.Prompt
 Endif
Err.Rsm5d:
 Exit Sub
Err.Trp5d:
 Resume Err.Rsm5d
End Sub

Sub Safe.Room
 On Local Error Goto ErrorTrp1
 TempA=False
 If Room=1 Then
    TempA=True
 Else
    Var1$=","+Rtrim$(Room.Array(11))+","
    Var2$=","+Mid$(Str$(Room),2)+","
    If Instr(Var1$,Var2$) Then
       TempA=True
    Else
       If GuestLogin Then
          If Room=GuestRecord.GuestRoomResurrect Then
             TempA=True
          Endif
       Endif
    Endif
 Endif
ErrorRsm1:
 Exit Sub
ErrorTrp1:
 Resume ErrorRsm1
End Sub

' Var!=-1!  load node.array with online usernames in current room.
' Var!=0!   search for online username in
'           parsed.command1 and return room number in Temp!
' Var!>0!   search for online user.index=Var! and
'           return room number in Temp!
Sub Search.Mess(Var!)
 On Local Error Goto ErrorTrap16
 Temp!=SFalse
 For VarX=False To MaxNodes
    Node.Work.Array1(VarX)=Nul
    Node.Work.Array2(VarX)=False
 Next
 TempD=False
 For VarX=False To MaxNodes
    Call Read.Message.Record(MessWorkFile1,VarX+1)
    Var$=Rtrim$(MessWorkRecord1.UserName)
    Call Valid.Name(Var$)
    If TempA Then
       TempB!=MessWorkRecord1.UserIndex
       TempC=VarX
       Select Case Var!
       Case -1!
          If MessWorkRecord1.RoomNumber=Room Then
             Node.Work.Array1(VarX)=Lcase$(Var$)
             Node.Work.Array2(VarX)=MessWorkRecord1.Level
          Endif
       Case SFalse
          Strng=MessWorkRecord1.UserName
          Strng=Rtrim$(Strng)
          Strng=Lcase$(Strng)
          Out4=Lcase$(Parsed.Command1)
          If Len(Out4) Then
             If Left$(Strng,Len(Out4))=Out4 Then
                Out4=Strng
                If Parse.Temp>False Then
                   TempD=TempD+1
                   If TempD=Parse.Temp Then
                      Temp!=MessWorkRecord1.RoomNumber
                      Exit For
                   Endif
                Else
                   Temp!=MessWorkRecord1.RoomNumber
                   Exit For
                Endif
             Endif
          Endif
       Case Else
          If MessWorkRecord1.UserIndex=Var! Then
             Temp!=MessWorkRecord1.RoomNumber
             Exit For
          Endif
       End Select
    Endif
 Next
ErrorResume16:
 Exit Sub
ErrorTrap16:
 Resume ErrorResume16
End Sub

Sub Display.Inventory
 On Local Error Goto Err.Trp5
 Call Pack.Containers
 Call Count.Inventory
 If TempD!=0! Then
    Exit Sub
 Endif
 Allow.Break=True
 Break=False
 Temp9=False
 Strng=Nul
 Strng2=Nul
 For Temp5!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
    Allow.Break=True
    Call Read.Record(MessWorkFile6,Temp5!)
    If MessWorkRecord6.User=User.Index Then
       VarQ!=MessWorkRecord6.Index
       If VarQ!<SFalse Then
          VarQ!=Abs(VarQ!)
          If VarQ!>SFalse And VarQ!<=Lof(ObjectFile)/ObjectRecLen Then
             Carriage.Return=True
             If Break Then
                Goto End.Inv.Display
             Endif
             Call Convert.ANSI(True,VarQ,VarR)
             Carriage.Return=True
             Graphics.On=True
             Call IO.O
             Graphics.On=False
             If Len(Strng2) Then
                Carriage.Return=True
                Strng=Strng2
                Call IO.O
             Endif
             Call Read.Record(ObjectFile,VarQ!)
             Strng=Rtrim$(ObjectRecord.ObjectName)
             Temp9=Temp9+1
             If Temp9=1 Then
                Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
             Endif
             Strng=Rtrim$(ObjectRecord.Prefix1)+Strng
             Strng2=Nul
             If ObjectRecord.Invisible Then
                Strng2=" [inv]"
             Endif
             Strng2=Strng2+", "
          Endif
       Else
          If VarQ!>SFalse And VarQ!<=Lof(TreasureFile)/TreasureRecLen Then
             Carriage.Return=True
             If Break Then
                Goto End.Inv.Display
             Endif
             Call Convert.ANSI(True,VarQ,VarR)
             Carriage.Return=True
             Graphics.On=True
             Call IO.O
             Graphics.On=False
             If Len(Strng2) Then
                Carriage.Return=True
                Strng=Strng2
                Call IO.O
             Endif
             Call Read.Record(TreasureFile,VarQ!)
             Strng=Rtrim$(TreasureRecord.TreasureName)
             Strng2=Nul
             If TreasureRecord.MasterKey Then
                Strng2=Strng2+" (master)"
             Else
                If TreasureRecord.KeyNumber Then
                   Strng2=Strng2+" (#"+Right$(Str$(TreasureRecord.KeyNumber+1000000!),6)+")"
                Endif
             Endif
             Temp1=TreasureRecord.Plus
             If Temp1 Then
                Call Treasure.Plus
                If Out2<>Nul Then
                   Strng2=Strng2+" "+Out2
                Endif
             Endif
             If TreasureRecord.Spell Then
                Call Read.Record(SpellFile,TreasureRecord.Spell)
                Strng2=Strng2+" (+"+Mid$(Str$(SpellRecord.Level),2)+")"
             Endif
             If TreasureRecord.LightType Then
                If MessWorkRecord6.Charges<False Then
                   Strng2=Strng2+" [lit]"
                Endif
             Endif
             If TreasureRecord.Invisible Then
                Strng2=Strng2+" [inv]"
             Endif
             Temp9=Temp9+1
             If Temp9=1 Then
                Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
             Endif
             Strng=Rtrim$(TreasureRecord.Prefix1)+Strng
             Strng2=Strng2+", "
          Endif
       Endif
    Endif
 Next
 Temp5!=UserRecord.First2
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Temp5!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             If Rtrim$(ContainerRecord.ContainerName)<>Nul Then
                Carriage.Return=True
                If Break Then
                   Goto End.Inv.Display
                Endif
                Call Convert.ANSI(True,VarQ,VarR)
                Carriage.Return=True
                Graphics.On=True
                Call IO.O
                Graphics.On=False
                If Len(Strng2) Then
                   Carriage.Return=True
                   Strng=Strng2
                   Call IO.O
                Endif
                Strng=Rtrim$(Lcase$(ContainerRecord.ContainerName))
                Strng2=Nul
                If ContainerRecord.Locked=True Then
                   Strng2=Strng2+" [locked]"
                Endif
                If ContainerRecord.Locked=1 Then
                   If ContainerRecord.Closed Then
                      Strng2=Strng2+" [closed]"
                   Endif
                Endif
                If ContainerRecord.InvisibleContainer Then
                   Strng2=Strng2+" [inv]"
                Endif
                If ContainerRecord.KeyNumber Then
                   Strng2=Strng2+" (#"+Right$(Mid$(Str$(ContainerRecord.KeyNumber+1000000!),2),6)+")"
                Endif
                Temp9=Temp9+1
                If Temp9=1 Then
                   Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
                Endif
                Strng=Rtrim$(ContainerRecord.Prefix1)+Strng
                Strng2=Strng2+", "
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Var6!
    Loop
 Endif
 If Temp9=False Then
    Strng="Nothing at all."
 Else
    If Temp9>1 Then
       Strng="and "+Strng
    Endif
 Endif
End.Inv.Display:
 Allow.Break=False
 Break=False
 Call Convert.ANSI(True,VarQ,VarR)
 Carriage.Return=True
 Graphics.On=True
 Call IO.O
 Graphics.On=False
 If Len(Strng2) Then
    Strng=Left$(Strng2,Len(Strng2)-2)+"."
 Else
    Strng="."
 Endif
 Call IO.O
Err.Rsm5:
 Exit Sub
Err.Trp5:
 Resume Err.Rsm5
End Sub

Sub Search.Room
 On Local Error Goto ErrorTrp57
 Call Check.Lit.Room(Var)
 If Var Then
    Var=False
    Temp9=False
    Temp5!=RoomRecord.First
    If Temp5! Then
       Do While Lost.Carrier=False
          Call Read.Record(RoomInvFile,Temp5!)
          If MessWorkRecord6.Room=SFalse Then
             Exit Do
          Endif
          Temp6!=MessWorkRecord6.Next
          Temp7!=MessWorkRecord6.Index
          If Temp7!<SFalse Then
             Temp7!=Abs(Temp7!)
             Call Read.Record(ObjectFile,Temp7!)
             If ObjectRecord.SwitchType=2 Then ' switch turns on light
                Temp9=Temp9+1
                Temp6=False
                ' is hidden or invisible
                If MessWorkRecord6.Plus=Hidden.Object Then
                   If Rnd<Config1(11) Then
                      Temp6=True
                   Endif
                   If Normal.User=False Then
                      Temp6=True
                   Endif
                Endif
                If ObjectRecord.Invisible Then
                   If Rnd<Config1(11) Then
                      Temp6=True
                   Endif
                   If Normal.User=False Then
                      Temp6=True
                   Endif
                Endif
                If ObjectRecord.Hidden Then
                   If Normal.User=False Then
                      Temp6=True
                   Endif
                Endif
                If Temp6 Then
                   Var=True
                   Strng=Rtrim$(ObjectRecord.Prefix1)
                   Strng="You find "+Strng+Rtrim$(ObjectRecord.ObjectName)+" [inv]."
                   Call Convert.ANSI(True,VarQ,VarR)
                   Graphics.On=True
                   Call IO.O
                   Graphics.On=False
                Endif
             Endif
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp5!=Temp6!
       Loop
    Endif
    If Var=False Then
       If Temp9=False Then
          Strng="It's too dark to search!"
          Call IO.O
       Else
          Strng="You find nothing!"
          Call IO.O
       Endif
    Endif
    Exit Sub
 Endif
 Strng="You search the room.."
 Call IO.O
 Graphics.Off=True
 Strng="You find "
 Carriage.Return=True
 Call IO.O
 Strng=Nul
 Strng2=Nul

 ' offline users
 Temp9=False
 For User.Temp=1! To Lof(MessWorkFile4)/MessWorkRecLen4
    Temp6=False
    Call Read.Record(MessWorkFile4,User.Temp)
    If MessWorkRecord4.Room=Room Then
       If MessWorkRecord4.Index<>User.Index Then
          Call Read.Record(UserFile2,MessWorkRecord4.Index)
          If UserRecord2.Invisible Then
             If Sysop Then
                Temp6=True
             Endif
             If Rnd<Config1(11) Then
                Temp6=True
             Endif
             If UserRecord2.Level>32000 Then ' ghod
                Temp6=False
             Endif
          Endif
       Endif
    Endif
    If Temp6 Then
       Strng=Lcase$(Rtrim$(UserRecord2.CodeName))
       Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
       Strng=Rtrim$(UserRecord2.Prefix1)+Strng
       Call Convert.ANSI(True,VarQ,VarR)
       Carriage.Return=True
       Graphics.On=True
       Call IO.O
       Graphics.On=False
       If Len(Strng2) Then
          Carriage.Return=True
          Strng=Strng2
          Call IO.O
       Endif

       Var6=UserRecord2.Level
       Select Case Var6
       Case 0
          Strng3="zero"
       Case 1 To 10
          Strng3=Rtrim$(Numeral(Var6))
       Case Else
          Strng3=Form$(Cdbl(Var6))
       End Select

       Strng2=" (level "+Strng3+") [offline] [inv], "
       Temp9=Temp9+1
    Endif
 Next

 ' online users
 Call Search.Mess(-1!)
 For Temp5=1 To MaxNodes
    Temp6=False
    If Temp5<>Node Then
       If Rtrim$(Node.Work.Array1(Temp5))<>Nul Then
          Call Read.Message.Record(MessWorkFile1,Temp5+1)
          If MessWorkRecord1.Invisible Then
             If Sysop Then
                Temp6=True
             Endif
             If Rnd<Config1(11) Then
                Temp6=True
             Endif
             If Node.Work.Array2(Temp5)>32000 Then ' ghod
                Temp6=False
             Endif
             If MessWorkRecord1.Monitor Then
                Temp6=False
             Endif
          Endif
       Endif
    Endif
    If Temp6 Then
       Call Convert.ANSI(True,VarQ,VarR)
       Carriage.Return=True
       Graphics.On=True
       Call IO.O
       Graphics.On=False
       If Len(Strng2) Then
          Carriage.Return=True
          Strng=Strng2
          Call IO.O
       Endif

       Strng=Rtrim$(Node.Work.Array1(Temp5))
       Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
       VarQ!=MessWorkRecord1.UserIndex
       Call Read.Record(UserFile2,VarQ!)
       Strng=Rtrim$(UserRecord2.Prefix1)+Strng

       Var6=Node.Work.Array2(Temp5)
       Select Case Var6
       Case 0
          Strng3="zero"
       Case 1 To 10
          Strng3=Rtrim$(Numeral(Var6))
       Case Else
          Strng3=Form$(Cdbl(Var6))
       End Select

       Strng2=" (level "+Strng3+") [online] [inv], "
       Temp9=Temp9+1
    Endif
 Next

 ' room inventory
 Temp5!=RoomRecord.First
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(RoomInvFile,Temp5!)
       If MessWorkRecord6.Room=SFalse Then
          Exit Do
       Endif
       Temp6!=MessWorkRecord6.Next
       Temp4!=MessWorkRecord6.Index
       If Temp4!<SFalse Then
          Temp4!=Abs(Temp4!)
          If Temp4!>SFalse And Temp4!<=Lof(ObjectFile)/ObjectRecLen Then
             Call Read.Record(ObjectFile,Temp4!)
             Temp6=False
             If MessWorkRecord6.Plus=Hidden.Object Then
                If Sysop Then
                   Temp6=True
                Endif
                If Rnd<Config1(11) Then
                   Temp6=True
                Endif
             Endif
             If ObjectRecord.Invisible Then
                If Sysop Then
                   Temp6=True
                Endif
                If Rnd<Config1(11) Then
                   Temp6=True
                Endif
             Endif
             If Temp6 Then
                Call Convert.ANSI(True,VarQ,VarR)
                Carriage.Return=True
                Graphics.On=True
                Call IO.O
                Graphics.On=False
                If Len(Strng2) Then
                   Carriage.Return=True
                   Strng=Strng2
                   Call IO.O
                Endif
                Strng=Rtrim$(ObjectRecord.Prefix1)
                Strng=Strng+Rtrim$(ObjectRecord.ObjectName)
                Strng2=" [inv], "
                Temp9=Temp9+1
             Endif
          Endif
       Else
          If Temp4!>SFalse And Temp4!<=Lof(TreasureFile)/TreasureRecLen Then
             Call Read.Record(TreasureFile,Temp4!)
             Temp6=False
             If MessWorkRecord6.Plus=Hidden.Object Then
                If Sysop Then
                   Temp6=True
                Endif
                If Rnd<Config1(11) Then
                   Temp6=True
                Endif
             Endif
             If TreasureRecord.Invisible Then
                If Sysop Then
                   Temp6=True
                Endif
                If Rnd<Config1(11) Then
                   Temp6=True
                Endif
             Endif
             If Temp6 Then
                Call Convert.ANSI(True,VarQ,VarR)
                Carriage.Return=True
                Graphics.On=True
                Call IO.O
                Graphics.On=False
                If Len(Strng2) Then
                   Carriage.Return=True
                   Strng=Strng2
                   Call IO.O
                Endif
                Strng=Rtrim$(TreasureRecord.Prefix1)
                Strng=Strng+Rtrim$(TreasureRecord.TreasureName)

                Strng2=Nul
                Var2=TreasureRecord.Plus
                If Var2>False Then
                   Strng2=" (+"+Mid$(Str$(Var2),2)+")"
                Endif

                If TreasureRecord.LightType Then
                   If MessWorkRecord6.Charges<False Then
                      Strng2=Strng2+" [lit]"
                   Endif
                Endif

                Strng2=Strng2+" [inv], "
                Temp9=Temp9+1
             Endif
          Endif
       Endif
       If Temp6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Temp6!
    Loop
 Endif

 ' room containers
 Temp5!=RoomRecord.First2
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Temp5!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             Temp6=False
             If ContainerRecord.InvisibleContainer Then
                If Sysop Then
                   Temp6=True
                Endif
                If Rnd<Config1(11) Then
                   Temp6=True
                Endif
             Endif
             If Rtrim$(ContainerRecord.ContainerName)=Nul Then
                Temp6=False
             Endif
             If Temp6 Then
                Call Convert.ANSI(True,VarQ,VarR)
                Carriage.Return=True
                Graphics.On=True
                Call IO.O
                Graphics.On=False
                If Len(Strng2) Then
                   Carriage.Return=True
                   Strng=Strng2
                   Call IO.O
                Endif
                Strng=Rtrim$(ContainerRecord.Prefix1)
                Strng=Strng+Rtrim$(Lcase$(ContainerRecord.ContainerName))
                Strng2=" [inv], "
                Temp9=Temp9+1
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Var6!
    Loop
 Endif

 ' online monsters
 For Monster.Temp=1! To Lof(MessWorkFile3)/MessWorkRecLen3
    Call Read.Record(MessWorkFile3,Monster.Temp)
    If MessWorkRecord3.Room=Room Then
       Temp6=False
       If MessWorkRecord3.Monster.Invisible Then
          If Sysop Then
             Temp6=True
          Endif
          If Rnd<Config1(11) Then
             Temp6=True
          Endif
       Endif
       If Temp6 Then
          Call Convert.ANSI(True,VarQ,VarR)
          Carriage.Return=True
          Graphics.On=True
          Call IO.O
          Graphics.On=False
          If Len(Strng2) Then
             Carriage.Return=True
             Strng=Strng2
             Call IO.O
          Endif
          Strng=Ltrim$(Rtrim$(MessWorkRecord3.Monster.Prefix1))
          Strng3=Rtrim$(Lcase$(MessWorkRecord3.Monster.MonsterName))
          Call A.Or.AN
          Strng=Prefix1+Strng+Strng3
          Strng2=" [inv], "
          Temp9=Temp9+1
       Endif
    Endif
 Next

 ' display hidden coins
 Call Find.Coins(VarQ,-1)
 If VarQ Then
    Temp6=False
    If Sysop Then
       Temp6=True
    Endif
    If Rnd<Config1(11) Then
       Temp6=True
    Endif
    If Temp6 Then
       Call Convert.ANSI(True,VarX,VarY)
       Carriage.Return=True
       Graphics.On=True
       Call IO.O
       Graphics.On=False
       If Len(Strng2) Then
          Carriage.Return=True
          Strng=Strng2
          Call IO.O
       Endif
       If VarQ=1 Then
          Strng2="some coins [inv], "
       Else
          Strng2=Mid$(Str$(VarQ),2)+" piles of coins [inv], "
       Endif
       Temp9=Temp9+1
    Endif
 Endif

 If Temp9=False Then
    Strng="nothing.."
 Else
    If Temp9>1 Then
       Strng="and "+Strng
    Endif
 Endif
 Call Convert.ANSI(True,VarQ,VarR)
 Carriage.Return=True
 Graphics.On=True
 Call IO.O
 Graphics.On=False
 If Len(Strng2) Then
    Strng=Left$(Strng2,Len(Strng2)-2)+"."
 Else
    Strng="."
 Endif
 Call IO.O
ErrorRsm57:
 Exit Sub
ErrorTrp57:
 Resume ErrorRsm57
End Sub

Sub Num
 On Local Error Goto ErrorTrp7
 Var=Parse.Temp
 If Var>False Then
    Var=Var-TempC
    If Var<False Then
       Var=False
    Endif
 Endif
 Parse.Temp=Var
ErrorRsm7:
 Exit Sub
ErrorTrp7:
 Resume ErrorRsm7
End Sub

Sub Num2
 On Local Error Goto ErrorTrp7a
 Var=Parse.Temp
 If Var>False Then
    Var=Var-TempD
    If Var<False Then
       Var=False
    Endif
 Endif
 Parse.Temp=Var
ErrorRsm7a:
 Exit Sub
ErrorTrp7a:
 Resume ErrorRsm7a
End Sub
