 Rem File: DndeditG.bas
 Rem Sub: EditObject
 Rem $Include: 'dndedit.inc'

 On Error Goto Main.Error
 If Chained2=0 Then
    Call Init.Arrays
    Call Read.Rows(Var2)
    Max.Row=Var2
    Call Save.Screen(False)
    Call Clear.Screen2
    Call Init.Mouse
    Call Read.Config(False)
    Call Passwrd5(Var,"g")
    Close #TempFile1
    If Var=False Then
       Call Terminate.Program(True)
       End
    Endif
 Endif
Main.Resume:
 Call EditObject
 If Chained2 Then
    Chain DND.Path+"DNDEDIT.EXE"
 Endif
 Call Terminate.Program(True)
 End
Main.Error:
 Resume Main.Resume

Sub EditObject
 On Local Error Goto Error.Trap163
 Object.Number=1!
 If Lof(ObjectFile)=SFalse Then
    Call AddObject
 Endif
 Out3="Sysop Object Edit"
 Call DisplayEditScreen(2,17,Out3)
 Call ObjectStatusLine
 Call DisplayObjectScreen
 Do While Lost.Carrier=False
    TempX$=Nul
    Do While TempX$=Nul
       If Lost.Carrier Then
          Exit Do
       Endif
       Call Read.Keyboard(TempX$)
       Call MouseDriver(3)
       If Mouse.Button2 Then
          TempX$=Chr$(27)
       Endif
       If Mouse.Button Then
          Call MouseButton(17)
          If Len(TempX$) Then
             Exit Do
          Endif
       Endif
       If Mouse.Row Or Mouse.Column Then
          Call MouseSelect(17)
       Endif
    Loop
    TempX=False
    Select Case Len(TempX$)
    Case 2
       TempX=Asc(Mid$(TempX$,2,1))
       If TempX=0 Then
          Call Write.Record(ObjectFile,Object.Number)
          Exit Do
       Endif
       Call ObjectSelect
    Case 1
       TempX=Asc(TempX$)
       Select Case TempX
       Case 1
          Call AddObject
       Case 4
          Call ObjectDescEdit
          Call Write.Record(ObjectFile,Object.Number)
          Out3="Sysop Object Edit"
          Call DisplayEditScreen(2,17,Out3)
          Call ObjectStatusLine
          Call DisplayObjectScreen
       Case 8
          Call Help(2)
          Out3="Sysop Object Edit"
          Call DisplayEditScreen(2,17,Out3)
          Call ObjectStatusLine
          Call DisplayObjectScreen
       Case 9
          Call ObjectSelect
       Case 13
          Call ObjectEdit
          Call Write.Record(ObjectFile,Object.Number)
          Call ObjectStatusLine
          TempX=Selection
          Call ShowObject
          Call RedisplayField
       Case 14
          Call NextObject
       Case 17
          Call PreviousObject
       Case 18
          Call SelectNextObject
          Call ObjectStatusLine
       Case 23
          Call SearchObject
       Case 27
          Call Write.Record(ObjectFile,Object.Number)
          Exit Sub
       End Select
    End Select
 Loop
Error.Resume163:
 Exit Sub
Error.Trap163:
 Resume Error.Resume163
End Sub

Sub NextObject
 On Local Error Goto Error.Trap164
 If Object.Number>=Lof(ObjectFile)/ObjectRecLen Then
    Strng="This is the last object in the object file."
    Call ErrorMessage
 Else
    Call Write.Record(ObjectFile,Object.Number)
    Object.Number=Object.Number+1!
    Call DisplayObjectScreen
 Endif
Error.Resume164:
 Exit Sub
Error.Trap164:
 Resume Error.Resume164
End Sub

Sub PreviousObject
 On Local Error Goto Error.Trap165
 If Object.Number>1! Then
    Call Write.Record(ObjectFile,Object.Number)
    Object.Number=Object.Number-1!
    Call DisplayObjectScreen
    Exit Sub
 Endif
 Strng="This is the first object in the object file."
 Call ErrorMessage
Error.Resume165:
 Exit Sub
Error.Trap165:
 Resume Error.Resume165
End Sub

Sub SelectNextObject
 On Local Error Goto Error.Trap166
 Strng=Nul
 Out2="^ Cursor Edit"+Chr$(60)+Chr$(217)+" Exit Field "
 Call StatusLine
 Call ANSI(4,33,44)
 Call ANSI(2,23,2)
 Strng="Enter Object: "
 Call Scrn(Strng)
 Call ANSI(4,37,40)
 Call ANSI(2,23,16)
 Strng=Space$(6)
 Call Scrn(Strng)
 Call ANSI(4,37,44)
 Call ANSI(2,23,25)
 Strng="(1-"+Mid$(Str$(Lof(ObjectFile)/ObjectRecLen),2)+")"
 Multiplier=Len(Strng)+25
 Strng=Strng+" (+/-/x)"
 Call Scrn(Strng)
 Restore Data2
 Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
 Edit.Data(1)=Nul
 Call ScreenEdit
 Multiplier=False
 Temp2!=Int(Val(Edit.Data(1)))
 If Temp2!<=SFalse Or Temp2!>Lof(ObjectFile)/ObjectRecLen Then
    Strng="The object number is not within the object file range."
    Call ErrorMessage
    Exit Sub
 Endif
 Call Write.Record(ObjectFile,Object.Number)
 Object.Number=Temp2!
 Call DisplayObjectScreen
Error.Resume166:
 Exit Sub
Error.Trap166:
 Resume Error.Resume166
End Sub

Sub SearchObject
 On Local Error Goto Error.Trap167
 Call Write.Record(ObjectFile,Object.Number)
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field  "
 Out2=Out2+"Append # sign and number for duplicate objects"
 Call StatusLine
 Call ANSI(4,33,44)
 Call ANSI(2,23,2)
 Strng="Enter Object Name or Number: "
 Call Scrn(Strng)
 Call ANSI(4,37,40)
 Call ANSI(2,23,31)
 Strng=Space$(30)
 Call Scrn(Strng)
 Restore Data3
 Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
 Edit.Data(1)=Nul
 Call ScreenEdit
 Call ObjectStatusLine
 Temp2!=Int(Val(Edit.Data(1)))
 Temp$=Lcase$(Edit.Data(1))
 If Temp2!>SFalse And Temp2!<=Lof(ObjectFile)/ObjectRecLen Then
    Object.Number=Temp2!
    Call DisplayObjectScreen
    Exit Sub
 Endif
 Temp.Index=SFalse
 Temp1=Instr(Temp$,"#")
 If Temp1 Then
    Temp.Index=Csng(Int(Val(Mid$(Temp$,Temp1+1))))
    Temp$=Left$(Temp$,Temp1-1)
 Endif
 Temp4=Len(Temp$)
 Temp!=SFalse
 Temp3!=SFalse
 For Temp2!=1! To Lof(ObjectFile)/ObjectRecLen
    Call Read.Record(ObjectFile,Temp2!)
    Out3=Rtrim$(ObjectRecord.ObjectName)
    Call InstrSUB(TempX,Out3,Temp$)
    If TempX Then
       Temp3!=Temp3!+1!
       If Temp3!=1! Then
          Temp!=Temp2!
       Endif
       If Temp.Index Then
          If Temp3!=Temp.Index Then
             Object.Number=Temp2!
             Call DisplayObjectScreen
             Exit Sub
          Endif
       Endif
    Endif
 Next
 If Temp.Index>SFalse Then
    Strng="The object name was not found in the object file."
    Call ErrorMessage
    Call DisplayObjectScreen
    Exit Sub
 Endif
 If Temp3!=SFalse Then
    Strng="The object name was not found in the object file."
    Call ErrorMessage
    Call DisplayObjectScreen
    Exit Sub
 Endif
 If Temp3!=1! Then
    Object.Number=Temp!
    Call DisplayObjectScreen
    Exit Sub
 Endif
 Strng="There was more than one object found."
 Call ErrorMessage
 Strng="^ Scroll Objects  "+Chr$(60)+Chr$(217)+" Select Object ("+Ltrim$(Str$(Temp3!))+" found)."
 Out2=Nul
 Call StatusLine
 Object.Number=Temp!
 Temp2!=Temp!
 Call Read.Record(ObjectFile,Object.Number)
 Call DisplayObjectScreen
 Do While Lost.Carrier=False
    TempX$=Nul
    Do While TempX$=Nul
       If Lost.Carrier Then
          Exit Do
       Endif
       Call Read.Keyboard(TempX$)
       Call MouseDriver(3)
       If Mouse.Button2 Then
          TempX$=Chr$(27)
       Endif
       If Mouse.Button Then
          Call MouseCheck
          Exit Do
       Endif
    Loop
    Select Case Len(TempX$)
    Case 1
       If TempX$=Chr$(13) Then
          Object.Number=Temp2!
          Call ObjectStatusLine
          Call DisplayObjectScreen
          Exit Sub
       Endif
    Case 2
       TempX=Asc(Mid$(TempX$,2,1))
       Select Case TempX
       Case 72, 141, 152
          TempA=False
          For Temp3!=Temp2!-1! To 1! Step -1!
             Call Read.Record(ObjectFile,Temp3!)
             Out3=Rtrim$(ObjectRecord.ObjectName)
             Call InstrSUB(TempX,Out3,Temp$)
             If TempX Then
                TempA=True
                Temp2!=Temp3!
                Object.Number=Temp3!
                Call DisplayObjectScreen
                Exit For
             Endif
          Next
          If TempA=False Then
             Strng="This is the first object in the search."
             Call ErrorMessage
          Endif
       Case 80, 145, 160
          TempA=False
          For Temp3!=Temp2!+1! To Lof(ObjectFile)/ObjectRecLen
             Call Read.Record(ObjectFile,Temp3!)
             Out3=Rtrim$(ObjectRecord.ObjectName)
             Call InstrSUB(TempX,Out3,Temp$)
             If TempX Then
                TempA=True
                Temp2!=Temp3!
                Object.Number=Temp3!
                Call DisplayObjectScreen
                Exit For
             Endif
          Next
          If TempA=False Then
             Strng="This is the last object in the search."
             Call ErrorMessage
          Endif
       End Select
    End Select
 Loop
Error.Resume167:
 Exit Sub
Error.Trap167:
 Resume Error.Resume167
End Sub

Data2:
 Data 23,16,16,6,23,1,1
Data3:
 Data 23,31,31,30,23,1,1

Sub ObjectStatusLine
 On Local Error Goto Error.Trap168
 Strng="^ Cursor Select "+Chr$(60)+Chr$(217)
 Strng=Strng+" Enter Choice <esc> Exit and Save ^h Help ^a Add Object"
 Out2="^n Next Obj ^q Previous Obj ^r Select Obj ^w Search Obj ^d Multiline Desc"
 Call StatusLine
Error.Resume168:
 Exit Sub
Error.Trap168:
 Resume Error.Resume168
End Sub

Sub DisplayObjectScreen
 On Local Error Goto Error.Trap162
 If Object.Number>False And Object.Number<=Lof(ObjectFile)/ObjectRecLen Then
    Call Read.Record(ObjectFile,Object.Number)
    For TempX=False To 17
       Call ShowObject
    Next
    Call DisplayObject
    Call RedisplayField
 Endif
Error.Resume162:
 Exit Sub
Error.Trap162:
 Resume Error.Resume162
End Sub

Sub ShowObject
 On Local Error Goto Error.Trap20
 Select Case TempX
 Case 0
    Call ANSI(4,37,44)
    Call ANSI(2,2,8)
    Strng=Space$(8)
    Call Scrn(Strng)
    Call ANSI(4,33,44)
    Call ANSI(2,2,2)
    Strng="Object"+Str$(Object.Number)
    Call Scrn(Strng)
 Case Else
    Call ANSI(4,37,40)
    Select Case TempX
    Case 1
       Call ANSI(2,4,2)
       Strng=ObjectRecord.ObjectName
       Call Scrn(Strng)
    Case 2
       Call ANSI(2,7,2)
       Strng=Lcase$(ObjectRecord.ShortName)
       Call Scrn(Strng)
    Case 3
       Call ANSI(2,9,12)
       Strng=Space$(8)
       Call Scrn(Strng)
       Call ANSI(2,9,12)
       Strng=Mid$(Str$(ObjectRecord.RoomLink1),2)
       Call Scrn(Strng)
       Call ANSI(2,9,21)
       Strng=Space$(8)
       Call Scrn(Strng)
       Call ANSI(2,9,21)
       Strng=Mid$(Str$(ObjectRecord.RoomLink2),2)
       Call Scrn(Strng)
    Case 4, 5
       Call ANSI(2,11,10)
       If ObjectRecord.LightRoom Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
       Call ANSI(4,33,44)
       Call ANSI(2,11,25)
       Strng=":"
       Call Scrn(Strng)
       Call ANSI(2,11,29)
       Strng="-"
       Call Scrn(Strng)
       Call ANSI(2,11,33)
       Strng=":"
       Call Scrn(Strng)
       Call ANSI(4,37,40)
       If ObjectRecord.LightTime=False Then
          Call ANSI(2,11,23)
          Strng="00"
          Call Scrn(Strng)
          Call ANSI(2,11,26)
          Strng="00"
          Call Scrn(Strng)
          Call ANSI(2,11,31)
          Strng="00"
          Call Scrn(Strng)
          Call ANSI(2,11,34)
          Strng="00"
          Call Scrn(Strng)
       Else
          Call ANSI(2,11,23)
          Strng=Right$(Str$(ObjectRecord.FromHour+100),2)
          Call Scrn(Strng)
          Call ANSI(2,11,26)
          Strng=Right$(Str$(ObjectRecord.FromMin+100),2)
          Call Scrn(Strng)
          Call ANSI(2,11,31)
          Strng=Right$(Str$(ObjectRecord.ToHour+100),2)
          Call Scrn(Strng)
          Call ANSI(2,11,34)
          Strng=Right$(Str$(ObjectRecord.ToMin+100),2)
          Call Scrn(Strng)
       Endif
    Case 6
       Call ANSI(2,13,13)
       Strng=Space$(6)
       Call Scrn(Strng)
       Call ANSI(2,13,13)
       If ObjectRecord.KeyNumber>SFalse Then
          Strng=Right$(Str$(ObjectRecord.KeyNumber+1000000!),6)
       Else
          Strng="0"
       Endif
       Call Scrn(Strng)
    Case 7
       Call ANSI(2,16,2)
       Strng=Left$(ObjectRecord.LongDesc,78)
       Call Scrn(Strng)
    Case 8
       Call ANSI(2,19,2)
       Strng=Left$(ObjectRecord.ShortDesc,78)
       Call Scrn(Strng)
    Case 9
       Call ANSI(2,3,57)
       If ObjectRecord.Hidden Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 10
       Call ANSI(2,5,60)
       If ObjectRecord.Invisible Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 11
       Call ANSI(2,7,60)
       If ObjectRecord.JailTrap Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 12
       Call ANSI(2,9,57)
       If ObjectRecord.DoorLock>1 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 13
       Call ANSI(2,11,58)
       If ObjectRecord.Relocks Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 14
       Call ANSI(2,13,60)
       If ObjectRecord.Permanent Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 15
       Call ANSI(2,15,69)
       Select Case ObjectRecord.Trap
       Case 1
          Strng="P"
       Case 2
          Strng="F"
       Case 3
          Strng="D"
       Case 4
          Strng="B"
       Case 5
          Strng="C"
       Case Else
          Strng="?"
       End Select
       Call Scrn(Strng)
    End Select
 End Select
Error.Resume20:
 Exit Sub
Error.Trap20:
 Resume Error.Resume20
End Sub

Sub DisplayObject
 On Local Error Goto Error.Trap21
 Call ANSI(4,33,44)
 Call ANSI(2,17,50)
 Select Case ObjectRecord.Trap
 Case 2
    Strng="Teleport"
 Case 3
    Strng="Hits For"
 Case Else
    Strng=Space$(16)
 End Select
 Call Scrn(Strng)
 Call ANSI(4,37,40)
 Call ANSI(2,17,59)
 Select Case ObjectRecord.trap
 Case 2
    If ObjectRecord.Teleport>False Then
       Call Scrn("Y")
    Else
       Call Scrn("N")
    Endif
 Case 3
    Select Case ObjectRecord.Teleport
    Case Is>False
       Call Scrn("F")
    Case Is<False
       Call Scrn("V")
    Case Else
       Call Scrn("?")
    End Select
 End Select
 Call ANSI(4,33,44)
 Call ANSI(2,17,61)
 Select Case ObjectRecord.Trap
 Case 2
    Strng="(Y/N)"
    Call Scrn(Strng)
 Case 3
    Strng="(F/V)"
    Call Scrn(Strng)
 End Select
 Call ANSI(4,33,44)
 Call ANSI(2,18,50)
 Select Case ObjectRecord.Trap
 Case 2
    Title.Data(17)="Room Teleport To"
    Strng="Room Teleport To"
 Case 3
    Title.Data(17)="Fatigue/Vitality"
    Strng="Fatigue/Vitality"
 Case Else
    Strng=Space$(16)
 End Select
 Call Scrn(Strng)
 If ObjectRecord.Trap=2 Or ObjectRecord.Trap=3 Then
    Call ANSI(4,37,40)
 Else
    Call ANSI(1,33,44)
 Endif
 Call ANSI(2,18,67)
 Strng=Space$(5)
 Call Scrn(Strng)
 If ObjectRecord.Trap=2 Or ObjectRecord.Trap=3 Then
    Call ANSI(2,18,67)
    Strng=Mid$(Str$(Abs(ObjectRecord.Teleport)),2)
    Call Scrn(Strng)
 Endif
Error.Resume21:
 Exit Sub
Error.Trap21:
 Resume Error.Resume21
End Sub

Sub AddObject
 On Local Error Goto Error.Trap22
 Object.Number=Lof(ObjectFile)/ObjectRecLen+1!
 ObjectRecord.ObjectName=Nul
 ObjectRecord.ShortName=Nul
 ObjectRecord.RoomLink1=SFalse
 ObjectRecord.RoomLink2=SFalse
 ObjectRecord.Invisible=False
 ObjectRecord.JailTrap=False
 ObjectRecord.DoorLock=False
 ObjectRecord.Permanent=False
 ObjectRecord.Hidden=False
 ObjectRecord.KeyNumber=SFalse
 ObjectRecord.Relocks=False
 ObjectRecord.LightRoom=False
 ObjectRecord.LightTime=False
 ObjectRecord.LongDesc=Nul
 ObjectRecord.ShortDesc=Nul
 ObjectRecord.Trap=False
 ObjectRecord.Teleport=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,Object.Number)
 Call DisplayObjectScreen
 UserRecord.ObjectsCreated(5)=UserRecord.ObjectsCreated(5)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
Error.Resume22:
 Exit Sub
Error.Trap22:
 Resume Error.Resume22
End Sub

Sub ObjectDescEdit
 On Local Error Goto Error.Trap35
 Strng=Nul
 Out2="^ Cursor Edit <esc> Exit Field"
 Call StatusLine
 Call ANSI(4,33,44)
 Call ANSI(2,3,2)
 Strng="Multiline Description:"
 Call Scrn(Strng)
 Call ANSI(2,3,50)
 Strng=Space$(8)
 Call Scrn(Strng)
 Call ANSI(4,37,40)
 For Var=4 To 22
    Call ANSI(2,Var,2)
    Strng=String$(78," ")
    Call Scrn(Strng)
 Next
 FileName=Data.Path1+"objdesc.dat"
 Close #TempFile1
 Open FileName For Random Shared As #TempFile1 Len=80
 For Var=1 To 19
    Edit.Data(Var)=Nul
 Next
 For Var=1 To 19
    VarX!=ObjectRecord.ObjDesc(Var)
    If VarX!>SFalse And VarX!<=Lof(TempFile1)/80! Then
       Call Read.Record(ObjDescFile,VarX!)
       Edit.Data(Var)=Left$(BufferRecord.Buffer,78)
       Call ANSI(2,Var+3,2)
       Strng=Rtrim$(Edit.Data(Var))
       Call Scrn(Strng)
    Endif
 Next
 Xcoor=4
 Ycoor=2
 Column=2
 Line.Length=78
 Max.Lines=19
 Row=4
 Line.Number=1
 Call ScreenEdit
 For TempY=19 To 1 Step -1
    Strng=Rtrim$(Edit.Data(TempY))
    If Len(Strng) Then
       Exit For
    Endif
 Next
 If TempY>False Then
    For TempZ=1 To TempY
       TempQ!=ObjectRecord.ObjDesc(TempZ)
       If TempQ!>SFalse And TempQ!<=Lof(TempFile1)/80! Then
          Call Read.Record(ObjDescFile,TempQ!)
          BufferRecord.Buffer=Edit.Data(TempZ)
          Call Write.Record(ObjDescFile,TempQ!)
       Else
          TempQ!=Lof(TempFile1)/80!+1!
          ObjectRecord.ObjDesc(TempZ)=TempQ!
          BufferRecord.Buffer=Edit.Data(TempZ)
          Call Write.Record(ObjDescFile,TempQ!)
       Endif
    Next
    For TempZ=TempY+1 To 19
       ObjectRecord.ObjDesc(TempZ)=SFalse
    Next
 Endif
 Close #TempFile1
Error.Resume35:
 Exit Sub
Error.Trap35:
 Resume Error.Resume35
End Sub

Sub ObjectEdit
 On Local Error Goto Error.Trap36
 Static TempE
 Restore ObjectEditData
 For TempX=1 To Selection
    Read Xcoor, Ycoor, Column, Line.Length, Max.Lines, Row, Line.Number
 Next
 Select Case Selection
 Case 1
    Edit.Data(1)=ObjectRecord.ObjectName
 Case 2
    Edit.Data(1)=Lcase$(ObjectRecord.ShortName)
 Case 4
    If ObjectRecord.LightRoom Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 5
    Strng="^ Cursor Edit   "
    Out2=Chr$(60)+Chr$(217)+" Exit Field"
    Call StatusLine
    Xcoor=11
    Ycoor=23
    Column=23
    Line.Length=2
    Max.Lines=1
    Row=11
    Line.Number=1
    Edit.Data(1)=Right$(Str$(ObjectRecord.FromHour+100),2)
    Call ScreenEdit
    ObjectRecord.FromHour=Val(Edit.Data(1))
    Xcoor=11
    Ycoor=26
    Column=26
    Line.Length=2
    Max.Lines=1
    Row=11
    Line.Number=1
    Edit.Data(1)=Right$(Str$(ObjectRecord.FromMin+100),2)
    Call ScreenEdit
    ObjectRecord.FromMin=Val(Edit.Data(1))
    Xcoor=11
    Ycoor=31
    Column=31
    Line.Length=2
    Max.Lines=1
    Row=11
    Line.Number=1
    Edit.Data(1)=Right$(Str$(ObjectRecord.ToHour+100),2)
    Call ScreenEdit
    ObjectRecord.ToHour=Val(Edit.Data(1))
    Xcoor=11
    Ycoor=34
    Column=34
    Line.Length=2
    Max.Lines=1
    Row=11
    Line.Number=1
    Edit.Data(1)=Right$(Str$(ObjectRecord.ToMin+100),2)
    Call ScreenEdit
    ObjectRecord.ToMin=Val(Edit.Data(1))
    If ObjectRecord.FromHour Or ObjectRecord.FromMin Or _
    ObjectRecord.ToHour Or ObjectRecord.ToMin Then
       ObjectRecord.LightTime=True
    Else
       ObjectRecord.LightTime=False
    Endif
 Case 6
    If ObjectRecord.KeyNumber>SFalse Then
       Edit.Data(1)=Right$(Str$(ObjectRecord.KeyNumber+1000000!),6)
    Else
       Edit.Data(1)="0"
    Endif
 Case 7
    Edit.Data(1)=Left$(ObjectRecord.LongDesc,78)
 Case 8
    Edit.Data(1)=Left$(ObjectRecord.ShortDesc,78)
 Case 9
    If ObjectRecord.Hidden Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 10
    If ObjectRecord.Invisible Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 11
    If ObjectRecord.JailTrap Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 12
    If ObjectRecord.DoorLock>1 Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 13
    If ObjectRecord.Relocks Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 14
    If ObjectRecord.Permanent Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 15
    Call MakeBox(3,59,9,78)
    Call ANSI(4,37,40)
    Call ANSI(2,4,60)
    Strng="B=Blade Barrier   "
    Call Scrn(Strng)
    Call ANSI(2,5,60)
    Strng="C=Crushing Ceiling"
    Call Scrn(Strng)
    Call ANSI(2,6,60)
    Strng="D=Deadly Spears   "
    Call Scrn(Strng)
    Call ANSI(2,7,60)
    Strng="F=Falling door    "
    Call Scrn(Strng)
    Call ANSI(2,8,60)
    Strng="P=Poison Needles  "
    Call Scrn(Strng)
    Select Case ObjectRecord.Trap
    Case 1
       Edit.Data(1)="P" ' poison needles
    Case 2
       Edit.Data(1)="F" ' falling door
    Case 3
       Edit.Data(1)="D" ' deadly spears
    Case 4
       Edit.Data(1)="B" ' blade barrier
    Case 5
       Edit.Data(1)="C" ' crushing ceiling
    Case Else
       Edit.Data(1)="?"
    End Select
 Case 16
    Select Case ObjectRecord.Trap
    Case 2
       If ObjectRecord.Teleport=False Then
          Edit.Data(1)="N"
       Else
          Edit.Data(1)="Y"
       Endif
    Case 3
       Select Case ObjectRecord.Teleport
       Case Is>False
          Edit.Data(1)="F"
       Case Is<False
          Edit.Data(1)="V"
       Case Else
          Edit.Data(1)="?"
       End Select
    Case Else
       Edit.Data(1)="?"
    End Select
 Case 17
    Edit.Data(1)=Mid$(Str$(Abs(ObjectRecord.Teleport)),2)
 End Select
 If Selection=3 Then
    Strng="^ Cursor Edit   "
    Out2=Chr$(60)+Chr$(217)+" Exit Field"
    Call StatusLine
    Xcoor=9
    Ycoor=12
    Column=12
    Line.Length=8
    Max.Lines=1
    Row=9
    Line.Number=1
    Edit.Data(1)=Mid$(Str$(ObjectRecord.RoomLink1),2)
    Call ScreenEdit
    ObjectRecord.RoomLink1=Int(Val(Edit.Data(1)))
    Xcoor=9
    Ycoor=21
    Column=21
    Line.Length=8
    Max.Lines=1
    Row=9
    Line.Number=1
    Edit.Data(1)=Mid$(Str$(ObjectRecord.RoomLink2),2)
    Call ScreenEdit
    ObjectRecord.RoomLink2=Int(Val(Edit.Data(1)))
    Exit Sub
 Endif
 If Selection<>5 Then
    Strng="^ Cursor Edit   "
    Out2=Chr$(60)+Chr$(217)+" Exit Field"
    Call StatusLine
    Edit.Data(1)=Rtrim$(Edit.Data(1))
    Call ScreenEdit
 Endif
 Select Case Selection
 Case 1
    ObjectRecord.ObjectName=Lcase$(Edit.Data(1))
 Case 2
    ObjectRecord.ShortName=Ucase$(Edit.Data(1))
 Case 4
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.LightRoom=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.LightRoom=False
       ObjectRecord.LightTime=False
       ObjectRecord.FromHour=False
       ObjectRecord.FromMin=False
       ObjectRecord.ToHour=False
       ObjectRecord.ToMin=False
    Endif
 Case 6
    ObjectRecord.KeyNumber=Int(Val(Edit.Data(1)))
 Case 7
    ObjectRecord.LongDesc=Edit.Data(1)
 Case 8
    ObjectRecord.ShortDesc=Edit.Data(1)
 Case 9
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.Hidden=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.Hidden=False
    Endif
 Case 10
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.Invisible=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.Invisible=False
    Endif
 Case 11
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.JailTrap=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.JailTrap=False
    Endif
 Case 12
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.DoorLock=2
       ObjectRecord.Closed=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.DoorLock=False
       ObjectRecord.Closed=False
    Endif
 Case 13
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.Relocks=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.Relocks=False
    Endif
 Case 14
    If Ucase$(Edit.Data(1))="Y" Then
       ObjectRecord.Permanent=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ObjectRecord.Permanent=False
    Endif
 Case 15
    Call ANSI(4,37,44)
    For TempX=3 To 9
       Call ANSI(2,TempX,59)
       Strng=Space$(20)
       Call Scrn(Strng)
    Next
    Call ANSI(4,33,44)
    For Temp2=10 To 11
       Call ANSI(2,Array.Data(Temp2,1),Array.Data(Temp2,2))
       Strng=Title.Data(Temp2)
       Call Scrn(Strng)
    Next
    For TempX=10 To 11
       Call ShowObject
    Next
    Select Case Ucase$(Edit.Data(1))
    Case "P"
       ObjectRecord.Trap=1
       ObjectRecord.Teleport=False
    Case "F"
       ObjectRecord.Trap=2
       ObjectRecord.Teleport=1
    Case "D"
       ObjectRecord.Trap=3
       ObjectRecord.Teleport=1
    Case "B"
       ObjectRecord.Trap=4
       ObjectRecord.Teleport=False
    Case "C"
       ObjectRecord.Trap=5
       ObjectRecord.Teleport=False
    Case Else
       ObjectRecord.Trap=False
    End Select
    Call DisplayObject
 Case 16
    Select Case ObjectRecord.Trap
    Case 2
       Select Case Ucase$(Edit.Data(1))
       Case "Y"
          TempE=1
          ObjectRecord.Teleport=1
          Call DisplayObject
          Next.Field=17
          Call ShowField
          Call ObjectEdit
       Case Else
          TempE=False
          ObjectRecord.Teleport=False
          Call ANSI(4,37,40)
          Call ANSI(2,17,59)
          Strng="N"
          Call Scrn(Strng)
          Call ANSI(2,18,67)
          Strng="0"
          Call Scrn(Strng)
          Strng=Space$(4)
          Call Scrn(Strng)
       End Select
    Case 3
       Select Case Ucase$(Edit.Data(1))
       Case "F"
          TempE=1
          ObjectRecord.Teleport=1
          Call DisplayObject
          Next.Field=17
          Call ShowField
          Call ObjectEdit
       Case "V"
          TempE=True
          ObjectRecord.Teleport=True
          Call DisplayObject
          Next.Field=17
          Call ShowField
          Call ObjectEdit
       Case Else
          ObjectRecord.Teleport=False
          Call ANSI(4,37,40)
          Call ANSI(2,17,59)
          Strng="?"
          Call Scrn(Strng)
          Call ANSI(2,18,67)
          Strng="0"
          Call Scrn(Strng)
          Strng=Space$(4)
          Call Scrn(Strng)
       End Select
    End Select
 Case 17
    ObjectRecord.Teleport=Val(Edit.Data(1))*TempE
    Next.Field=16
    Call ShowField
 End Select
Error.Resume36:
 Exit Sub
Error.Trap36:
 Resume Error.Resume36
End Sub

ObjectEditData:
 Data 4,2,2,30,1,4,1
 Data 7,2,2,30,1,7,1
 Data 9,12,12,7,1,9,1
 Data 11,10,10,1,1,11,1
 Data 11,25,25,5,1,11,1
 Data 13,13,13,6,1,13,1
 Data 16,2,2,78,1,16,1
 Data 19,2,2,78,1,19,1
 Data 3,57,57,1,1,3,1
 Data 5,60,60,1,1,5,1
 Data 7,60,60,1,1,7,1
 Data 9,57,57,1,1,9,1
 Data 11,58,58,1,1,11,1
 Data 13,60,60,1,1,13,1
 Data 15,69,69,1,1,15,1
 Data 17,59,59,1,1,17,1
 Data 18,67,67,5,1,18,1

Sub ObjectSelect
 On Local Error Goto Error.Trap64
 Next.Field=False
 If TempX$=Chr$(9) Then
    TempX=77
 Endif
 Select Case TempX
 Case 77, 157, 116
    Select Case Selection
    Case 1
       Next.Field=9
    Case 2, 3
       Next.Field=Selection+9
    Case 4
       Next.Field=5
    Case 6, 7, 8
       Next.Field=Selection+8
    End Select
 Case 15, 75, 155, 115
    Select Case Selection
    Case 5
       Next.Field=4
    Case 9, 10
       Next.Field=1
    Case 11, 12
       Next.Field=Selection-9
    Case 13
       Next.Field=3
    Case 14, 15, 16
       Next.Field=Selection-8
    End Select
 Case 72, 141, 152
    If Selection>1 Then
       Next.Field=Selection-1
    Endif
 Case 80, 145, 160
    If Selection<16 Then
       Next.Field=Selection+1
    Endif
 Case 71, 119
    If Selection<>1 Then
       Next.Field=1
    Endif
 Case 79, 117
    Select Case ObjectRecord.Trap
    Case 2, 3
       If Selection<>16 Then
          Next.Field=16
       Endif
    Case Else
       If Selection<>15 Then
          Next.Field=15
       Endif
    End Select
 Case 73, 132
    Select Case Selection
    Case 2 To 8
       Next.Field=1
    Case 8
       Next.Field=9
    End Select
 Case 81, 118
    Select Case Selection
    Case 1 To 7
       Next.Field=8
    Case 9 To 16
       Select Case ObjectRecord.Trap
       Case 2, 3
          If Next.Field<>16 Then
             Next.Field=16
          Endif
       Case Else
          If Selection<>15 Then
             Next.Field=15
          Endif
       End Select
    End Select
 End Select
 If Next.Field=16 Then
    Select Case ObjectRecord.Trap
    Case 2
       Title.Data(16)="Teleport"
    Case 3
       Title.Data(16)="Hits For"
    Case Else
       Title.Data(16)="<none>  "
       Exit Sub
    End Select
 Endif
 Call ShowField
Error.Resume64:
 Exit Sub
Error.Trap64:
 Resume Error.Resume64
End Sub
