 Rem File: Editcmd8 for Dndbbs Version v5.0a Release r2.0
 Rem $Include: 'edit.inc'

 On Error Goto ErrMain0
 If Chained2=False Then
    Call Open.Arrays
    Call Get.Config
    Call Increase.Files
    Call Make.FileNames
    Call Open.Files
    Call Reset.Cursor
    Call Detect.Share
    Call Save.Screen2(0)
    Call Passwrd9(Var,"8")
    If Var=False Then
       Call Terminate.Program
       End
    Endif
 Endif
 Call Edit.Object
MainExit0:
 End
ErrMain0:
 Resume MainExit0
 End

Sub Edit.Object
 On Local Error Goto ErrResume112
 Call Edit.Status.Line
 If Lof(ObjectFile)=SFalse Then
    Call Add.Object
 Endif
 Do While Lost.Carrier=False
    If TempC=False Then
       Graphics.Off=False
       Strng="Object Edit utility v"+Left$(Version$,4)+" menu:"
       Call IO.O
       Graphics.Off=True
       Strng=RT$(282,"[A]")+"dd"
       Call IO.O
       Strng=RT$(283,"[C]")+"hange"
       Call IO.O
       Strng=RT$(284,"[L]")+"ist"
       Call IO.O
       If Local.Mode Then
          Strng=RT$(588,"[P]")+"rint"
          Call IO.O
       Endif
       Strng=RT$(577,"[S]")+"earch"
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="Object edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(282,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Add.Object
          Temp!=Lof(ObjectFile)/ObjectRecLen
          Call Change.Object
       Endif
    Case "C"
       If RT$(283,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Object
          If TempD! Then
             Temp!=TempD!
             Call Change.Object
          Else
             Strng="Object not found."
             Call IO.O
          Endif
       Endif
    Case "L"
       If RT$(283,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call List.Object
       Endif
    Case "S"
       If RT$(577,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Search.Object
       Endif
    Case "P"
       If Local.Mode Then
          If RT$(588,"[P]")="[*]" Then
             Strng="Command restricted.."
             Call IO.O
          Else
             Call Print.Objects
          Endif
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
 Close
 Call Clear.Status.Line
 If Chained2 Then
    Chain DND.Path+"EDIT.EXE"
 Endif
 Call Terminate.Program
ErrExit112:
 Exit Sub
ErrResume112:
 Resume ErrExit112
End Sub

Sub List.Object
 On Local Error Goto ErrResume113
 Temp3!=Lof(ObjectFile)/ObjectRecLen
 Call Get.Record.Range(Temp1!,Temp2!,Temp3!)
 Allow.Break=True
 Break=False
 Continuous=False
 For Temp!=Temp1! To Temp2!
    Call Read.Record(ObjectFile,Temp!)
    For VarQ=1 To 22
       Call Display.Object(False,VarQ)
       If Break Then
          Exit For
       Endif
    Next
    If Break Then
       Exit For
    Endif
    If Continuous=False Then
       Call More.Prompt
       If No Or Quit Then
          Exit For
       Endif
    Endif
 Next
 Allow.Break=False
 Break=False
ErrExit113:
 Exit Sub
ErrResume113:
 Resume ErrExit113
End Sub

Sub Print.Objects
 On Local Error Goto ErrResume113a
 Strng="Printer port(1-3)? "
 Call IO.I
 VarP=Int(Val(Out2))
 If VarP>=1 And VarP<=3 Then
    Close #TempFile1
    VarP$="LPT"+Mid$(Str$(VarP),2)+":"
    Open VarP$ For Output As #TempFile1
    Temp3!=Lof(ObjectFile)/ObjectRecLen
    Call Get.Record.Range(Temp1!,Temp2!,Temp3!)
    For Temp!=Temp1! To Temp2!
       Call Read.Record(ObjectFile,Temp!)
       For VarQ=1 To 19
          Call Print.Object(VarQ)
       Next
       Print #TempFile1,Chr$(12);
    Next
 Endif
ErrExit113a:
 Close #TempFile1
 Exit Sub
ErrResume113a:
 Resume ErrExit113a
End Sub

Sub Add.Object
 On Local Error Goto ErrResume27
 Temp!=Lof(ObjectFile)/ObjectRecLen+1!
 ObjectRecord.ObjectName=Nul
 ObjectRecord.ShortName=Nul
 ObjectRecord.LongDesc=Nul
 ObjectRecord.ShortDesc=Nul
 ObjectRecord.RoomLink1=False
 ObjectRecord.RoomLink2=False
 ObjectRecord.Invisible=False
 ObjectRecord.JailTrap=False
 ObjectRecord.DoorLock=False
 ObjectRecord.Relocks=False
 ObjectRecord.Hidden=False
 ObjectRecord.Closed=False
 ObjectRecord.KeyNumber=SFalse
 ObjectRecord.Permanent=True
 ObjectRecord.Trap=False
 ObjectRecord.Teleport=False
 ObjectRecord.FromHour=False
 ObjectRecord.FromMin=False
 ObjectRecord.ToHour=False
 ObjectRecord.ToMin=False
 ObjectRecord.LightRoom=False
 ObjectRecord.LightTime=False
 ObjectRecord.SwitchType=False
 ObjectRecord.SwitchRoom=False
 ObjectRecord.SwitchLight=False
 ObjectRecord.SwitchLockRoom=False
 ObjectRecord.Prefix1=Nul
 ObjectRecord.PortalPassword=Nul
 For VarQ=1 To 19
    ObjectRecord.ObjDesc(VarQ)=0!
 Next
 Call Write.Record(ObjectFile,Temp!)
 UserRecord.ObjectsCreated(5)=UserRecord.ObjectsCreated(5)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
ErrExit27:
 Exit Sub
ErrResume27:
 Resume ErrExit27
End Sub

Sub Change.Object
 On Local Error Goto ErrResume28
 Call Read.Record(ObjectFile,Temp!)
 Do While Lost.Carrier=False
    Allow.Break=True
    Break=False
    For VarQ=1 To 22
       Call Display.Object(True,VarQ)
       If Break Then
          Exit For
       Endif
    Next
    Allow.Break=False
    Break=False
    Graphics.Off=False
    Strng="Object change option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(285,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Object name(30 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          Out2=Lcase$(Out2)
          ObjectRecord.ObjectName=Out2
       Endif
    Case "B"
       If RT$(286,"[B]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Object identifier(30 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          Out2=Ucase$(Out2)
          ObjectRecord.ShortName=Out2
       Endif
    Case "C"
       If RT$(287,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Room link number one"
          Var!=Lof(RoomFile)/RoomRecLen
          Call Get.Record.Range2(SFalse,Var!,Temp4!)
          ObjectRecord.RoomLink1=Temp4!
          Strng="Room link number two"
          Var!=Lof(RoomFile)/RoomRecLen
          Call Get.Record.Range2(SFalse,Var!,Temp4!)
          ObjectRecord.RoomLink2=Temp4!
       Endif
    Case "D"
       If RT$(288,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Trapped portal(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.Teleport=False
          ObjectRecord.Trap=False
          If Yes Then
             Do While Lost.Carrier=False
                Graphics.Off=True
                If TempC=False Then
                   Strng=RT$(303,"[B]")+"lade barrier"
                   Call IO.O
                   Strng=RT$(304,"[C]")+"rushing ceiling"
                   Call IO.O
                   Strng=RT$(305,"[D]")+"eadly spears"
                   Call IO.O
                   Strng=RT$(306,"[F]")+"alling door"
                   Call IO.O
                   Strng=RT$(307,"[P]")+"oison needles"
                   Call IO.O
                   Graphics.Off=False
                Endif
                Strng="Object trap option(q to quit)? "
                No.Input.Out="Q"
                Line.Length=TempD
                Call IO.I
                Select Case Ucase$(Out2)
                Case "B"
                   If RT$(303,"[B]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      ObjectRecord.Trap=4
                   Endif
                Case "C"
                   If RT$(304,"[C]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      ObjectRecord.Trap=5
                   Endif
                Case "D"
                   If RT$(305,"[D]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Temp8=False
                      Do While Lost.Carrier=False
                         Graphics.Off=True
                         If TempC=False Then
                            Strng="Hits for:"
                            Call IO.O
                            Strng=RT$(308,"[F]")+"atigue"
                            Call IO.O
                            Strng=RT$(309,"[V]")+"itality"
                            Call IO.O
                            Strng=RT$(310,"[N]")+"one"
                            Call IO.O
                            Graphics.Off=False
                         Endif
                         Strng="Object trap hits option(q to quit)? "
                         Line.Length=TempD
                         No.Input.Out="Q"
                         Call IO.I
                         Select Case Ucase$(Out2)
                         Case "F"
                            If RT$(308,"[F]")="[*]" Then
                               Strng="Command restricted.."
                               Call IO.O
                            Else
                               Temp8=1
                            Endif
                         Case "V"
                            If RT$(309,"[V]")="[*]" Then
                               Strng="Command restricted.."
                               Call IO.O
                            Else
                               Temp8=True
                            Endif
                         Case "N"
                            If RT$(310,"[N]")="[*]" Then
                               Strng="Command restricted.."
                               Call IO.O
                            Else
                               Temp8=False
                            Endif
                         Case "Q"
                            Exit Do
                         End Select
                      Loop
                      If Temp8 Then
                         ObjectRecord.Trap=3
                         Strng="Number of hits(1-32767)? "
                         No.Input.Out="10"
                         Call IO.I
                         Temp2!=Int(Val(Out2))
                         If Temp8=True Then
                            ObjectRecord.Teleport=-Temp2!
                         Else
                            ObjectRecord.Teleport=Temp2!
                         Endif
                      Endif
                   Endif
                Case "F"
                   If RT$(306,"[F]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      ObjectRecord.Trap=2
                      Var!=Lof(RoomFile)/RoomRecLen
                      Strng="Teleports to room number"
                      Call Get.Record.Range2(SFalse,Var!,Temp4!)
                      ObjectRecord.Teleport=Temp4!
                   Endif
                Case "P"
                   If RT$(307,"[P]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      ObjectRecord.Trap=1
                   Endif
                Case "Q"
                   Exit Do
                End Select
             Loop
          Endif
       Endif
    Case "E"
       If RT$(289,"[E]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Long description(80 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          ObjectRecord.LongDesc=Out2
       Endif
    Case "F"
       If RT$(290,"[F]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Entry description(80 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          ObjectRecord.ShortDesc=Out2
       Endif
    Case "G"
       If RT$(291,"[G]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Hidden object(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.Hidden=Yes
       Endif
    Case "H"
       If RT$(292,"[H]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Invisible object(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.Invisible=Yes
       Endif
    Case "I"
       If RT$(293,"[I]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Jail attacker trap(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.JailTrap=Yes
       Endif
    Case "J"
       If RT$(294,"[J]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Locked portal(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.DoorLock=False
          ObjectRecord.Closed=False
          If Yes Then
             ObjectRecord.DoorLock=2
             ObjectRecord.Closed=True
          Endif
       Endif
    Case "K"
       If RT$(295,"[K]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Relocking portal(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.Relocks=Yes
       Endif
    Case "L"
       If RT$(296,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Key number(1-999999)? "
          Call IO.I
          Temp3!=Int(Val(Out2))
          If Temp3!>=SFalse And Temp3!<=999999! Then
             ObjectRecord.KeyNumber=Temp3!
          Endif
       Endif
    Case "M"
       If RT$(297,"[M]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Permanent Object(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.Permanent=True
          If No Then
             ObjectRecord.Permanent=False
          Endif
       Endif
    Case "N"
       If RT$(298,"[N]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Object is a light(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.LightRoom=False
          ObjectRecord.LightTime=False
          If Yes Then
             ObjectRecord.LightRoom=True
             Strng="Object lights at a time(y/n)? "
             Line.Length=TempD
             No.Input.Out="Y"
             Call IO.I
             If Yes Then
                ObjectRecord.LightTime=True
                Strng="From hour(HH)? "
                Call IO.I
                Temp2=Int(Val(Out2))
                If Temp2>=False And Temp2<=23 Then
                   ObjectRecord.FromHour=Temp2
                Endif
                Strng="From minute(MM)? "
                Call IO.I
                Temp2=Int(Val(Out2))
                If Temp2>=False And Temp2<=59 Then
                   ObjectRecord.FromMin=Temp2
                Endif
                Strng="To hour(HH)? "
                Call IO.I
                Temp2=Int(Val(Out2))
                If Temp2>=False And Temp2<=23 Then
                   ObjectRecord.ToHour=Temp2
                Endif
                Strng="To minute(MM)? "
                Call IO.I
                Temp2=Int(Val(Out2))
                If Temp2>=False And Temp2<=59 Then
                   ObjectRecord.ToMin=Temp2
                Endif
             Endif
          Endif
       Endif
    Case "O"
       If RT$(299,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Object is a switch(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          ObjectRecord.SwitchType=False
          ObjectRecord.SwitchRoom=False
          ObjectRecord.SwitchLight=False
          ObjectRecord.SwitchLockRoom=False
          If Yes Then
             Do While Lost.Carrier=False
                Graphics.Off=True
                If TempC=False Then
                   Graphics.Off=False
                   Strng="Switch type:"
                   Call IO.O
                   Graphics.Off=True
                   Strng=RT$(311,"[E]")+"nters room number"
                   Call IO.O
                   Strng=RT$(312,"[L]")+"ights room"
                   Call IO.O
                   Strng=RT$(313,"[U]")+"nlocks object"
                   Call IO.O
                   Graphics.Off=False
                Endif
                Strng="Enter option(q to quit)? "
                No.Input.Out="Q"
                Line.Length=TempD
                Call IO.I
                Select Case Ucase$(Out2)
                Case "E"
                   If RT$(311,"[E]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      ObjectRecord.SwitchType=1
                      Var!=Lof(RoomFile)/RoomRecLen
                      Strng="enters room number"
                      Call Get.Record.Range2(SFalse,Var!,Temp4!)
                      ObjectRecord.SwitchRoom=Temp4!
                   Endif
                Case "L"
                   If RT$(312,"[L]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      ObjectRecord.SwitchType=2
                   Endif
                Case "U"
                   If RT$(313,"[U]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Call Write.Record(ObjectFile,Temp!)
                      Call Find.Object
                      Call Read.Record(ObjectFile,Temp!)
                      If TempD! Then
                         ObjectRecord.SwitchType=3
                         ObjectRecord.SwitchLockRoom=TempD!
                      Endif
                   Endif
                Case "Q"
                   Exit Do
                End Select
             Loop
          Endif
       Endif
    Case "P"
       If RT$(300,"[P]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Graphics.Off=True
          If ANSIPrefixChar=Nul Then
             Strng="ANSI prefix codes not enabled."
             Call IO.O
             Call More.Prompt
          Else
             Do
                Strng="ANSI prefix code(8 characters, ? for help):"
                Call IO.O
                Strng="?"
                No.Input.Out=Nul
                Call IO.I
                Out2=Ucase$(Out2)
                If Out2="?" Then
                   Call Display.ANSI.Prefixes
                Else
                   Call Check.ANSI.Prefix(V%)
                   If V% Then
                      ObjectRecord.Prefix1=Out2
                      Exit Do
                   Endif
                   Strng="Invalid ANSI code."
                   Call IO.O
                   Call More.Prompt
                Endif
             Loop
          Endif
       Endif
    Case "R"
       If RT$(301,"[R]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Portal password(8 char)?"
          No.Input.Out=Nul
          Call IO.I
          Out2=Ucase$(Out2)
          Out2=Rtrim$(Out2)
          Out2=Ltrim$(Out2)
          If Len(Out2)=False Then
             ObjectRecord.PortalPassword=Nul
             Strng="Portal password removed."
          Else
             If Len(Out2)>=1 And Len(Out2)<=8 Then
                Strng2=Out2
                Call Crypto(Strng2)
                ObjectRecord.PortalPassword=Strng2
                Strng="Portal password changed."
             Else
                Strng="Incorrect portal password."
             Endif
          Endif
          Call IO.O
          Call More.Prompt
       Endif
    Case "S"
       If RT$(302,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          FileName=Data.Path1+"objdesc.dat"
          Close #TempFile1
          Open FileName For Random Shared As #TempFile1 Len=80
          Redim Temp.ArrayS(1 To 19) As String
          For TempY=1 To 19
             Temp.ArrayS(TempY)=Nul
          Next
          Message.Length=False
          For TempY=1 To 19
             TempQ!=ObjectRecord.ObjDesc(TempY)
             If TempQ!>SFalse And TempQ!<=Lof(TempFile1)/80! Then
                Call Read.Record(ObjDescFile,TempQ!)
                Strng=BufferRecord.Buffer
                Strng=Rtrim$(Strng)
                Message.Length=TempY
                Temp.ArrayS(TempY)=Strng
             Endif
          Next
          Do While Lost.Carrier=False
             Call Edit.Message(VarX)
             Select Case VarX
             Case -1
                If Message.Length=19 Then
                   Strng="Description buffer full."
                   Call IO.O
                Else
                   Strng="Continue editing. Press "+Enter$+" on a blank line to edit."
                   Call IO.O
                   Do While Lost.Carrier=False
                      Graphics.Off=True
                      If Message.Length<19 Then
                         Word.Wrap=True
                      Else
                         Word.Wrap=False
                      Endif
                      Strng="?"
                      Carriage.Return=-1
                      Call IO.O
                      Call IO.I
                      If No.Input Then
                         Exit Do
                      Endif
                      Message.Length=Message.Length+1
                      Temp.ArrayS(Message.Length)=Out2
                      If Message.Length=19 Then
                         Strng="Description buffer full."
                         Call IO.O
                         Exit Do
                      Endif
                   Loop
                Endif
             Case 0
                Exit Do
             Case 1
                For TempZ=1 To Message.Length
                   TempQ!=ObjectRecord.ObjDesc(TempZ)
                   If TempQ!>SFalse And TempQ!<=Lof(TempFile1)/80! Then
                      Call Read.Record(ObjDescFile,TempQ!)
                      BufferRecord.Buffer=Temp.ArrayS(TempZ)
                      Call Write.Record(ObjDescFile,TempQ!)
                   Else
                      TempQ!=Lof(TempFile1)/80!+1!
                      ObjectRecord.ObjDesc(TempZ)=TempQ!
                      BufferRecord.Buffer=Temp.ArrayS(TempZ)
                      Call Write.Record(ObjDescFile,TempQ!)
                   Endif
                Next
                Exit Do
             End Select
          Loop
          Close #TempFile1
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
 Call Write.Record(ObjectFile,Temp!)
 Strng="Object '"+Rtrim$(ObjectRecord.ObjectName)+"' changed."
 Call IO.O
 Call Add.Object.Room
ErrExit28:
 Exit Sub
ErrResume28:
 Resume ErrExit28
End Sub

Sub Display.Object(TempX,Var)
 On Local Error Goto ErrResume107
 If TempX Then
    If TempC Then
       Exit Sub
    Endif
 Endif
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="Object number"+Str$(Temp!)+":"
 Call IO.O
 Graphics.Off=True
 Case 2
 If TempX Then
    Strng=RT$(285,"[A]")
 Endif
 Strng=Strng+"Object name: "+Rtrim$(ObjectRecord.ObjectName)
 Call IO.O
 Case 3
 If TempX Then
    Strng=RT$(286,"[B]")
 Endif
 Strng=Strng+"Object identifier: "+Rtrim$(ObjectRecord.ShortName)
 Call IO.O
 Case 4
 If TempX Then
    Strng=RT$(287,"[C]")
 Endif
 Strng=Strng+"Room number links:"
 If ObjectRecord.RoomLink1=SFalse And ObjectRecord.RoomLink2=SFalse Then
    Strng=Strng+" <none>"
 Else
    Strng=Strng+Str$(ObjectRecord.RoomLink1)+","
    Strng=Strng+Str$(ObjectRecord.RoomLink2)
 Endif
 Call IO.O
 Case 5
 If TempX Then
    Strng=RT$(288,"[D]")
 Endif
 Strng=Strng+"Trapped portal: "
 Select Case ObjectRecord.Trap
 Case 1
    Strng=Strng+"poison needles"
 Case 2
    Strng=Strng+"falling door to room"+Str$(ObjectRecord.Teleport)
 Case 3
    Strng=Strng+"deadly spears hits for"+Str$(Abs(ObjectRecord.Teleport))
    If ObjectRecord.Teleport<False Then
       Strng=Strng+" vitality"
    Else
       Strng=Strng+" fatigue"
    Endif
 Case 4
    Strng=Strng+"blade barrier"
 Case 5
    Strng=Strng+"crushing ceiling"
 Case Else
    Strng=Strng+"No"
 End Select
 Call IO.O
 Case 6
 If TempX Then
    Strng=RT$(289,"[E]")
 Endif
 Strng=Strng+"Long description:"
 Call IO.O
 Case 7
 Strng=Rtrim$(ObjectRecord.LongDesc)
 If Strng=Nul Then
    Strng="<none>"
 Endif
 Call IO.O
 Case 8
 If TempX Then
    Strng=RT$(290,"[F]")
 Endif
 Strng=Strng+"Entry description:"
 Call IO.O
 Case 9
 Strng=Rtrim$(ObjectRecord.ShortDesc)
 If Strng=Nul Then
    Strng="<none>"
 Endif
 Call IO.O
 Case 10
 If TempX Then
    Strng=RT$(291,"[G]")
 Endif
 Strng=Strng+"Hidden object: "
 If ObjectRecord.Hidden Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 11
 If TempX Then
    Strng=RT$(292,"[H]")
 Endif
 Strng=Strng+"Invisible object: "
 If ObjectRecord.Invisible Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 12
 If TempX Then
    Strng=RT$(293,"[I]")
 Endif
 Strng=Strng+"Jail attacker trap: "
 If ObjectRecord.JailTrap Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 13
 If TempX Then
    Strng=RT$(294,"[J]")
 Endif
 Strng=Strng+"Locked portal: "
 If ObjectRecord.DoorLock=2 Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 14
 If TempX Then
    Strng=RT$(295,"[K]")
 Endif
 Strng=Strng+"Relocking portal: "
 If ObjectRecord.Relocks Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 15
 If TempX Then
    Strng=RT$(296,"[L]")
 Endif
 Strng=Strng+"Key number: "
 If ObjectRecord.KeyNumber>SFalse Then
    Strng=Strng+"(#"+Right$(Str$(ObjectRecord.KeyNumber+1000000!),6)+")"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 16
 If TempX Then
    Strng=RT$(297,"[M]")
 Endif
 Strng=Strng+"Permanent object: "
 If ObjectRecord.Permanent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 17
 If TempX Then
    Strng=RT$(298,"[N]")
 Endif
 Strng=Strng+"Object is a light: "
 If ObjectRecord.LightRoom=False Then
    Strng=Strng+"No"
 Else
    Strng=Strng+"Yes, Light Time: "
    If ObjectRecord.LightTime=False Then
       Strng=Strng+"<any>"
    Else
       Strng=Strng+"From:"+Right$(Str$(ObjectRecord.FromHour+100),2)+":"+ _
       Right$(Str$(ObjectRecord.FromMin+100),2)+" to "+ _
       Right$(Str$(ObjectRecord.ToHour+100),2)+":"+ _
       Right$(Str$(ObjectRecord.ToMin+100),2)
    Endif
 Endif
 Call IO.O
 Case 18
 If TempX Then
    Strng=RT$(299,"[O]")
 Endif
 Strng=Strng+"Object is a switch: "
 Select Case ObjectRecord.SwitchType
 Case 1
    Strng=Strng+"Yes, enters room number"+ _
    Str$(ObjectRecord.SwitchRoom)+"."
 Case 2
    Strng=Strng+"Yes, turns on light."
 Case 3
    Strng=Strng+"Yes, unlocks portal"+ _
    Str$(ObjectRecord.SwitchLockRoom)
 Case Else
    Strng=Strng+"No"
 End Select
 Call IO.O
 Case 19
 If TempX Then
    Strng=RT$(300,"[P]")
 Endif
 Strng=Strng+"ANSI prefix code: "
 If Rtrim$(ObjectRecord.Prefix1)=Nul Then
    Strng=Strng+"<none>"
 Else
    Strng=Strng+Rtrim$(ObjectRecord.Prefix1)
 Endif
 Call IO.O
 Case 20
 If TempX Then
    Strng=RT$(301,"[R]")
 Endif
 Strng=Strng+"Portal password: "
 Strng2=ObjectRecord.PortalPassword
 If Rtrim$(Strng2)=Nul Then
    Strng=Strng+"<none>"
 Else
    Call Crypto(Strng2)
    Strng=Strng+Rtrim$(Strng2)
 Endif
 Call IO.O
 Case 21
 If TempX Then
    Strng=RT$(302,"[S]")
 Endif
 Strng=Strng+"Multilength description:"
 VarS1=False
 For VarQ=1 To 19
    If ObjectRecord.ObjDesc(VarQ)>0! Then
       VarS1=VarS1+1
    Endif
 Next
 Strng=Strng+Str$(VarS1)+" lines."
 Call IO.O
 Case 22
    If TempX=False Then
       If ObjectRecord.InitRoom>0! Or ObjectRecord.InitRoom2>0! Then
          Strng="Object init room:"
          Strng=Strng+Str$(ObjectRecord.InitRoom)+","
          Strng=Strng+Str$(ObjectRecord.InitRoom2)
          Call IO.O
       Endif
    Endif
 End Select
ErrExit107:
 Exit Sub
ErrResume107:
 Resume ErrExit107
End Sub

Sub Print.Object(Var)
 On Local Error Goto ErrResume107a
 Select Case Var
 Case 1
 Strng="Object number"+Str$(Temp!)+":"
 Print #TempFile1,Strng
 Case 2
 Strng=Nul
 Strng=Strng+"Object name: "+Rtrim$(ObjectRecord.ObjectName)
 Print #TempFile1,Strng
 Case 3
 Strng=Nul
 Strng=Strng+"Object identifier: "+Rtrim$(ObjectRecord.ShortName)
 Print #TempFile1,Strng
 Case 4
 Strng=Nul
 Strng=Strng+"Room number links:"
 If ObjectRecord.RoomLink1=SFalse And ObjectRecord.RoomLink2=SFalse Then
    Strng=Strng+" <none>"
 Else
    Strng=Strng+Str$(ObjectRecord.RoomLink1)+","
    Strng=Strng+Str$(ObjectRecord.RoomLink2)
 Endif
 Print #TempFile1,Strng
 Case 5
 Strng=Nul
 Strng=Strng+"Trapped portal: "
 Select Case ObjectRecord.Trap
 Case 1
    Strng=Strng+"poison needles"
 Case 2
    Strng=Strng+"falling door to room"+Str$(ObjectRecord.Teleport)
 Case 3
    Strng=Strng+"deadly spears hits for"+Str$(Abs(ObjectRecord.Teleport))
    If ObjectRecord.Teleport<False Then
       Strng=Strng+" vitality"
    Else
       Strng=Strng+" fatigue"
    Endif
 Case 4
    Strng=Strng+"blade barrier"
 Case 5
    Strng=Strng+"crushing ceiling"
 Case Else
    Strng=Strng+"No"
 End Select
 Print #TempFile1,Strng
 Case 6
 Strng=Nul
 Strng=Strng+"Long description:"
 Print #TempFile1,Strng
 Case 7
 Strng=Nul
 Strng=Rtrim$(ObjectRecord.LongDesc)
 If Strng=Nul Then
    Strng="<none>"
 Endif
 Print #TempFile1,Strng
 Case 8
 Strng=Nul
 Strng=Strng+"Entry description:"
 Print #TempFile1,Strng
 Case 9
 Strng=Nul
 Strng=Rtrim$(ObjectRecord.ShortDesc)
 If Strng=Nul Then
    Strng="<none>"
 Endif
 Print #TempFile1,Strng
 Case 10
 Strng=Nul
 Strng=Strng+"Hidden object: "
 If ObjectRecord.Hidden Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 11
 Strng=Nul
 Strng=Strng+"Invisible object: "
 If ObjectRecord.Invisible Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 12
 Strng=Nul
 Strng=Strng+"Jail attacker trap: "
 If ObjectRecord.JailTrap Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 13
 Strng=Nul
 Strng=Strng+"Locked portal: "
 If ObjectRecord.DoorLock=2 Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 14
 Strng=Nul
 Strng=Strng+"Relocking portal: "
 If ObjectRecord.Relocks Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 15
 Strng=Nul
 Strng=Strng+"Key number: "
 If ObjectRecord.KeyNumber>SFalse Then
    Strng=Strng+"(#"+Right$(Str$(ObjectRecord.KeyNumber+1000000!),6)+")"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 16
 Strng=Nul
 Strng=Strng+"Permanent object: "
 If ObjectRecord.Permanent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 17
 Strng=Nul
 Strng=Strng+"Object is a light: "
 If ObjectRecord.LightRoom=False Then
    Strng=Strng+"No"
 Else
    Strng=Strng+"Yes, Light Time: "
    If ObjectRecord.LightTime=False Then
       Strng=Strng+"<any>"
    Else
       Strng=Strng+"From:"+Right$(Str$(ObjectRecord.FromHour+100),2)+":"+ _
       Right$(Str$(ObjectRecord.FromMin+100),2)+" to "+ _
       Right$(Str$(ObjectRecord.ToHour+100),2)+":"+ _
       Right$(Str$(ObjectRecord.ToMin+100),2)
    Endif
 Endif
 Print #TempFile1,Strng
 Case 18
 Strng=Nul
 Strng=Strng+"Object is a switch: "
 Select Case ObjectRecord.SwitchType
 Case 1
    Strng=Strng+"Yes, enters room number"+ _
    Str$(ObjectRecord.SwitchRoom)+"."
 Case 2
    Strng=Strng+"Yes, turns on light."
 Case 3
    Strng=Strng+"Yes, unlocks portal"+ _
    Str$(ObjectRecord.SwitchLockRoom)
 Case Else
    Strng=Strng+"No"
 End Select
 Print #TempFile1,Strng
 Case 19
 Strng=Nul
 Strng=Strng+"Object prefix: "
 If Rtrim$(ObjectRecord.Prefix1)=Nul Then
    Strng=Strng+"<none>"
 Else
    Strng=Strng+Rtrim$(ObjectRecord.Prefix1)
 Endif
 Print #TempFile1,Strng
 End Select
ErrExit107a:
 Exit Sub
ErrResume107a:
 Resume ErrExit107a
End Sub

Sub Search.Object
 On Local Error Goto ErrResume55
 Do While Lost.Carrier=False
    Temp1$=Nul
    Temp2$=Nul
    Temp3$=Nul
    Temp4$=Nul
    Var1!=SFalse
    Temp4!=SFalse
    Temp4=False
    Temp6=False
    Temp7=False
    Temp8=False
    Temp9=False
    Temp10=False
    Temp11=False
    Temp12=False
    Temp13=False
    Temp14!=SFalse
    Temp15$=Nul
    Do While Lost.Carrier=False
       Graphics.Off=True
       If TempC=False Then
          Strng="[A]object name substring"
          If Temp1$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp1$+")"
          Endif
          Call IO.O
          Strng="[B]object identifier string"
          If Temp2$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp2$+")"
          Endif
          Call IO.O
          Strng="[C]object desc substring"
          If Temp3$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp3$+")"
          Endif
          Call IO.O
          Strng="[D]object entry desc substring"
          If Temp4$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp4$+")"
          Endif
          Call IO.O
          Strng="[E]room link number"
          If Var1! Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Var1!),2)+")"
          Endif
          Call IO.O
          Strng="[F]key number"
          If Temp4! Then
             Strng=Strng+Space$(30-Len(Strng))
             If Temp4!=-1 Then
                Strng=Strng+"<any>"
             Else
                Strng=Strng+"(#"+Right$(Str$(Temp4!+1000000!),6)+")"
             Endif
          Endif
          Call IO.O
          Strng="[G]invisible objects"
          If Temp4 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[H]hidden objects"
          If Temp6 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[I]jailtrap objects"
          If Temp7 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[J]locked objects"
          If Temp8 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[K]objects which relock"
          If Temp9 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[L]nonpermanent objects"
          If Temp10 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[M]trapped objects"
          If Temp11 Then
             Strng=Strng+Space$(30-Len(Strng))
             Select Case Temp11
             Case 4
                Strng=Strng+"(blade barrier)"
             Case 5
                Strng=Strng+"(crushing ceiling)"
             Case 3
                Strng=Strng+"(deadly spears)"
             Case 2
                Strng=Strng+"(falling door)"
             Case 1
                Strng=Strng+"(poison needles)"
             End Select
          Endif
          Call IO.O
          Strng="[N]lights"
          If Temp12 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[O]switches"
          If Temp13 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[P]init room"
          If Temp14! Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp14!),2)+")"
          Endif
          Call IO.O
          Strng="[R]multilength desc"
          If Temp15$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp15$+")"
          Endif
          Call IO.O
          Graphics.Off=False
       Endif
       Strng="Object search option(S to search, Q to quit)? "
       Line.Length=TempD
       No.Input.Out="Q"
       Call IO.I
       Select Case Ucase$(Out2)
       Case "A"
          Strng="Object name substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp1$=Out2
       Case "B"
          Strng="Object identifier substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp2$=Out2
       Case "C"
          Strng="Object description substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp3$=Out2
       Case "D"
          Strng="Object entry desc substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp4$=Out2
       Case "E"
          Strng="Room link number? "
          Call IO.I
          Var1!=Int(Val(Out2))
       Case "F"
          Strng="Key number(-1=any)? "
          Call IO.I
          Temp4!=0!
          Var!=Int(Val(Out2))
          If Var!=-1! Then
             Temp4!=-1!
          Else
             If Var!>=1! And Var!<=999999! Then
                Temp4!=Var!
             Endif
          Endif
       Case "G"
          Temp4=True
       Case "H"
          Temp6=True
       Case "I"
          Temp7=True
       Case "J"
          Temp8=True
       Case "K"
          Temp9=True
       Case "L"
          Temp10=True
       Case "R"
          Strng="Long description substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp15$=Out2
       Case "M"
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Strng="[B]lade barrier"
                Call IO.O
                Strng="[C]rushing ceiling"
                Call IO.O
                Strng="[D]eadly spears"
                Call IO.O
                Strng="[F]alling door"
                Call IO.O
                Strng="[P]oison needles"
                Call IO.O
                Graphics.Off=False
             Endif
             Strng="Object trap option(q to quit)? "
             No.Input.Out="Q"
             Line.Length=TempD
             Call IO.I
             Select Case Ucase$(Out2)
             Case "B"
                Temp11=4
             Case "C"
                Temp11=5
             Case "D"
                Temp11=3
             Case "F"
                Temp11=2
             Case "P"
                Temp11=1
             Case "Q"
                Exit Do
             Case Else
                Temp11=False
             End Select
          Loop
       Case "N"
          Temp12=True
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Search for timed lights(y/n)?"
          Call IO.I
          If Yes Then
             Temp12=UnTrue
          Endif
       Case "O"
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Strng="[E]nters room number"
                Call IO.O
                Strng="[L]ights room"
                Call IO.O
                Strng="[U]nlocks object"
                Call IO.O
                Graphics.Off=False
             Endif
             Strng="Object switch option(q to quit)? "
             Line.Length=TempD
             No.Input.Out="Q"
             Call IO.I
             Select Case Ucase$(Out2)
             Case "E"
                Temp13=1
             Case "L"
                Temp13=2
             Case "U"
                Temp13=3
             Case "Q"
                Exit Do
             Case Else
                Temp13=False
             End Select
          Loop
       Case "P"
          Strng="Room init number? "
          Call IO.I
          Temp14!=Int(Val(Out2))
       Case "S"
          Temp3!=Lof(ObjectFile)/ObjectRecLen
          Call Get.Record.Range(Temp1!,Temp2!,Temp3!)
          Allow.Break=True
          Break=False
          Continuous=False
          VarZ1!=0!
          VarZ2!=0!
          If Temp1$<>Nul Then
             VarZ=Instr(Temp1$,"#")
             If VarZ Then
                VarZ2!=Int(Val(Mid$(Temp1$,VarZ+1)))
                Temp1$=Left$(Temp1$,VarZ-1)
             Endif
          Endif
          VarZ3!=0!
          VarZ4!=0!
          If Temp2$<>Nul Then
             VarZ=Instr(Temp2$,"#")
             If VarZ Then
                VarZ4!=Int(Val(Mid$(Temp2$,VarZ+1)))
                Temp2$=Left$(Temp2$,VarZ-1)
             Endif
          Endif
          VarZ5!=0!
          VarZ6!=0!
          If Temp3$<>Nul Then
             VarZ=Instr(Temp3$,"#")
             If VarZ Then
                VarZ6!=Int(Val(Mid$(Temp3$,VarZ+1)))
                Temp3$=Left$(Temp3$,VarZ-1)
             Endif
          Endif
          VarZ7!=0!
          VarZ8!=0!
          If Temp4$<>Nul Then
             VarZ=Instr(Temp4$,"#")
             If VarZ Then
                VarZ8!=Int(Val(Mid$(Temp4$,VarZ+1)))
                Temp4$=Left$(Temp4$,VarZ-1)
             Endif
          Endif
          VarZ14!=0!
          VarZ15!=0!
          If Temp15$<>Nul Then
             VarZ=Instr(Temp15$,"#")
             If VarZ Then
                VarZ15!=Int(Val(Mid$(Temp15$,VarZ+1)))
                Temp15$=Left$(Temp15$,VarZ-1)
             Endif
          Endif
          FileName=Data.Path1+"objdesc.dat"
          Close #TempFile1
          Open FileName For Random Shared As #TempFile1 Len=80
          For Temp!=Temp1! To Temp2!
             Call Read.Record(ObjectFile,Temp!)
             TempX=False
             If Temp1$<>Nul Then
                TempQ$=Rtrim$(Lcase$(ObjectRecord.ObjectName))
                If Len(TempQ$) Then
                   Call InstrSUB(VarX,TempQ$,Temp1$)
                   If VarX Then
                      VarZ1!=VarZ1!+1!
                      If VarZ2!=0! Or VarZ1!=VarZ2! Then
                         TempX=True
                      Endif
                   Endif
                Endif
             Endif
             If Temp2$<>Nul Then
                TempQ$=Rtrim$(Lcase$(ObjectRecord.ShortName))
                If Len(TempQ$) Then
                   Call InstrSUB(VarX,TempQ$,Temp2$)
                   If VarX Then
                      VarZ3!=VarZ3!+1!
                      If VarZ4!=0! Or VarZ3!=VarZ4! Then
                         TempX=True
                      Endif
                   Endif
                Endif
             Endif
             If Temp3$<>Nul Then
                TempQ$=Rtrim$(Lcase$(ObjectRecord.LongDesc))
                If Len(TempQ$) Then
                   Call InstrSUB(VarX,TempQ$,Temp3$)
                   If VarX Then
                      VarZ5!=VarZ5!+1!
                      If VarZ6!=0! Or VarZ5!=VarZ6! Then
                         TempX=True
                      Endif
                   Endif
                Endif
             Endif
             If Temp4$<>Nul Then
                TempQ$=Rtrim$(Lcase$(ObjectRecord.ShortDesc))
                If Len(TempQ$) Then
                   Call InstrSUB(VarX,TempQ$,Temp4$)
                   If VarX Then
                      VarZ7!=VarZ7!+1!
                      If VarZ8!=0! Or VarZ7!=VarZ8! Then
                         TempX=True
                      Endif
                   Endif
                Endif
             Endif
             If Var1! Then
                If ObjectRecord.RoomLink1=Var1! Then
                   TempX=True
                Endif
                If ObjectRecord.RoomLink2=Var1! Then
                   TempX=True
                Endif
             Endif
             If Temp4! Then
                If Temp4!=-1 Then
                   If ObjectRecord.KeyNumber>0! Then
                      TempX=True
                   Endif
                Else
                   If ObjectRecord.KeyNumber=Temp4! Then
                      TempX=True
                   Endif
                Endif
             Endif
             If Temp4 Then
                If ObjectRecord.Invisible Then
                   TempX=True
                Endif
             Endif
             If Temp6 Then
                If ObjectRecord.Hidden Then
                   TempX=True
                Endif
             Endif
             If Temp7 Then
                If ObjectRecord.JailTrap Then
                   TempX=True
                Endif
             Endif
             If Temp8 Then
                If ObjectRecord.Closed Then
                   TempX=True
                Endif
             Endif
             If Temp9 Then
                If ObjectRecord.Relocks Then
                   TempX=True
                Endif
             Endif
             If Temp10 Then
                If ObjectRecord.Permanent=False Then
                   TempX=True
                Endif
             Endif
             If Temp11 Then
                If ObjectRecord.Trap=Temp11 Then
                   TempX=True
                Endif
             Endif
             If Temp12 Then
                If ObjectRecord.LightRoom Then
                   If Temp12=UnTrue Then
                      If ObjectRecord.LightTime Then
                         TempX=True
                      Endif
                   Else
                      TempX=True
                   Endif
                Endif
             Endif
             If Temp13 Then
                If ObjectRecord.SwitchType=Temp13 Then
                   TempX=True
                Endif
             Endif
             If Temp14! Then
                If ObjectRecord.InitRoom=Temp14! Or _
                ObjectRecord.InitRoom2=Temp14! Then
                   TempX=True
                Endif
             Endif
             If Temp15$<>Nul Then
                For Var=1 To 19
                   TempQ!=ObjectRecord.ObjDesc(Var)
                   If TempQ!>SFalse And TempQ!<=Lof(TempFile1)/80! Then
                      Call Read.Record(ObjDescFile,TempQ!)
                      Out3=Rtrim$(BufferRecord.Buffer)
                      If Out3<>Nul Then
                         Call InstrSUB(VarX,Out3,Temp15$)
                         If VarX Then
                            VarZ14!=VarZ14!+1!
                            If VarZ15!=0! Or VarZ14!=VarZ15! Then
                               TempX=True
                            Endif
                         Endif
                         If TempX Then
                            Exit For
                         Endif
                      Endif
                   Endif
                Next
             Endif
             If TempX Then
                For VarQ=1 To 22
                   Call Display.Object(False,VarQ)
                   If Break Then
                      Exit For
                   Endif
                Next
                If Break Then
                   Exit For
                Endif
                If Continuous=False Then
                   Call More.Prompt
                   If No Or Quit Then
                      Exit For
                   Endif
                Endif
             Endif
          Next
          Allow.Break=False
          Break=False
          Exit Do
       Case "Q"
          Exit Sub
       End Select
    Loop
 Loop
ErrExit55:
 Exit Sub
ErrResume55:
 Resume ErrExit55
End Sub

Sub Add.Object.Room
 On Local Error Goto ErrResume142
 Call Read.Record(ObjectFile,Temp!)
 Yes=False
 No=False
 Do Until Yes Or No
    If Lost.Carrier Then
       Yes=False : No=True
       Exit Do
    Endif
    No.Input.Out="N"
    Strng="Add object to room(y/n)? "
    Line.Length=TempD
    Call IO.I
 Loop
 If No Then
    Exit Sub
 Endif
 No.Input.Out=Nul
 Strng="Enter room number"
 If Room Then
    No.Input.Out=Mid$(Str$(Room),2)
    Strng=Strng+"["+Enter$+" for room"+Str$(Room)+"] "
    Carriage.Return=-1
    Call IO.O
 Endif
 Var!=Lof(RoomFile)/RoomRecLen
 Call Get.Record.Range3(SFalse,Var!,Temp4!)
 If Temp4!=SFalse Then
    If Room Then
       Temp4!=Room
    Endif
 Endif
 If Temp4!>SFalse And Temp4!<=Lof(RoomFile)/RoomRecLen Then
    No.Input.Out="N"
    Strng="Add object to room"+Str$(Temp4!)+"(y/n)? "
    Call IO.I
    If Yes Then
       Temp5!=Lof(RoomInvFile)/MessWorkRecLen6+1!
       MessWorkRecord6.Room=Temp4!
       MessWorkRecord6.User=SFalse
       MessWorkRecord6.Index=-Temp!
       MessWorkRecord6.Charges=False
       MessWorkRecord6.Plus=False
       Call Add.List.Node(Temp5!,Temp4!)
       Strng="Object added to room number"+Str$(Temp4!)+"."
       Call IO.O
       ' room object was created
       If ObjectRecord.InitRoom=SFalse Then
          ObjectRecord.InitRoom=Temp4!
       Else
          If ObjectRecord.InitRoom2=SFalse Then
             ObjectRecord.InitRoom2=Temp4!
          Endif
       Endif
    Endif
 Endif
 Var1!=ObjectRecord.RoomLink1
 Var2!=ObjectRecord.RoomLink2
 If Var1! And Var2! Then
    Yes=False
    No=False
    Do Until Yes Or No
       If Lost.Carrier Then
          Yes=False
          Exit Do
       Endif
       Strng="Add object to multiple rooms"+Str$(Var1!)+","+Str$(Var2!)+"(y/n)? "
       Line.Length=TempD
       Call IO.I
    Loop
    If Yes Then
       Temp2=False
       If Var1!>False And Var1!<=Lof(RoomFile)/RoomRecLen Then
          Call Read.Record(RoomFile,Var1!)
          Temp5!=RoomRecord.First
          If Temp5! Then
             Do While Lost.Carrier=False
                Call Read.Record(RoomInvFile,Temp5!)
                Temp6!=MessWorkRecord6.Next
                If MessWorkRecord6.Index=-Temp! Then
                   Temp2=True
                   Exit Do
                Endif
                If Temp6!=SFalse Then
                   Exit Do
                Endif
                Temp5!=Temp6!
             Loop
          Endif
       Endif
       Yes=True
       If Temp2 Then
          Strng="Object already exists in room"+Str$(Var1!)+"."
          Call IO.O
          Yes=False
          No=False
          Do Until Yes Or No
             If Lost.Carrier Then
                Yes=False
                Exit Do
             Endif
             Strng="Add anyway(y/n)? "
             Line.Length=TempD
             Call IO.I
          Loop
       Endif
       If Yes Then
          Temp5!=Lof(RoomInvFile)/MessWorkRecLen6+1
          Temp4!=Var1!
          MessWorkRecord6.Room=Var1!
          MessWorkRecord6.User=SFalse
          MessWorkRecord6.Index=-Temp!
          MessWorkRecord6.Charges=False
          MessWorkRecord6.Plus=False
          Call Add.List.Node(Temp5!,Temp4!)
          Strng="Object added to room number"+Str$(Var1!)+"."
          Call IO.O
       Endif
       Temp2=False
       If Var2!>False And Var2!<=Lof(RoomFile)/RoomRecLen Then
          Call Read.Record(RoomFile,Var2!)
          Temp5!=RoomRecord.First
          If Temp5! Then
             Do While Lost.Carrier=False
                Call Read.Record(RoomInvFile,Temp5!)
                Temp6!=MessWorkRecord6.Next
                If MessWorkRecord6.Index=-Temp! Then
                   Temp2=True
                   Exit Do
                Endif
                If Temp6!=SFalse Then
                   Exit Do
                Endif
                Temp5!=Temp6!
             Loop
          Endif
       Endif
       Yes=True
       If Temp2 Then
          Strng="Object already exists in room"+Str$(Var2!)+"."
          Call IO.O
          Yes=False
          No=False
          Do Until Yes Or No
             If Lost.Carrier Then
                Yes=False
                Exit Do
             Endif
             Strng="Add anyway(y/n)? "
             Line.Length=TempD
             Call IO.I
          Loop
       Endif
       If Yes Then
          Temp5!=Lof(RoomInvFile)/MessWorkRecLen6+1!
          Temp4!=Var2!
          MessWorkRecord6.Room=Var2!
          MessWorkRecord6.User=SFalse
          MessWorkRecord6.Index=-Temp!
          MessWorkRecord6.Charges=False
          MessWorkRecord6.Plus=False
          Call Add.List.Node(Temp5!,Temp4!)
          Strng="Object added to room number"+Str$(Var2!)+"."
          Call IO.O
       Endif
       Exit Sub
    Endif
 Endif
ErrExit142:
 Exit Sub
ErrResume142:
 Resume ErrExit142
End Sub

Sub Add.List.Node(VarZ!,Var2!)
 On Local Error Goto ErrorTrp27a
 Call Read.Record(RoomFile,Var2!)
 If RoomRecord.First=SFalse Then
    RoomRecord.First=VarZ!
    RoomRecord.Last=VarZ!
    Call Write.Record(RoomFile,Var2!)
    MessWorkRecord6.Prev=SFalse
    MessWorkRecord6.Next=SFalse
    Call Write.Record(RoomInvFile,VarZ!)
    Exit Sub
 Endif
 MessWorkRecord6.Prev=RoomRecord.Last
 MessWorkRecord6.Next=SFalse
 Call Write.Record(RoomInvFile,VarZ!)
 Call Read.Record(RoomInvFile,RoomRecord.Last)
 MessWorkRecord6.Next=VarZ!
 Call Write.Record(RoomInvFile,RoomRecord.Last)
 Call Read.Record(RoomInvFile,VarZ!)
 RoomRecord.Last=VarZ!
 Call Write.Record(RoomFile,Var2!)
ErrorRsm27a:
 Exit Sub
ErrorTrp27a:
 Resume ErrorRsm27a
End Sub
