 Rem File: EditcmdC 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,"c")
    If Var=False Then
       Call Terminate.Program
       End
    Endif
 Endif
 Call Edit.Treasure
MainExit0:
 End
ErrMain0:
 Resume MainExit0
 End

Sub Edit.Treasure
 On Local Error Goto ErrResume50
 Call Edit.Status.Line
 If Lof(TreasureFile)=SFalse Then
    Call Add.Treasure
 Endif
 Do While Lost.Carrier=False
    If TempC=False Then
       Graphics.Off=False
       Strng="Treasure Edit utility v"+Left$(Version$,4)+" menu:"
       Call IO.O
       Graphics.Off=True
       Strng=RT$(429,"[A]")+"dd"
       Call IO.O
       Strng=RT$(430,"[C]")+"hange"
       Call IO.O
       Strng=RT$(431,"[L]")+"ist"
       Call IO.O
       If Local.Mode Then
          Strng=RT$(592,"[P]")+"rint"
          Call IO.O
       Endif
       Strng=RT$(432,"[S]")+"earch"
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="Treasure edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(429,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Add.Treasure
          Temp5!=Lof(TreasureFile)/TreasureRecLen
          Call Change.Treasure
       Endif
    Case "C"
       If RT$(430,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Treasure
          If TempC! Then
             Temp5!=TempC!
             Call Change.Treasure
          Else
             Strng="Treasure not found."
             Call IO.O
          Endif
       Endif
    Case "L"
       If RT$(431,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call List.Treasure
       Endif
    Case "S"
       If RT$(432,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Search.Treasure
       Endif
    Case "P"
       If Local.Mode Then
          If RT$(592,"[P]")="[*]" Then
             Strng="Command restricted.."
             Call IO.O
          Else
             Call Print.Treasure
          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
ErrExit50:
 Exit Sub
ErrResume50:
 Resume ErrExit50
End Sub

Sub Add.Treasure
 On Local Error Goto ErrResume51
 Temp5!=Lof(TreasureFile)/TreasureRecLen+1!
 TreasureRecord.TreasureName=Nul
 TreasureRecord.ShortName=Nul
 TreasureRecord.Weight=False
 TreasureRecord.Gold=DFalse
 TreasureRecord.Spell=False
 TreasureRecord.Plus=False
 TreasureRecord.Coin=False
 TreasureRecord.Locked=False
 TreasureRecord.KeyNumber=SFalse
 TreasureRecord.Scroll=False
 TreasureRecord.Charges=False
 TreasureRecord.Potion=False
 TreasureRecord.Loadable=False
 TreasureRecord.Ammunition=False
 TreasureRecord.AmmoLoads=False
 TreasureRecord.Invisible=False
 TreasureRecord.Permanent=False
 TreasureRecord.StaysInRoom=False
 TreasureRecord.Occupants=False
 TreasureRecord.Proficiency=False
 TreasureRecord.WeaponNumber=False
 TreasureRecord.RingType=False
 TreasureRecord.RingSpell=False
 TreasureRecord.Edible=False
 TreasureRecord.Rustable=False
 TreasureRecord.RustPercent=False
 TreasureRecord.Stealable=False
 TreasureRecord.StealPercent=False
 TreasureRecord.Launchable=False
 TreasureRecord.LaunchLoads=False
 TreasureRecord.LaunchAmmo=False
 TreasureRecord.Movable=False
 TreasureRecord.Vehicle=False
 TreasureRecord.VehicleType=False
 TreasureRecord.LightType=False
 TreasureRecord.LightCharges=False
 TreasureRecord.FuelType=False
 TreasureRecord.FuelCharges=False
 TreasureRecord.Container=False
 TreasureRecord.ContainerMax=False
 TreasureRecord.ContainerPrefix="in it"
 TreasureRecord.ContainerDisappears=False
 TreasureRecord.ContainerSize=False
 TreasureRecord.ContainerMaterial=False
 TreasureRecord.ContainerSelfImplodes=False
 TreasureRecord.PotionType=False
 TreasureRecord.NewPotion=False
 TreasureRecord.MixPotion=False
 TreasureRecord.TwoHanded=False
 TreasureRecord.RequireStr=False
 TreasureRecord.RequireDex=False
 TreasureRecord.RequireInt=False
 For Var=1 To 3
    TreasureRecord.RestrictItem(Var)=SFalse
 Next
 TreasureRecord.TrapType=False
 TreasureRecord.TrapHits=False
 TreasureRecord.TrapItem=SFalse
 TreasureRecord.MasterKey=False
 TreasureRecord.Liquid=False
 TreasureRecord.LiquidType=False
 TreasureRecord.LiquidFlags=False
 TreasureRecord.Prefix1=Nul
 TreasureRecord.StaysInRoom=0
 TreasureRecord.Occupants=0
 TreasureRecord.BindType=0
 TreasureRecord.TimesCursed=0
 TreasureRecord.TimesBlessed=0
 TreasureRecord.Persistent=0
 TreasureRecord.MaxPersistCharges=0
 TreasureRecord.PersistTime=0!
 TreasureRecord.DischargePersist=0!
 TreasureRecord.ProperName=""
 Call Write.Record(TreasureFile,Temp5!)
 UserRecord.ObjectsCreated(9)=UserRecord.ObjectsCreated(9)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
ErrExit51:
 Exit Sub
ErrResume51:
 Resume ErrExit51
End Sub

Sub List.Treasure
 On Local Error Goto ErrResume52
 Temp3!=Lof(TreasureFile)/TreasureRecLen
 Call Get.Record.Range(Temp!,Temp2!,Temp3!)
 Allow.Break=True
 Break=False
 Continuous=False
 For Temp5!=Temp! To Temp2!
    Call Read.Record(TreasureFile,Temp5!)
    For VarQ=1 To 20
       Call Display.Treasure(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
ErrExit52:
 Exit Sub
ErrResume52:
 Resume ErrExit52
End Sub

Sub Print.Treasure
 On Local Error Goto ErrResume52a
 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(TreasureFile)/TreasureRecLen
    Call Get.Record.Range(Temp!,Temp2!,Temp3!)
    For Temp5!=Temp! To Temp2!
       Call Read.Record(TreasureFile,Temp5!)
       For VarQ=1 To 20
          Call Print.Item(VarQ)
       Next
       Print #TempFile1,Chr$(12);
    Next
 Endif
ErrExit52a:
 Close #TempFile1
 Exit Sub
ErrResume52a:
 Resume ErrExit52a
End Sub

Sub Search.Treasure
 On Local Error Goto ErrResume59
 Do While Lost.Carrier=False
    Temp1$=Nul
    Temp1=False
    Temp3=False
    Temp4#=False
    Temp6#=False
    Temp7=False
    Temp7A=False
    Temp8=False
    Temp8A=False
    Temp9!=SFalse
    Temp10!=SFalse
    Temp11=False
    Temp12=False
    Temp13=False
    Temp14=False
    Temp15=False
    Temp16=False
    Temp17=False
    Temp18=False
    Temp19=False
    Temp20=False
    Temp21=False
    Temp22=False
    Temp23=False
    Temp24=False
    Temp25=False
    Do While Lost.Carrier=False
       Graphics.Off=True
       If TempC=False Then
          Strng="[A]treasure name substring"
          If Temp1$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp1$+")"
          Endif
          Call IO.O
          Strng="[B]weight"
          If Temp1>=False And Temp3>False Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp1),2)+"-"+Mid$(Str$(Temp3),2)+")"
          Endif
          Call IO.O
          Strng="[C]value"
          If Temp4#>=DFalse And Temp6#>DFalse Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp4#),2)+"-"+Mid$(Str$(Temp6#),2)+")"
          Endif
          Call IO.O
          Strng="[D]hit plus"
          If Temp7>0 And Temp7A>0 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp7),2)+"-"+Mid$(Str$(Temp7A),2)+")"
          Endif
          Call IO.O
          Strng="[E]charges"
          If Temp8>0 And Temp8A>0 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp8),2)+"-"+Mid$(Str$(Temp8A),2)+")"
          Endif
          Call IO.O
          Strng="[F]coins"
          If Temp11 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[G]potions"
          If Temp12 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[H]scrolls"
          If Temp13 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[I]loadable"
          If Temp14 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[J]ammunition"
          If Temp15 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[K]key number"
          If Temp9! Then
             Strng=Strng+Space$(30-Len(Strng))
             Select Case Temp9!
             Case -1!
                Strng=Strng+"Master"
             Case -2!
                Strng=Strng+"<any>"
             Case Else
                Strng=Strng+"(#"+Right$(Str$(Temp9!+1000000!),6)+")"
             End Select
          Endif
          Call IO.O
          Strng="[L]spell name"
          If Temp10! Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(number:"+Str$(Temp10!)+")"
          Endif
          Call IO.O
          Strng="[M]rings"
          If Temp17 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[N]rustable"
          If Temp18 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[O]stealable"
          If Temp19 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[P]edible"
          If Temp20 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[R]launchable
          If Temp21 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[T]launch ammo"
          If Temp22 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[U]vehicles"
          If Temp23 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[V]permanent"
          If Temp24 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[W]container"
          If Temp25 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Graphics.Off=False
       Endif
       Strng="Treasure 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="Treasure name substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp1$=Out2
       Case "B"
          Strng="Enter range: "
          Call IO.O
          Strng="From? "
          No.Input.Out="1"
          Call IO.I
          Temp1=Int(Val(Out2))
          Strng="To? "
          No.Input.Out="10"
          Call IO.I
          Temp3=Int(Val(Out2))
       Case "C"
          Strng="Enter range:"
          Call IO.O
          Strng="From? "
          No.Input.Out="1"
          Call IO.I
          Temp4#=Int(Val(Out2))
          Strng="To? "
          No.Input.Out="10"
          Call IO.I
          Temp6#=Int(Val(Out2))
       Case "D"
          Strng="Enter range:"
          Call IO.O
          Strng="From? "
          No.Input.Out="1"
          Call IO.I
          Temp7=Int(Val(Out2))
          Strng="To? "
          No.Input.Out="10"
          Call IO.I
          Temp7A=Int(Val(Out2))
       Case "E"
          Strng="Enter range:"
          Call IO.O
          Strng="From? "
          No.Input.Out="1"
          Call IO.I
          Temp8=Int(Val(Out2))
          Strng="To? "
          No.Input.Out="10"
          Call IO.I
          Temp8A=Int(Val(Out2))
       Case "F"
          Temp11=True
       Case "G"
          Temp12=True
       Case "H"
          Temp13=True
       Case "I"
          Temp14=True
       Case "J"
          Temp15=True
       Case "K"
          Strng="Key number(-1=master,-2=any)? "
          Call IO.I
          Temp9!=0!
          Var!=Int(Val(Out2))
          Select Case Var!
          Case -1!, -2!
             Temp9!=Var!
          Case 1! To 999999!
             Temp9!=Var!
          End Select
       Case "L"
          Call Find.Spell(-1)
          If TempD! Then
             Temp10!=TempD!
          Endif
       Case "M"
          Temp17=True
       Case "N"
          Temp18=True
       Case "O"
          Temp19=True
       Case "P"
          Temp20=True
       Case "R"
          Temp21=True
       Case "T"
          Temp22=True
       Case "U"
          Temp23=True
       Case "V"
          Temp24=True
       Case "W"
          Temp25=True
       Case "S"
          Temp5!=Lof(TreasureFile)/TreasureRecLen
          Call Get.Record.Range(Temp!,Temp2!,Temp5!)
          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
          For Temp5!=Temp! To Temp2!
             TempX=False
             Call Read.Record(TreasureFile,Temp5!)
             If Temp1$<>Nul Then
                Out3=Rtrim$(TreasureRecord.TreasureName)
                Call InstrSUB(VarX,Out3,Temp1$)
                If VarX Then
                   VarZ1!=VarZ1!+1!
                   If VarZ2!=0! Or VarZ1!=VarZ2! Then
                      TempX=True
                   Endif
                Endif
             Endif
             If Temp1>=False And Temp3>False Then
                If TreasureRecord.Weight>=Temp1 And _
                TreasureRecord.Weight<=Temp3 Then
                   TempX=True
                Endif
             Endif
             If Temp4#>=DFalse And Temp6#>DFalse Then
                If TreasureRecord.Gold>=Temp4# And _
                TreasureRecord.Gold<=Temp6# Then
                   TempX=True
                Endif
             Endif
             If Temp7>0 And Temp7A>0 Then
                If Abs(TreasureRecord.Plus)>=Temp7 And _
                Abs(TreasureRecord.Plus)<=Temp7A Then
                   TempX=True
                Endif
             Endif
             If Temp8>0 And Temp8A>0 Then
                If Abs(TreasureRecord.Charges)>=Temp8 And _
                Abs(TreasureRecord.Charges)<=Temp8A Then
                   TempX=True
                Endif
             Endif
             If Temp9! Then
                If Temp9!=-1! Then
                   If TreasureRecord.MasterKey Then
                      TempX=True
                   Endif
                Else
                   If Temp9!=-2! Then
                      If TreasureRecord.KeyNumber>0! Then
                         TempX=True
                      Endif
                   Else
                      If TreasureRecord.KeyNumber=Temp9! Then
                         TempX=True
                      Endif
                   Endif
                Endif
             Endif
             If Temp10! Then
                If TreasureRecord.Spell=Temp10! Then
                   TempX=True
                Endif
             Endif
             If Temp11 Then
                If TreasureRecord.Coin Then
                   TempX=True
                Endif
             Endif
             If Temp12 Then
                If TreasureRecord.Potion Then
                   TempX=True
                Endif
             Endif
             If Temp13 Then
                If TreasureRecord.Scroll Then
                   TempX=True
                Endif
             Endif
             If Temp14 Then
                If TreasureRecord.Loadable Then
                   TempX=True
                Endif
             Endif
             If Temp15 Then
                If TreasureRecord.Ammunition Then
                   TempX=True
                Endif
             Endif
             If Temp17 Then
                If TreasureRecord.RingType Then
                   TempX=True
                Endif
             Endif
             If Temp18 Then
                If TreasureRecord.Rustable Then
                   TempX=True
                Endif
             Endif
             If Temp19 Then
                If TreasureRecord.Stealable Then
                   TempX=True
                Endif
             Endif
             If Temp20 Then
                If TreasureRecord.Edible Then
                   TempX=True
                Endif
             Endif
             If Temp21 Then
                If TreasureRecord.Launchable Then
                   TempX=True
                Endif
             Endif
             If Temp22 Then
                If TreasureRecord.LaunchAmmo Then
                   TempX=True
                Endif
             Endif
             If Temp23 Then
                If TreasureRecord.Vehicle Then
                   TempX=True
                Endif
             Endif
             If Temp24 Then
                If TreasureRecord.Permanent Then
                   TempX=True
                Endif
             Endif
             If Temp25 Then
                If TreasureRecord.Container Then
                   TempX=True
                Endif
             Endif
             If TempX Then
                For VarQ=1 To 20
                   Call Display.Treasure(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
ErrExit59:
 Exit Sub
ErrResume59:
 Resume ErrExit59
End Sub

Sub Display.Treasure(TempX,Var)
 On Local Error Goto ErrResume110
 If TempX Then
    If TempC Then
       Exit Sub
    Endif
 Endif
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="Treasure number"+Str$(Temp5!)+":"
 Call IO.O
 Graphics.Off=True
 Case 2
 If TempX Then
    Strng=RT$(433,"[A]")
 Endif
 Strng=Strng+"Treasure: "+Rtrim$(TreasureRecord.TreasureName)
 If Rtrim$(TreasureRecord.ProperName)<>"" Then
    Strng=Strng+": "+Rtrim$(TreasureRecord.ProperName)
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(452,"[U]")
 Endif
 Strng=Strng+"Treasure is coins: "
 If TreasureRecord.Coin Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 3
 If TempX Then
    Strng=RT$(434,"[B]")
 Endif
 Strng=Strng+"Identifier: "+Lcase$(TreasureRecord.ShortName)
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(453,"[V]")
 Endif
 Strng=Strng+"Treasure is a potion: "
 If TreasureRecord.Potion Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 If TreasureRecord.Liquid Then
    Strng=Strng+" (liquid)"
 Endif
 Call IO.O
 Case 4
 If TempX Then
    Strng=RT$(435,"[C]")
 Endif
 Strng=Strng+"Weight: "+Form$(Cdbl(TreasureRecord.Weight))
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(454,"[W]")
 Endif
 Strng=Strng+"Treasure is a scroll: "
 If TreasureRecord.Scroll Then
    Strng=Strng+"Yes"
    If TreasureRecord.Scroll=1 Then
       Strng=Strng+"/Write"
    Endif
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 5
 If TempX Then
    Strng=RT$(436,"[D]")
 Endif
 Call Amount(TreasureRecord.Gold,Var$)
 Strng=Strng+"Gold coin value:"+Var$
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(455,"[X]")
 Endif
 Strng=Strng+"Treasure is invisible: "
 If TreasureRecord.Invisible Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 6
 If TempX Then
    Strng=RT$(437,"[E]")
 Endif
 Strng=Strng+"Treasure type: "
 VarQ=TreasureRecord.WeaponNumber
 If VarQ>=1 And VarQ<=10 Then
    Var$=Rtrim$(InventoryNames(VarQ))
    Select Case VarQ
    Case 2, 6
       Var$=Var$+"s"
    Case 4
       Var$=Var$+"(left)"
       If TreasureRecord.BindType Then
          Var$=Var$+"(binds)"
       Endif
    Case 9
       Var$=Var$+"(right)"
       If TreasureRecord.BindType Then
          Var$=Var$+"(binds)"
       Endif
    Case 7
       If TreasureRecord.TwoHanded Then
          Var$=Var$+"(two-handed)"
       Endif
    End Select
 Else
    If TreasureRecord.Container Then
       Var$="Container"
    Else
       If TreasureRecord.Spell Then
          Var$="Magical"
       Else
          If TreasureRecord.Vehicle Then
             Var$="Vehicle"
          Else
             Var$="Treasure"
          Endif
       Endif
    Endif
 Endif
 If Len(Var$) Then
    Mid$(Var$,1,1)=Ucase$(Mid$(Var$,1,1))
    Strng=Strng+Var$
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(456,"[Y]")
 Endif
 Strng=Strng+"Treasure key number: "
 If TreasureRecord.MasterKey Then
    Strng=Strng+"<master>"
 Else
    If TreasureRecord.KeyNumber>SFalse Then
       Strng=Strng+"(#"+Right$(Str$(TreasureRecord.KeyNumber+1000000!),6)+")"
    Else
       Strng=Strng+"No"
    Endif
 Endif
 Call IO.O
 Case 7
 If TempX Then
    Strng=RT$(438,"[F]")
 Endif
 Strng=Strng+"Hit plus: "+Form$(Cdbl(Abs(TreasureRecord.Plus)))
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(457,"[Z]")
 Endif
 Strng=Strng+"Treasure is fuel: "
 If TreasureRecord.FuelType=False Then
    Strng=Strng+"No"
 Else
    Strng=Strng+"Yes:"+Str$(TreasureRecord.FuelCharges)+" charges"
 Endif
 Call IO.O
 Case 8
 If TempX Then
    Strng=RT$(439,"[G]")
 Endif
 If TreasureRecord.Charges=True Then
    If TreasureRecord.Vehicle Then
       Strng=Strng+"Charges: <safe>"
    Else
       Strng=Strng+"Charges: <bad range>"
    Endif
 Else
    Strng=Strng+"Charges: "+Form$(Cdbl(TreasureRecord.Charges))
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(458,"[1]")
 Endif
 Strng=Strng+"Weapon rusts: "
 If TreasureRecord.Rustable Then
    Strng=Strng+"Yes:"+Str$(TreasureRecord.RustPercent)+"%"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 9
 If TempX Then
    Strng=RT$(440,"[H]")
 Endif
 Strng=Strng+"Weapon class: "
 Select Case TreasureRecord.Proficiency
 Case Blunt
    Strng=Strng+"Blunt"
 Case Pole
    Strng=Strng+"Pole"
 Case Sharp
    Strng=Strng+"Sharp"
 Case Thrusting
    Strng=Strng+"Thrusting"
 Case Else
    Strng=Strng+"None"
 End Select
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(459,"[2]")
 Endif
 Strng=Strng+"Weapon is stealable: "
 If TreasureRecord.Stealable Then
    Strng=Strng+"Yes:"+Str$(TreasureRecord.StealPercent)+"%"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 10
 If TempX Then
    Strng=RT$(441,"[I]")
 Endif
 Strng=Strng+"Treasure is permanent: "
 If TreasureRecord.Permanent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(460,"[3]")
 Endif
 Strng=Strng+"Container disappears: "
 If TreasureRecord.Container Then
    If TreasureRecord.ContainerDisappears Then
       Strng=Strng+"Yes:"+Str$(TreasureRecord.ContainerDisappears)
    Else
       If TreasureRecord.ContainerSelfImplodes Then
          Strng=Strng+"Yes: Implodes
       Else
          Strng=Strng+"No"
       Endif
    Endif
 Else
    Strng=Strng+"<n/a>"
 Endif
 Call IO.O
 Case 11
 If TempX Then
    Strng=RT$(442,"[J]")
 Endif
 Strng=Strng+"Treasure is edible: "
 If TreasureRecord.Edible Then
    Strng=Strng+"Yes"

    Strng2=Nul
    If (TreasureRecord.Edible And 2)=2 Then
       Strng2=Strng2+" /s" ' slips
    Endif
    If (TreasureRecord.Edible And 4)=4 Then
       Strng2=Strng2+" /o" ' smokable
    Endif
    If (TreasureRecord.Edible And 8)=8 Then
       Strng2=Strng2+" /b" ' burnable
    Endif
    If Len(Strng2) Then
        Strng=Strng+":"+Strng2
    Endif
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(461,"[4]")
 Endif
 Strng=Strng+"Container is locked: "
 If TreasureRecord.Container Then
    If TreasureRecord.Locked Then
       Strng=Strng+"Yes"
    Else
       Strng=Strng+"No"
    Endif
 Else
    Strng=Strng+"<n/a>"
 Endif
 Call IO.O
 Case 12
 If TempX Then
    Strng=RT$(443,"[K]")
 Endif
 Strng=Strng+"Treasure is magical: "
 Var1!=TreasureRecord.Spell
 If Var1!=SFalse Then
    Strng=Strng+"No"
 Else
    If Var1!>SFalse And Var1!<=Lof(SpellFile)/SpellRecLen Then
       Call Read.Record(SpellFile,Var1!)
       Strng=Strng+Rtrim$(SpellRecord.SpellName)
    Endif
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(638,"[5]")
 Endif
 Strng=Strng+"Container is trapped: "
 If TreasureRecord.TrapType Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 13
 If TempX Then
    Strng=RT$(444,"[L]")
 Endif
 Strng=Strng+"Ring protection: "
 Select Case TreasureRecord.RingType
 Case 0
    Strng=Strng+"None"
 Case 1
    Strng=Strng+"Poison"
 Case 2
    Strng=Strng+"Level drain"
 Case 3
    Var1!=TreasureRecord.RingSpell
    If Var1!=STrue Then
       Strng=Strng+"Any spell"
    Else
       If Var1!>SFalse And Var1!<=Lof(SpellFile)/SpellRecLen Then
          Call Read.Record(SpellFile,Var1!)
          Strng=Strng+Rtrim$(Lcase$(SpellRecord.SpellName))
       Endif
    Endif
 Case 4
    Strng=Strng+"Traps"
 Case 5
    Strng=Strng+"Rusting"
 Case 6
    Strng=Strng+"Stealing"
 Case 7
    Strng=Strng+"Inventory Damage"
 Case 8
    Strng=Strng+"Fumbling"
 Case 9
    Strng=Strng+"Teleporting"
 Case Else
    Strng=Strng+"None"
 End Select
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(462,"[6]")
 Endif
 Strng=Strng+"Container maximum:"
 If TreasureRecord.ContainerMax=True Then
    Strng=Strng+" <unlimited>"
 Else
    If TreasureRecord.ContainerMax Then
       Strng=Strng+Str$(TreasureRecord.ContainerMax)
    Else
       Strng=Strng+" <n/a>"
    Endif
 Endif
 Call IO.O
 Case 14
 If TempX Then
    Strng=RT$(445,"[M]")
 Endif
 Strng=Strng+"Treasure is a light:"
 If TreasureRecord.LightType=False Then
    Strng=Strng+" No"
 Else
    Strng=Strng+Str$(TreasureRecord.LightCharges)+" charges"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(463,"[7]")
 Endif
 Strng=Strng+"Container prefix: "
 If TreasureRecord.Container Then
    Strng=Strng+Rtrim$(TreasureRecord.ContainerPrefix)
 Else
    Strng=Strng+"<n/a>"
 Endif
 Strng=Left$(Strng,79)
 Call IO.O
 Case 15
 If TempX Then
    Strng=RT$(446,"[N]")
 Endif
 Strng=Strng+"Treasure is a vehicle: "
 If TreasureRecord.Vehicle=False Then
    Strng=Strng+"No"
 Else
    If TempX=False Then
       Strng=Strng+"Yes: "
    Endif
    Select Case TreasureRecord.VehicleType
    Case Air
       Strng=Strng+"Air"
    Case Land
       Strng=Strng+"Land"
    Case Water
       Strng=Strng+"Water"
    Case AllTerrain
       Strng=Strng+"All Terrain"
    End Select
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(464,"[8]")
 Endif
 Strng=Strng+"Container size: "
 If TreasureRecord.Container Then
    Select Case TreasureRecord.ContainerSize
    Case 1
       Strng=Strng+"Small/"
    Case 2
       Strng=Strng+"Medium/"
    Case 3
       Strng=Strng+"Large/"
    Case Else
       Strng=Strng+"Any/"
    End Select
    Select Case TreasureRecord.ContainerMaterial
    Case -1
       Strng=Strng+"Burnable"
    Case 1
       Strng=Strng+"Glass"
    Case 2
       Strng=Strng+"Wood"
    Case 3
       Strng=Strng+"Metal"
    Case Else
       Strng=Strng+"Paper"
    End Select
 Else
    Strng=Strng+"<n/a>"
 Endif
 Call IO.O
 Case 16
 If TempX Then
    Strng=RT$(447,"[O]")
 Endif
 Strng=Strng+"Loads from device: "
 If TreasureRecord.Ammunition Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(637,"[9]")
 Endif
 Strng=Strng+"Container restrictions:"
 VarR=False
 For VarQ=1 To 3
    VarZ=TreasureRecord.RestrictItem(VarQ)
    If VarZ Then
       VarR=VarR+1
    Endif
 Next
 If VarR=False Then
    Strng=Strng+" No"
 Else
    Strng=Strng+Str$(VarR)+" items."
 Endif
 Call IO.O
 Case 17
 If TempX Then
    Strng=RT$(448,"[P]")
 Endif
 Strng=Strng+"Is loadable device: "
 If TreasureRecord.Loadable Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(465,"[10]")
 Endif
 Strng=Strng+"ANSI Prefix code: "
 If Rtrim$(TreasureRecord.Prefix1)=Nul Then
    Strng=Strng+"<none>"
 Else
    Strng=Strng+Rtrim$(TreasureRecord.Prefix1)
 Endif
 Call IO.O
 Case 18
 If TempX Then
    Strng=RT$(449,"[R]")
 Endif
 Strng=Strng+"Launchs from device: "
 If TreasureRecord.LaunchAmmo Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 If TempX Then
    Strng=Strng+RT$(686,"[11]")
 Endif
 Strng=Strng+"Persistent:"
 If TreasureRecord.Persistent=0 Then
    Strng=Strng+" No"
 Else
    Strng=Strng+" Yes:"+Str$(Treasurerecord.PersistTime)
    Strng=Strng+"/"+Ltrim$(Str$(TreasureRecord.DischargePersist))
    Strng=Strng+"/"+Ltrim$(Str$(TreasureRecord.MaxPersistCharges))
 Endif
 Call IO.O
 Case 19
 If TempX Then
    Strng=RT$(450,"[S]")
 Endif
 Strng=Strng+"Is launchable device: "
 If TreasureRecord.Launchable Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 20
 If TempX Then
    Strng=RT$(451,"[T]")
 Endif
 Strng=Strng+"Device can be moved: "
 If TreasureRecord.Movable Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 End Select
ErrExit110:
 Exit Sub
ErrResume110:
 Resume ErrExit110
End Sub

Sub Print.Item(Var)
 On Local Error Goto ErrResume110a
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="Treasure number"+Str$(Temp5!)+":"
 Print #TempFile1,Strng
 Graphics.Off=True
 Case 2
 Strng=Nul
 Strng=Strng+"Treasure name: "+TreasureRecord.TreasureName
 If Rtrim$(TreasureRecord.ProperName)<>"" Then
    Strng=Strng+": "+Rtrim$(TreasureRecord.ProperName)
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Treasure is coins: "
 If TreasureRecord.Coin Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 3
 Strng=Nul
 Strng=Strng+"Treasure identifier: "+Lcase$(TreasureRecord.ShortName)
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Treasure is a potion: "
 If TreasureRecord.Potion Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 If TreasureRecord.Liquid Then
    Strng=Strng+" (liquid)"
 Endif
 Print #TempFile1,Strng
 Case 4
 Strng=Nul
 Strng=Strng+"Weight: "+Form$(Cdbl(TreasureRecord.Weight))
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Treasure is a scroll: "
 If TreasureRecord.Scroll Then
    Strng=Strng+"Yes"
    If TreasureRecord.Scroll=1 Then
       Strng=Strng+"/Write"
    Endif
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 5
 Strng=Nul
 Call Amount(TreasureRecord.Gold,Var$)
 Strng=Strng+"Gold coin value:"+Var$
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Treasure is invisible: "
 If TreasureRecord.Invisible Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 6
 Strng=Nul
 Strng=Strng+"Treasure type: "
 VarQ=TreasureRecord.WeaponNumber
 If VarQ>=1 And VarQ<=10 Then
    Var$=Rtrim$(InventoryNames(VarQ))
    Select Case VarQ
    Case 2, 6
       Var$=Var$+"s"
    Case 4
       Var$=Var$+"(left)"
       If TreasureRecord.BindType Then
          Var$=Var$+"(binds)"
       Endif
    Case 9
       Var$=Var$+"(right)"
       If TreasureRecord.BindType Then
          Var$=Var$+"(binds)"
       Endif
    Case 7
       If TreasureRecord.TwoHanded Then
          Var$=Var$+"(two-handed)"
       Endif
    End Select
 Else
    If TreasureRecord.Container Then
       Var$="Container"
    Else
       If TreasureRecord.Spell Then
          Var$="Magical"
       Else
          If TreasureRecord.Vehicle Then
             Var$="Vehicle"
          Else
             Var$="Treasure"
          Endif
       Endif
    Endif
 Endif
 If Len(Var$) Then
    Mid$(Var$,1,1)=Ucase$(Mid$(Var$,1,1))
    Strng=Strng+Var$
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Treasure key number: "
 If TreasureRecord.MasterKey Then
    Strng=Strng+"<master>"
 Else
    If TreasureRecord.KeyNumber>SFalse Then
       Strng=Strng+"(#"+Right$(Str$(TreasureRecord.KeyNumber+1000000!),6)+")"
    Else
       Strng=Strng+"No"
    Endif
 Endif
 Print #TempFile1,Strng
 Case 7
 Strng=Nul
 Strng=Strng+"Hit plus: "+Form$(Cdbl(Abs(TreasureRecord.Plus)))
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Treasure is fuel: "
 If TreasureRecord.FuelType=False Then
    Strng=Strng+"No"
 Else
    Strng=Strng+"Yes:"+Str$(TreasureRecord.FuelCharges)+" charges"
 Endif
 Print #TempFile1,Strng
 Case 8
 Strng=Nul
 If TreasureRecord.Charges=True Then
    If TreasureRecord.Vehicle Then
       Strng=Strng+"Charges: <safe>"
    Else
       Strng=Strng+"Charges: <bad range>"
    Endif
 Else
    Strng=Strng+"Charges: "+Form$(Cdbl(TreasureRecord.Charges))
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Weapon rusts: "
 If TreasureRecord.Rustable Then
    Strng=Strng+"Yes:"+Str$(TreasureRecord.RustPercent)+"%"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 9
 Strng=Nul
 Strng=Strng+"Weapon class: "
 Select Case TreasureRecord.Proficiency
 Case Blunt
    Strng=Strng+"Blunt"
 Case Pole
    Strng=Strng+"Pole"
 Case Sharp
    Strng=Strng+"Sharp"
 Case Thrusting
    Strng=Strng+"Thrusting"
 Case Else
    Strng=Strng+"None"
 End Select
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Weapon is stealable: "
 If TreasureRecord.Stealable Then
    Strng=Strng+"Yes:"+Str$(TreasureRecord.StealPercent)+"%"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 10
 Strng=Nul
 Strng=Strng+"Treasure is permanent: "
 If TreasureRecord.Permanent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Container disappears: "
 If TreasureRecord.Container Then
    If TreasureRecord.ContainerDisappears Then
       Strng=Strng+"Yes:"+Str$(TreasureRecord.ContainerDisappears)
    Else
       If TreasureRecord.ContainerSelfImplodes Then
          Strng=Strng+"Yes: Implodes
       Else
          Strng=Strng+"No"
       Endif
    Endif
 Else
    Strng=Strng+"<n/a>"
 Endif
 Print #TempFile1,Strng
 Case 11
 Strng=Nul
 Strng=Strng+"Treasure is edible: "
 If TreasureRecord.Edible Then
    Strng=Strng+"Yes"

    Strng2=Nul
    If (TreasureRecord.Edible And 2)=2 Then
       Strng2=Strng2+" /s" ' slips
    Endif
    If (TreasureRecord.Edible And 4)=4 Then
       Strng2=Strng2+" /o" ' smokable
    Endif
    If (TreasureRecord.Edible And 8)=8 Then
       Strng2=Strng2+" /b" ' burnable
    Endif
    If Len(Strng2) Then
       Strng=Strng+":"+Strng2
    Endif
 Else
    Strng=Strng+"No"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Container is locked: "
 If TreasureRecord.Container Then
    If TreasureRecord.Locked Then
       Strng=Strng+"Yes"
    Else
       Strng=Strng+"No"
    Endif
 Else
    Strng=Strng+"<n/a>"
 Endif
 If TreasureRecord.TrapType Then
    Strng=Strng+" (trapped)"
 Endif
 Print #TempFile1,Strng
 Case 12
 Strng=Nul
 Strng=Strng+"Treasure is magical: "
 Var1!=TreasureRecord.Spell
 If Var1!=SFalse Then
    Strng=Strng+"No"
 Else
    If Var1!>SFalse And Var1!<=Lof(SpellFile)/SpellRecLen Then
       Call Read.Record(SpellFile,Var1!)
       Strng=Strng+Rtrim$(SpellRecord.SpellName)
    Endif
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Container maximum:"
 If TreasureRecord.ContainerMax=True Then
    Strng=Strng+" <unlimited>"
 Else
    If TreasureRecord.ContainerMax Then
       Strng=Strng+Str$(TreasureRecord.ContainerMax)
    Else
       Strng=Strng+" <n/a>"
    Endif
 Endif
 Print #TempFile1,Strng
 Case 13
 Strng=Nul
 Strng=Strng+"Ring protection: "
 Select Case TreasureRecord.RingType
 Case 0
    Strng=Strng+"None"
 Case 1
    Strng=Strng+"Poison"
 Case 2
    Strng=Strng+"Level drain"
 Case 3
    Var1!=TreasureRecord.RingSpell
    If Var1!=STrue Then
       Strng=Strng+"Any spell"
    Else
       If Var1!>SFalse And Var1!<=Lof(SpellFile)/SpellRecLen Then
          Call Read.Record(SpellFile,Var1!)
          Strng=Strng+Rtrim$(Lcase$(SpellRecord.SpellName))
       Endif
    Endif
 Case 4
    Strng=Strng+"Traps"
 Case 5
    Strng=Strng+"Rusting"
 Case 6
    Strng=Strng+"Stealing"
 Case 7
    Strng=Strng+"Inventory Damage"
 Case 8
    Strng=Strng+"Fumbling"
 Case 9
    Strng=Strng+"Teleporting"
 Case Else
    Strng=Strng+"None"
 End Select
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Container prefix: "
 If TreasureRecord.Container Then
    Strng=Strng+Rtrim$(TreasureRecord.ContainerPrefix)
 Else
    Strng=Strng+"<n/a>"
 Endif
 Strng=Left$(Strng,79)
 Print #TempFile1,Strng
 Case 14
 Strng=Nul
 Strng=Strng+"Treasure is a light:"
 If TreasureRecord.LightType=False Then
    Strng=Strng+" No"
 Else
    Strng=Strng+Str$(TreasureRecord.LightCharges)+" charges"
 Endif
 Strng=Left$(Strng,40)
 Strng=Strng+Space$(40-Len(Strng))
 Strng=Strng+"Container size: "
 If TreasureRecord.Container Then
    Select Case TreasureRecord.ContainerSize
    Case 1
       Strng=Strng+"Small/"
    Case 2
       Strng=Strng+"Medium/"
    Case 3
       Strng=Strng+"Large/"
    Case Else
       Strng=Strng+"Any/"
    End Select
    Select Case TreasureRecord.ContainerMaterial
    Case -1
       Strng=Strng+"Burnable"
    Case 1
       Strng=Strng+"Glass"
    Case 2
       Strng=Strng+"Wood"
    Case 3
       Strng=Strng+"Metal"
    Case Else
       Strng=Strng+"Paper"
    End Select
 Else
    Strng=Strng+"<n/a>"
 Endif
 Print #TempFile1,Strng
 Case 15
 Strng=Nul
 Strng=Strng+"Treasure is a vehicle: "
 If TreasureRecord.Vehicle=False Then
    Strng=Strng+"No"
 Else
    Strng=Strng+"Yes: "
    Select Case TreasureRecord.VehicleType
    Case Air
       Strng=Strng+"air"
    Case Land
       Strng=Strng+"land"
    Case Water
       Strng=Strng+"water"
    Case AllTerrain
       Strng=Strng+"all terrain"
    End Select
 Endif
 Print #TempFile1,Strng
 Case 16
 Strng=Nul
 Strng=Strng+"Loads from device: "
 If TreasureRecord.Ammunition Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 17
 Strng=Nul
 Strng=Strng+"Is loadable device: "
 If TreasureRecord.Loadable Then
    Strng=Strng+"Yes: Loads("
    Var2!=TreasureRecord.AmmoLoads
    If Var2!>SFalse And Var2!<=Lof(TreasureFile)/TreasureRecLen Then
       Call Write.Record(TreasureFile,Temp5!)
       Call Read.Record(TreasureFile,Var2!)
       Strng=Strng+Rtrim$(TreasureRecord.TreasureName)+")"
       Call Read.Record(TreasureFile,Temp5!)
    Else
       Strng=Strng+"<none>)"
    Endif
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 18
 Strng=Nul
 Strng=Strng+"Launchs from device: "
 If TreasureRecord.LaunchAmmo Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 19
 Strng=Nul
 Strng=Strng+"Is launchable device: "
 If TreasureRecord.Launchable Then
    Strng=Strng+"Yes: Launchs("
    Var2!=TreasureRecord.LaunchLoads
    If Var2!>SFalse And Var2!<=Lof(TreasureFile)/TreasureRecLen Then
       Call Write.Record(TreasureFile,Temp5!)
       Call Read.Record(TreasureFile,Var2!)
       Strng=Strng+Rtrim$(TreasureRecord.TreasureName)+")"
       Call Read.Record(TreasureFile,Temp5!)
    Else
       Strng=Strng+"<none>)"
    Endif
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 20
 Strng=Nul
 Strng=Strng+"Launchable device can be moved: "
 If TreasureRecord.Movable Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 End Select
ErrExit110a:
 Exit Sub
ErrResume110a:
 Resume ErrExit110a
End Sub

Sub Change.Treasure
 On Local Error Goto ErrResume148
 Call Read.Record(TreasureFile,Temp5!)
 Do While Lost.Carrier=False
    Allow.Break=True
    Break=False
    For VarQ=1 To 20
       Call Display.Treasure(True,VarQ)
       If Break Then
          Exit For
       Endif
    Next
    Allow.Break=False
    Break=False
    Graphics.Off=False
    Strng="Treasure change option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(433,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure name(30 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Line.Length=30
          Call IO.I
          Out2=Lcase$(Out2)
          If Out2<>Nul Then
             TreasureRecord.TreasureName=Out2
          Endif
          Strng="Treasure propername(20 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Line.Length=20
          Call IO.I
          Out2=Lcase$(Out2)
          TreasureRecord.ProperName=Out2
       Endif
    Case "B"
       If RT$(434,"[B]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure identifier(30 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Line.Length=30
          Call IO.I
          Out2=Ucase$(Out2)
          If Out2<>Nul Then
             TreasureRecord.ShortName=Out2
          Endif
       Endif
    Case "C"
       If RT$(435,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Weight(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          VarX=Int(Val(Out2))
          If VarX>=0 And VarX<=32767 Then
             TreasureRecord.Weight=VarX
          Endif
       Endif
    Case "D"
       If RT$(436,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Gold value? "
          No.Input.Out="1"
          Call IO.I
          TreasureRecord.Gold=Int(Val(Out2))
       Endif
    Case "E"
       If RT$(437,"[E]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(466,"[1]")+"Container"
             Call IO.O
             Strng=RT$(467,"[A]")+"rmor"
             Call IO.O
             Strng=RT$(468,"[B]")+"oots"
             Call IO.O
             Strng=RT$(469,"[C]")+"loak"
             Call IO.O
             Strng=RT$(470,"[H]")+"elmet"
             Call IO.O
             Strng=RT$(471,"[R]")+"ing"
             Call IO.O
             Strng=RT$(472,"[S]")+"hield"
             Call IO.O
             Strng=RT$(473,"[T]")+"Bracers"
             Call IO.O
             Strng=RT$(474,"[U]")+"Amulet"
             Call IO.O
             Strng=RT$(475,"[W]")+"eapon"
             Call IO.O
             Strng=RT$(476,"[X]")+"None"
             Call IO.O
             Graphics.Off=False
          Endif
          Strng="Treasure type option(q to quit)? "
          Line.Length=TempD
          No.Input.Out="Q"
          Call IO.I
          Out2=Ucase$(Out2)
          Select Case Out2
          Case "Q"
             Exit Do
          Case "X"
             If RT$(476,"[X]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.WeaponNumber=False
                TreasureRecord.Container=False
                TreasureRecord.ContainerMax=False
                TreasureRecord.ContainerSize=False
                TreasureRecord.ContainerMaterial=False
                TreasureRecord.TwoHanded=False
                TreasureRecord.RequireStr=False
                TreasureRecord.RequireDex=False
                TreasureRecord.RequireInt=False
             Endif
          Case "1"
             If RT$(466,"[1]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.WeaponNumber=False
                TreasureRecord.TwoHanded=False
                TreasureRecord.Container=True
                TreasureRecord.MasterKey=False
             Endif
          Case Else
             If Len(Out2)=1 Then
                Var=Instr("ABHRSTWCU",Out2)
                If Var Then
                   Var2=Instr("ABCHRSTUW",Out2)
                   If RT$(466+Var2,"[?]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      If Var=9 Then
                         Var=10
                      Endif
                      TreasureRecord.Container=False
                      TreasureRecord.ContainerMax=False
                      TreasureRecord.ContainerSize=False
                      TreasureRecord.ContainerMaterial=False
                      TreasureRecord.WeaponNumber=Var
                      TreasureRecord.TwoHanded=False
                      If Var=4 Then
                         Line.Length=TempD
                         No.Input.Out="L"
                         Strng="Ring type (L)eft, (R)ight handed? "
                         Call IO.I
                         Out2=Ucase$(Out2)
                         If Out2="R" Then
                            TreasureRecord.WeaponNumber=9
                         Endif
                         Line.Length=TempD
                         No.Input.Out="N"
                         Strng="Ring binds protection with cast spell(y/n)? "
                         Call IO.I
                         TreasureRecord.BindType=Yes
                      Endif
                      If Var=7 Then
                         Graphics.Off=True
                         Do While Lost.Carrier=False
                            Graphics.Off=True
                            If TempC=False Then
                               Strng=" (1)Two-handed: "
                               If TreasureRecord.TwoHanded Then
                                  Strng=Strng+"Yes"
                               Else
                                  Strng=Strng+"No"
                               Endif
                               Call IO.O
                               Strng=" (2)Required strength:"
                               Strng=Strng+Str$(TreasureRecord.RequireStr)
                               Call IO.O
                               Strng=" (3)Required dexterity:"
                               Strng=Strng+Str$(TreasureRecord.RequireDex)
                               Call IO.O
                               Strng=" (4)Required intelligence:"
                               Strng=Strng+Str$(TreasureRecord.RequireInt)
                               Call IO.O
                               Strng=" (5)Exit"
                               Call IO.O
                               Graphics.Off=False
                            Endif
                            Strng="Weapon type option(1-5)? "
                            Line.Length=TempD
                            No.Input.Out="5"
                            Call IO.I
                            VarQ=Int(Val(Out2))
                            Select Case VarQ
                            Case 1
                               Strng="Two-Handed weapon(y/n)? "
                               Line.Length=TempD
                               No.Input.Out="N"
                               Call IO.I
                               If Yes Then
                                  TreasureRecord.TwoHanded=True
                               Else
                                  TreasureRecord.TwoHanded=False
                               Endif
                            Case 2
                               Strng="Requires minimum strength(0-32767)? "
                               Call IO.I
                               VarX=Int(Val(Out2))
                               If VarX>=0 And VarX<=32767 Then
                                  TreasureRecord.RequireStr=VarX
                               Endif
                            Case 3
                               Strng="Requires minimum dexterity(0-32767)? "
                               Call IO.I
                               VarX=Int(Val(Out2))
                               If VarX>=0 And VarX<=32767 Then
                                  TreasureRecord.RequireDex=VarX
                               Endif
                            Case 4
                               Strng="Requires minimum intelligence(0-32767)? "
                               Call IO.I
                               VarX=Int(Val(Out2))
                               If VarX>=0 And VarX<=32767 Then
                                  TreasureRecord.RequireInt=VarX
                               Endif
                            Case 5
                               Exit Do
                            End Select
                         Loop
                      Endif
                   Endif
                Endif
             Endif
          End Select
       Loop
       Endif
    Case "F"
       If RT$(438,"[F]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Hit plus(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          VarX=Int(Val(Out2))
          If VarX>=0 And VarX<=32767 Then
             TreasureRecord.Plus=VarX
          Endif
       Endif
    Case "G"
       If RT$(439,"[G]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Charges(0-32767,-1=safe vehicle)? "
          No.Input.Out="1"
          Call IO.I
          VarX=Int(Val(Out2))
          If VarX=-1 Then
             TreasureRecord.Charges=-1
          Else
             If VarX>=0 And VarX<=32767 Then
                TreasureRecord.Charges=VarX
             Endif
          Endif
       Endif
    Case "H"
       If RT$(440,"[H]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(477,"[B]")+"lunt"
             Call IO.O
             Strng=RT$(478,"[P]")+"ole"
             Call IO.O
             Strng=RT$(479,"[S]")+"harp"
             Call IO.O
             Strng=RT$(480,"[T]")+"hrusting"
             Call IO.O
             Strng=RT$(481,"[N]")+"one"
             Call IO.O
             Graphics.Off=False
          Endif
          Strng="Treasure weapon class option(q to quit)? "
          Line.Length=TempD
          No.Input.Out="Q"
          Call IO.I
          Select Case Ucase$(Out2)
          Case "B"
             If RT$(477,"[B]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.Proficiency=1
             Endif
          Case "P"
             If RT$(478,"[P]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.Proficiency=2
             Endif
          Case "S"
             If RT$(479,"[S]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.Proficiency=3
             Endif
          Case "T"
             If RT$(480,"[T]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.Proficiency=4
             Endif
          Case "N"
             If RT$(481,"[N]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.Proficiency=False
             Endif
          Case "Q"
             Exit Do
          End Select
       Loop
       Endif
    Case "I"
       If RT$(441,"[I]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is permanent(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          TreasureRecord.Permanent=Yes
          Strng="Treasure stays in room(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          TreasureRecord.StaysInRoom=Yes
       Endif
    Case "J"
       If RT$(433,"[J]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             If TempC=False Then
                Graphics.Off=False
                Strng="Enter edible type:"
                Call IO.O
                Graphics.Off=True
                Strng=" (1)Edible: "
                If TreasureRecord.Edible And 1 Then
                   Strng=Strng+"Yes"
                Else
                   Strng=Strng+"No"
                Endif
                Call IO.O
                Strng=" (2)Slips on: "
                If TreasureRecord.Edible And 2 Then
                   Strng=Strng+"Yes"
                Else
                   Strng=Strng+"No"
                Endif
                Call IO.O
                Strng=" (3)Smokable: "
                If TreasureRecord.Edible And 4 Then
                   Strng=Strng+"Yes"
                Else
                   Strng=Strng+"No"
                Endif
                Call IO.O
                Strng=" (4)Burnable: "
                If TreasureRecord.Edible And 8 Then
                   Strng=Strng+"Yes"
                Else
                   Strng=Strng+"No"
                Endif
                Call IO.O
                Strng=" (5)exit"
                Call IO.O
             Endif
             Graphics.Off=False
             Line.Length=TempD
             No.Input.Out="5"
             Strng="Enter edible option(1-5)? "
             Call IO.I
             VarQ=Int(Val(Out2))
             Select Case VarQ
             Case 1
                Strng="Treasure is edible(y/n)? "
                Line.Length=TempD
                No.Input.Out="N"
                Call IO.I
                If Yes Then
                   TreasureRecord.Edible=TreasureRecord.Edible Or 1
                Endif
                If No Then
                   TreasureRecord.Edible=TreasureRecord.Edible And Not 1
                Endif
             Case 2
                Strng="Edible item slips on(y/n)? "
                Line.Length=TempD
                No.Input.Out="N"
                Call IO.I
                If Yes Then
                   TreasureRecord.Edible=TreasureRecord.Edible Or 2
                Endif
                If No Then
                   TreasureRecord.Edible=TreasureRecord.Edible And Not 2
                Endif
             Case 3
                Strng="Item is smokable(y/n)? "
                Line.Length=TempD
                No.Input.Out="N"
                Call IO.I
                If Yes Then
                   TreasureRecord.Edible=TreasureRecord.Edible Or 4
                Endif
                If No Then
                   TreasureRecord.Edible=TreasureRecord.Edible And Not 4
                Endif
             Case 4
                Strng="Item is burnable(y/n)? "
                Line.Length=TempD
                No.Input.Out="N"
                Call IO.I
                If Yes Then
                   TreasureRecord.Edible=TreasureRecord.Edible Or 8
                Endif
                If No Then
                   TreasureRecord.Edible=TreasureRecord.Edible And Not 8
                Endif
             Case 5
                Exit Do
             End Select
          Loop
       Endif
    Case "K"
       If RT$(443,"[K]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is magical(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Spell=SFalse
          If Yes Then
             Call Find.Spell(-1)
             If TempD! Then
                TreasureRecord.Spell=TempD!
             Endif
          Endif
       Endif
    Case "L"
       If RT$(444,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is ring(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.RingType=False
          TreasureRecord.RingSpell=False
          If Yes Then
             Do While Lost.Carrier=False
                Graphics.Off=True
                If TempC=False Then
                   Strng="Protection against:"
                   Call IO.O
                   Strng=RT$(482,"[A]")+"ny spell" ' 3
                   Call IO.O
                   Strng=RT$(483,"[F]")+"umbling" ' 8
                   Call IO.O
                   Strng=RT$(484,"[I]")+"nventory damage" ' 7
                   Call IO.O
                   Strng=RT$(485,"[L]")+"evel drain" ' 2
                   Call IO.O
                   Strng=RT$(486,"[O]")+"ffense/invisible spell" ' 3
                   Call IO.O
                   Strng=RT$(487,"[P]")+"oison" ' 1
                   Call IO.O
                   Strng=RT$(488,"[R]")+"usting" ' 5
                   Call IO.O
                   Strng=RT$(489,"[S]")+"tealing" ' 6
                   Call IO.O
                   Strng=RT$(490,"[T]")+"eleporting" ' 9
                   Call IO.O
                   Strng=RT$(491,"[X]")+"All traps" ' 4
                   Call IO.O
                   Graphics.Off=False
                Endif
                Strng="Treasure ring option(q to quit)? "
                Line.Length=TempD
                No.Input.Out="Q"
                Call IO.I
                Select Case Ucase$(Out2)
                Case "A"
                   If RT$(482,"[A]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=3
                   Endif
                Case "F"
                   If RT$(483,"[F]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=8
                   Endif
                Case "I"
                   If RT$(484,"[I]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=7
                   Endif
                Case "O"
                   If RT$(486,"[O]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Call Find.Spell(-1)
                      If TempD! Then
                         If SpellRecord.SpellType=Offense Then
                            TreasureRecord.RingSpell=TempD!
                            TreasureRecord.RingType=3
                         Else
                            If SpellRecord.SpellType=Invisibly Then
                               TreasureRecord.RingSpell=TempD!
                               TreasureRecord.RingType=3
                            Else
                               Strng="Spell is not an offense/invisible type."
                               Call IO.O
                            Endif
                         Endif
                      Endif
                   Endif
                Case "L"
                   If RT$(485,"[L]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=False
                      TreasureRecord.RingType=2
                   Endif
                Case "P"
                   If RT$(487,"[P]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=False
                      TreasureRecord.RingType=1
                   Endif
                Case "R"
                   If RT$(488,"[R]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=5
                   Endif
                Case "S"
                   If RT$(489,"[S]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=6
                   Endif
                Case "T"
                   If RT$(490,"[T]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=9
                   Endif
                Case "X"
                   If RT$(491,"[X]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      TreasureRecord.RingSpell=True
                      TreasureRecord.RingType=4
                   Endif
                Case "Q"
                   Exit Do
                End Select
             Loop
          Endif
       Endif
    Case "M"
       If RT$(445,"[M]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is a light(y/n)? "
          No.Input.Out="Y"
          Line.Length=TempD
          Call IO.I
          TreasureRecord.LightType=False
          TreasureRecord.LightCharges=False
          If Yes Then
             Strng="Light charges(1-32767)? "
             Call IO.I
             VarX=Int(Val(Out2))
             If VarX>=1 And VarX<=32767 Then
                TreasureRecord.LightType=True
                TreasureRecord.LightCharges=Int(Val(Out2))
             Endif
          Endif
       Endif
    Case "N"
       If RT$(446,"[N]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Strng="Treasure is a vehicle(y/n)? "
       No.Input.Out="Y"
       Line.Length=TempD
       Call IO.I
       TreasureRecord.Vehicle=False
       TreasureRecord.VehicleType=False
       If Yes Then
          TreasureRecord.Vehicle=True
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(492,"[A]")+"ir terrain"
             Call IO.O
             Strng=RT$(493,"[L]")+"and terrain"
             Call IO.O
             Strng=RT$(494,"[W]")+"ater terrain"
             Call IO.O
             Strng=RT$(495,"[X]")+"all terrain"
             Call IO.O
          Endif
          Graphics.Off=False
          No.Input.Out="X"
          Line.Length=TempD
          Strng="Enter vehicle terrain type(A/L/W/X)? "
          Call IO.I
          Select Case Ucase$(Out2)
          Case "A"
             If RT$(492,"[A]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.VehicleType=Air
             Endif
          Case "L"
             If RT$(493,"[L]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.VehicleType=Land
             Endif
          Case "W"
             If RT$(494,"[W]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.VehicleType=Water
             Endif
          Case "X"
             If RT$(495,"[X]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.VehicleType=AllTerrain
             Endif
          End Select
          No.Input.Out="0"
          Line.Length=TempD
          Strng="Enter max. vehicle occupants(0-"+Mid$(Str$(MaxOccupants),2)+")? "
          Call IO.I
          Var=Int(Val(Out2))
          If Var>=0 And Var<=MaxOccupants Then
             TreasureRecord.Occupants=Var
          Else
             TreasureRecord.Occupants=False
          Endif
       Endif
       Endif
    Case "O"
       If RT$(447,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Ammunition(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Ammunition=Yes
       Endif
    Case "P"
       If RT$(448,"[P]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is a loadable device(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Loadable=False
          TreasureRecord.AmmoLoads=SFalse
          If Yes Then
             Call Write.Record(TreasureFile,Temp5!)
             Strng="Treasure which loads this device?"
             Call IO.O
             Call Find.Treasure
             If TempC!=SFalse Then
                Call Read.Record(TreasureFile,Temp5!)
                TreasureRecord.Loadable=False
                TreasureRecord.AmmoLoads=SFalse
             Else
                Call Read.Record(TreasureFile,TempC!)
                If TreasureRecord.Ammunition=False Then
                   Call Read.Record(TreasureFile,Temp5!)
                   Strng="That treasure is not ammunition."
                   Call IO.O
                   TreasureRecord.Loadable=False
                   TreasureRecord.AmmoLoads=SFalse
                Else
                   Call Read.Record(TreasureFile,Temp5!)
                   TreasureRecord.Loadable=True
                   TreasureRecord.AmmoLoads=TempC!
                Endif
             Endif
             Call Write.Record(TreasureFile,Temp5!)
          Endif
       Endif
    Case "R"
       If RT$(449,"[R]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure launchs from devices(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.LaunchAmmo=Yes
       Endif
    Case "S"
       If RT$(450,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is a launchable device(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Launchable=False
          TreasureRecord.LaunchLoads=SFalse
          If Yes Then
             Call Write.Record(TreasureFile,Temp5!)
             Strng="Treasure which launchs from this device?"
             Call IO.O
             Call Find.Treasure
             If TempC!=SFalse Then
                Call Read.Record(TreasureFile,Temp5!)
                TreasureRecord.Launchable=False
                TreasureRecord.LaunchLoads=SFalse
             Else
                Call Read.Record(TreasureFile,TempC!)
                If TreasureRecord.LaunchAmmo=False Then
                   Call Read.Record(TreasureFile,Temp5!)
                   Strng="That treasure does not launch from devices."
                   Call IO.O
                   TreasureRecord.Launchable=False
                   TreasureRecord.LaunchLoads=SFalse
                Else
                   Call Read.Record(TreasureFile,Temp5!)
                   TreasureRecord.Launchable=True
                   TreasureRecord.LaunchLoads=TempC!
                Endif
             Endif
             Call Write.Record(TreasureFile,Temp5!)
          Endif
       Endif
    Case "T"
       If RT$(451,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Launchable device can be moved(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Movable=Yes
       Endif
    Case "U"
       If RT$(452,"[U]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is coins(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Coin=Yes
       Endif
    Case "V"
       If RT$(453,"[V]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             If TempC=False Then
                Graphics.Off=False
                Strng="Potion type menu:"
                Call IO.O
                Graphics.Off=True
                Strng=" (1)Potion:"
                If TreasureRecord.Potion Then
                   Strng=Strng+" Yes"
                   If TreasureRecord.Liquid Then
                      Strng=Strng+": (liquid)"
                      Select Case TreasureRecord.LiquidType
                      Case 1
                         Strng=Strng+" <sip>"
                      Case 2
                         Strng=Strng+" <gulp>"
                      Case 3
                         Strng=Strng+" <guzzle>"
                      End Select
                   Endif
                Else
                   Strng=Strng+" No"
                Endif
                Call IO.O
                Strng=" (2)Potion Pour:"
                If TreasureRecord.PotionType Then
                   Strng=Strng+" Yes:"
                   Call Write.Record(TreasureFile,Temp5!)
                   VarQ!=TreasureRecord.PotionType
                   If VarQ!>0! And VarQ!<=Lof(TreasureFile)/TreasureRecLen Then
                      Call Read.Record(TreasureFile,VarQ!)
                      Strng=Strng+" "+Rtrim$(TreasureRecord.TreasureName)
                   Else
                      Strng=Strng+" <none>"
                   Endif
                   Call Read.Record(TreasureFile,Temp5!)
                Else
                   Strng=Strng+" No"
                Endif
                Call IO.O
                Strng=" (3)Potion Mix:"
                If TreasureRecord.MixPotion Then
                   Strng=Strng+" Yes"
                Else
                   Strng=Strng+" No"
                Endif
                Call IO.O
                Strng=" (4)New Potion:"
                If TreasureRecord.NewPotion Then
                   Strng=Strng+" Yes:"
                   Call Write.Record(TreasureFile,Temp5!)
                   VarQ!=TreasureRecord.NewPotion
                   If VarQ!>0! And VarQ!<=Lof(TreasureFile)/TreasureRecLen Then
                      Call Read.Record(TreasureFile,VarQ!)
                      Strng=Strng+" "+Rtrim$(TreasureRecord.TreasureName)
                   Else
                      Strng=Strng+" <none>"
                   Endif
                   Call Read.Record(TreasureFile,Temp5!)
                Else
                   Strng=Strng+" No"
                Endif
                Call IO.O
                Strng=" (5)exit"
                Call IO.O
             Endif
             Graphics.Off=False
             Line.Length=TempD
             No.Input.Out="5"
             Strng="Potion edit type(1-5)? "
             Call IO.I
             Select Case Int(Val(Out2))
             Case 1
                Strng="Treasure is potion(y/n)? "
                Line.Length=TempD
                No.Input.Out="Y"
                Call IO.I
                If No Then
                   TreasureRecord.Potion=0
                   TreasureRecord.Liquid=0
                Endif
                TreasureRecord.Potion=Yes
                If Yes Then
                   Strng="Treasure is a liquid(y/n)? "
                   Line.Length=TempD
                   No.Input.Out="N"
                   Call IO.I
                   TreasureRecord.Liquid=Yes
                   If Yes Then
                      Do While Lost.Carrier=False
                         If TempC=False Then
                            Graphics.Off=False
                            Strng="Drinking type menu:"
                            Select Case TreasureRecord.LiquidType
                            Case 1
                               Strng=Strng+" (sip)"
                            Case 2
                               Strng=Strng+" (gulp)"
                            Case 3
                               Strng=Strng+" (guzzle)"
                            End Select
                            Call IO.O
                            Graphics.Off=True
                            Strng=" <0>none"
                            Call IO.O
                            Strng=" <1>sip"
                            Call IO.O
                            Strng=" <2>gulp"
                            Call IO.O
                            Strng=" <3>guzzle"
                            Call IO.O
                            Strng=" <4>exit"
                            Call IO.O
                         Endif
                         Graphics.Off=False
                         Line.Length=TempD
                         No.Input.Out="4"
                         Strng="Enter drink option(0-4)? "
                         Call IO.I
                         Var=Int(Val(Out2))
                         Select Case Var
                         Case 0, 1, 2, 3
                            TreasureRecord.LiquidType=Var
                         Case 4
                            Exit Do
                         End Select
                      Loop
                   Endif
                Endif
             Case 2
                Strng="Potion can be poured into another(y/n)? "
                Line.Length=TempD
                No.Input.Out="Y"
                Call IO.I
                TreasureRecord.PotionType=SFalse
                If Yes Then
                   Call Write.Record(TreasureFile,Temp5!)
                   Strng="Potion name to pour into?"
                   Call IO.O
                   Call Find.Treasure
                   If TempC!=SFalse Then
                      Call Read.Record(TreasureFile,Temp5!)
                      TreasureRecord.PotionType=SFalse
                   Else
                      Call Read.Record(TreasureFile,TempC!)
                      If TreasureRecord.Potion=False Then
                         Call Read.Record(TreasureFile,Temp5!)
                         Strng="That treasure is not a potion."
                         Call IO.O
                         TreasureRecord.PotionType=SFalse
                      Else
                         Call Read.Record(TreasureFile,Temp5!)
                         TreasureRecord.PotionType=TempC!
                      Endif
                   Endif
                   Call Write.Record(TreasureFile,Temp5!)
                Endif
             Case 3
                Strng="Potion can be mixed(y/n)? "
                Line.Length=TempD
                No.Input.Out="Y"
                Call IO.I
                TreasureRecord.MixPotion=Yes
             Case 4
                Strng="Potion becomes another(y/n)? "
                Line.Length=TempD
                No.Input.Out="Y"
                Call IO.I
                TreasureRecord.NewPotion=False
                If Yes Then
                   Call Write.Record(TreasureFile,Temp5!)
                   Strng="New potion name?"
                   Call IO.O
                   Call Find.Treasure
                   If TempC!=SFalse Then
                      Call Read.Record(TreasureFile,Temp5!)
                      TreasureRecord.NewPotion=SFalse
                   Else
                      Call Read.Record(TreasureFile,TempC!)
                      If TreasureRecord.Potion=False Then
                         Call Read.Record(TreasureFile,Temp5!)
                         Strng="That treasure is not a potion."
                         Call IO.O
                         TreasureRecord.NewPotion=SFalse
                      Else
                         Call Read.Record(TreasureFile,Temp5!)
                         TreasureRecord.NewPotion=TempC!
                      Endif
                   Endif
                Endif
                Call Write.Record(TreasureFile,Temp5!)
             Case 5
                Exit Do
             End Select
          Loop
       Endif
    Case "W"
       If RT$(454,"[W]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is scroll(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Scroll=Yes
          If Yes Then
             Strng="Treasure can be written on(y/n)? "
             Line.Length=TempD
             No.Input.Out="Y"
             Call IO.I
             If Yes Then
                TreasureRecord.Scroll=1
             Endif
          Endif
       Endif
    Case "X"
       If RT$(455,"[X]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is invisible(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Invisible=Yes
       Endif
    Case "Y"
       If RT$(456,"[Y]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          VarX=0
          If TreasureRecord.Container=False Then
             Strng="Item is a master key(y/n)? "
             Line.Length=TempD
             No.Input.Out="N"
             Call IO.I
             If Yes Then
                VarX=-1
                TreasureRecord.MasterKey=True
                TreasureRecord.KeyNumber=SFalse
             Endif
          Endif
          If VarX=0 Then
             TreasureRecord.MasterKey=False
             Strng="Key number(0,1-999999)? "
             Call IO.I
             Temp3!=Int(Val(Out2))
             If Temp3!>=SFalse And Temp3!<=999999! Then
                TreasureRecord.KeyNumber=Temp3!
             Endif
          Endif
       Endif
    Case "Z"
       If RT$(457,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure is fuel(y/n)? "
          No.Input.Out="Y"
          Line.Length=TempD
          Call IO.I
          TreasureRecord.FuelType=False
          TreasureRecord.FuelCharges=False
          If Yes Then
             Strng="Fuel charges(1-32767)? "
             Call IO.I
             VarX=Int(Val(Out2))
             If VarX>=1 And VarX<=32767 Then
                TreasureRecord.FuelType=True
                TreasureRecord.FuelCharges=Int(Val(Out2))
             Endif
          Endif
       Endif
    Case "1"
       If RT$(458,"[1]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure can rust(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Rustable=False
          TreasureRecord.RustPercent=False
          If Yes Then
             Strng="Percent chance weapon will rust during room rust rate(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp=Int(Val(Out2))
             If Temp>=1 And Temp<=100 Then
                TreasureRecord.Rustable=True
                TreasureRecord.RustPercent=Temp
             Else
                TreasureRecord.Rustable=False
                TreasureRecord.RustPercent=False
             Endif
          Endif
       Endif
    Case "2"
       If RT$(459,"[2]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Treasure can be stolen(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.Stealable=False
          TreasureRecord.StealPercent=False
          If Yes Then
             Strng="Percent chance treasure stolen during room steal rate(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp=Int(Val(Out2))
             If Temp>=1 And Temp<=100 Then
                TreasureRecord.Stealable=True
                TreasureRecord.StealPercent=Temp
             Else
                TreasureRecord.Stealable=False
                TreasureRecord.StealPercent=False
             Endif
          Endif
       Endif
    Case "3"
       If RT$(460,"[3]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Container self implodes(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          TreasureRecord.ContainerSelfImplodes=Yes
          Strng="Container disappears with another when placed in each other(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          TreasureRecord.ContainerDisappears=SFalse
          If Yes Then
             Call Write.Record(TreasureFile,Temp5!)
             Strng="Container name which disappears?"
             Call IO.O
             Call Find.Treasure
             If TempC!=SFalse Then
                Call Read.Record(TreasureFile,Temp5!)
                TreasureRecord.ContainerDisappears=SFalse
                Strng="Treasure item not found."
                Call IO.O
             Else
                Call Read.Record(TreasureFile,TempC!)
                If TreasureRecord.Container=False Then
                   Call Read.Record(TreasureFile,Temp5!)
                   TreasureRecord.ContainerDisappears=SFalse
                   Strng="Treasure item is not another container."
                   Call IO.O
                Else
                   Call Read.Record(TreasureFile,Temp5!)
                   TreasureRecord.ContainerDisappears=TempC!
                Endif
             Endif
             Call Write.Record(TreasureFile,Temp5!)
          Endif
       Endif
    Case "4"
       If RT$(461,"[4]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Container is locked(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          If Yes Then
             TreasureRecord.Locked=True
          Else
             TreasureRecord.Locked=False
          Endif
       Endif
    Case "5"
       If RT$(638,"[5]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          If TempC=False Then
             Graphics.Off=False
             Strng="Container traptype:"
             Call IO.O
             Graphics.Off=True
             Strng=RT$(639,"[P]")+"oison"
             Call IO.O
             Strng=RT$(640,"[H]")+"its"
             Call IO.O
             Strng=RT$(641,"[E]")+"xplodes"
             Call IO.O
             Strng=RT$(642,"[W]")+"eapon"
             Call IO.O
             Strng=RT$(643,"[N]")+"one"
             Call IO.O
          Endif
          Graphics.Off=False
          Line.Length=TempD
          No.Input.Out="Q"
          Strng="Enter traptype(q to quit)? "
          Call IO.I
          Select Case Ucase$(Out2)
          Case "W"
             If RT$(642,"[W]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.TrapType=4
                Call Write.Record(TreasureFile,Temp5!)
                Call Find.Treasure
                Call Read.Record(TreasureFile,Temp5!)
                TreasureRecord.TrapItem=TempC!
                Call Write.Record(TreasureFile,Temp5!)
             Endif
          Case "P"
             If RT$(639,"[P]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.TrapType=1
                TreasureRecord.TrapHits=False
             Endif
          Case "H"
             If RT$(640,"[H]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
             Do While Lost.Carrier=False
                If TempC=False Then
                   Graphics.Off=False
                   Strng="Container trap hits:"
                   Call IO.O
                   Graphics.Off=True
                   Strng=RT$(644,"[F]")+"atigue"
                   Call IO.O
                   Strng=RT$(645,"[V]")+"itality"
                   Call IO.O
                Endif
                Graphics.Off=False
                Line.Length=TempD
                No.Input.Out="Q"
                Strng="Container trap hits(q to quit)?"
                Call IO.I
                Select Case Ucase$(Out2)
                Case "F"
                   If RT$(644,"[F]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Strng="Hits of fat(1-32767)?"
                      Call IO.I
                      If Int(Val(Out2))>False And Int(Val(Out2))<=32767 Then
                         TreasureRecord.TrapType=2
                         TreasureRecord.TrapHits=Int(Val(Out2))
                      Endif
                   Endif
                Case "V"
                   If RT$(645,"[V]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Strng="Hits of vit(1-32767)?"
                      Call IO.I
                      If Int(Val(Out2))>False And Int(Val(Out2))<=32767 Then
                         TreasureRecord.TrapType=2
                         TreasureRecord.TrapHits=-Int(Val(Out2))
                      Endif
                   Endif
                Case "Q"
                   Exit Do
                End Select
             Loop
             Endif
          Case "E"
             If RT$(641,"[E]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
             Do While Lost.Carrier=False
                If TempC=False Then
                   Graphics.Off=False
                   Strng="Container trap hits:"
                   Call IO.O
                   Graphics.Off=True
                   Strng=RT$(646,"[F]")+"atigue"
                   Call IO.O
                   Strng=RT$(647,"[V]")+"itality"
                   Call IO.O
                Endif
                Graphics.Off=False
                Line.Length=TempD
                No.Input.Out="Q"
                Strng="Container trap hits(q to quit)?"
                Call IO.I
                Select Case Ucase$(Out2)
                Case "F"
                   If RT$(646,"[F]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Strng="Hits of fat(1-32767)?"
                      Call IO.I
                      If Int(Val(Out2))>False And Int(Val(Out2))<=32767 Then
                         TreasureRecord.TrapType=3
                         TreasureRecord.TrapHits=Int(Val(Out2))
                      Endif
                   Endif
                Case "V"
                   If RT$(647,"[V]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Strng="Hits of vit(1-32767)?"
                      Call IO.I
                      If Int(Val(Out2))>False And Int(Val(Out2))<=32767 Then
                         TreasureRecord.TrapType=3
                         TreasureRecord.TrapHits=-Int(Val(Out2))
                      Endif
                   Endif
                Case "Q"
                   Exit Do
                End Select
             Loop
             Endif
          Case "N"
             If RT$(643,"[N]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                TreasureRecord.TrapType=False
                TreasureRecord.TrapHits=False
                TreasureRecord.TrapItem=SFalse
             Endif
          Case "Q"
             Exit DO
          End Select
       Loop
       Endif
    Case "6"
       If RT$(462,"[6]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Max container items(1-32767/-1=unlimited)? "
          No.Input.Out="10"
          Call IO.I
          Var=Int(Val(Out2))
          If Var=-1 Then
             TreasureRecord.ContainerMax=-1
          Else
             If Var>=0 And Var<=32767 Then
                TreasureRecord.ContainerMax=Var
             Endif
          Endif
       Endif
    Case "7"
       If RT$(463,"[7]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          No.Input.Out="In it"
          Strng="Container name prefix(in it)? "
          Call IO.I
          TreasureRecord.ContainerPrefix=Lcase$(Out2)
        Endif
    Case "8"
       If RT$(464,"[8]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Graphics.Off=False
                Strng="Container size:"
                Call IO.O
                Graphics.Off=True
                Strng=RT$(597,"[0]")+"any"
                Call IO.O
                Strng=RT$(598,"[1]")+"small"
                Call IO.O
                Strng=RT$(599,"[2]")+"medium"
                Call IO.O
                Strng=RT$(600,"[3]")+"large"
                Call IO.O
             Endif
             Graphics.Off=False
             No.Input.Out="Q"
             Line.Length=TempD
             Strng="Enter container size(q to quit)? "
             Call IO.I
             Select Case Ucase$(Out2)
             Case "0"
                If RT$(597,"[0]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerSize=0
                Endif
             Case "1"
                If RT$(598,"[1]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerSize=1
                Endif
             Case "2"
                If RT$(599,"[2]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerSize=2
                Endif
             Case "3"
                If RT$(600,"[3]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerSize=3
                Endif
             Case "Q"
                Exit Do
             End Select
          Loop
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Graphics.Off=False
                Strng="Container material:"
                Call IO.O
                Graphics.Off=True
                Strng=RT$(691,"[0]")+"paper"
                Call IO.O
                Strng=RT$(692,"[1]")+"glass"
                Call IO.O
                Strng=RT$(693,"[2]")+"wood"
                Call IO.O
                Strng=RT$(694,"[3]")+"metal"
                Call IO.O
             Endif
             Graphics.Off=False
             No.Input.Out="Q"
             Line.Length=TempD
             Strng="Enter container material(q to quit)? "
             Call IO.I
             Select Case Ucase$(Out2)
             Case "0"
                If RT$(691,"[0]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Line.Length=TempD
                   No.Input.Out="N"
                   Strng="Container is burnable paper(y/n)? "
                   Call IO.I
                   TreasureRecord.ContainerMaterial=Yes
                Endif
             Case "1"
                If RT$(692,"[1]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerMaterial=1
                Endif
             Case "2"
                If RT$(693,"[2]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerMaterial=2
                Endif
             Case "3"
                If RT$(694,"[3]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   TreasureRecord.ContainerMaterial=3
                Endif
             Case "Q"
                Exit Do
             End Select
          Loop
       Endif
    Case "9"
       If RT$(637,"[9]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             If TempC=False Then
                Graphics.Off=False
                Strng="Enter restricted items:"
                Call IO.O
                Graphics.Off=True
                For VarQ=1 To 3
                   VarQ!=TreasureRecord.RestrictItem(VarQ)
                   If VarQ! Then
                      If VarQ!<0! Then
                         VarQ!=Abs(VarQ!)
                         Call Read.Record(ObjectFile,VarQ!)
                         Strng=Lcase$(Rtrim$(ObjectRecord.ObjectName))
                      Else
                         Call Write.Record(TreasureFile,Temp5!)
                         Call Read.Record(TreasureFile,VarQ!)
                         Strng=Lcase$(Rtrim$(TreasureRecord.TreasureName))
                         Call Read.Record(TreasureFile,Temp5!)
                      Endif
                   Else
                      Strng="<none>"
                   Endif
                   Strng=" ("+Ltrim$(Str$(VarQ))+")"+Strng
                   Call IO.O
                Next
                Strng=" (4)exit"
                Call IO.O
             Endif
             Graphics.Off=False
             Line.Length=TempD
             No.Input.Out="4"
             Strng="Enter restrict option(1-4)? "
             Call IO.I
             Call Write.Record(TreasureFile,Temp5!)
             VarQ=Int(Val(Out2))
             Select Case VarQ
             Case 1 To 3
                Do While Lost.Carrier=False
                   If TempC=False Then
                      Graphics.Off=False
                      Strng="Enter restricted type:"
                      Call IO.O
                      Graphics.Off=True
                      Strng=" <o>bject: "
                      If TreasureRecord.RestrictItem(VarQ)<0! Then
                         Strng=Strng+"Yes:"
                         Strng=Strng+Str$(Abs(TreasureRecord.RestrictItem(VarQ)))
                      Else
                         Strng=Strng+"No"
                      Endif
                      Call IO.O
                      Strng=" <t>reasure: "
                      If TreasureRecord.RestrictItem(VarQ)>0! Then
                         Strng=Strng+"Yes:"
                         Strng=Strng+Str$(TreasureRecord.RestrictItem(VarQ))
                      Else
                         Strng=Strng+"No"
                      Endif
                      Call IO.O
                      Strng=" <n>one"
                      Call IO.O
                      Strng=" <q>uit"
                      Call IO.O
                   Endif
                   Graphics.Off=False
                   Strng="Restricted type(o/t/n/q):"
                   Line.Length=TempD
                   No.Input.Out="q"
                   Call IO.I
                   Graphics.Off=True
                   Select Case Lcase$(Out2)
                   Case "o"
                      Call Find.Object2
                      If TempD! Then
                         Call Read.Record(TreasureFile,Temp5!)
                         TreasureRecord.RestrictItem(VarQ)=-TempD!
                         Call Write.Record(TreasureFile,Temp5!)
                      Endif
                   Case "t"
                      Call Find.Treasure2
                      If TempC! Then
                         Call Read.Record(TreasureFile,Temp5!)
                         TreasureRecord.RestrictItem(VarQ)=TempC!
                         Call Write.Record(TreasureFile,Temp5!)
                      Endif
                   Case "n"
                      Call Read.Record(TreasureFile,Temp5!)
                      TreasureRecord.RestrictItem(VarQ)=0!
                      Call Write.Record(TreasureFile,Temp5!)
                   Case "q"
                      Call Read.Record(TreasureFile,Temp5!)
                      Exit Do
                   End Select
                Loop
             Case 4
                Exit Do
             End Select
          Loop
       Endif
    Case "10"
       If RT$(465,"[10]")="[**]" 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 While Lost.Carrier=False
                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
                      TreasureRecord.Prefix1=Out2
                      Exit Do
                   Endif
                   Strng="Invalid ANSI code."
                   Call IO.O
                   Call More.Prompt
                Endif
             Loop
          Endif
       Endif
    Case "11"
       If RT$(686,"[11]")="[**]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Line.Length=TempD
          No.Input.Out="N"
          Strng="Treasure is persistent(y/n)? "
          Call IO.I
          If Yes Then
             TreasureRecord.Persistent=True
             Do While Lost.Carrier=False
                If TempC=False Then
                   Graphics.Off=False
                   Strng="Enter persistent items:"
                   Call IO.O
                   Graphics.Off=True
                   Strng=" (1)persist recharge time"+Str$(TreasureRecord.PersistTime)+" seconds."
                   Call IO.O
                   Strng=" (2)persist discharge time"+Str$(TreasureRecord.DischargePersist)+" seconds."
                   Call IO.O
                   Strng=" (3)persist charges"+Str$(TreasureRecord.MaxPersistCharges)+"."
                   Call IO.O
                   Strng=" (4)exit"
                   Call IO.O
                Endif
                Graphics.Off=False
                Line.Length=TempD
                No.Input.Out="4"
                Strng="Enter persistent option(1-4)? "
                Call IO.I
                VarQ=Int(Val(Out2))
                Select Case VarQ
                Case 1
                   Strng="Persist recharge time in seconds(0-3600)? "
                   Call IO.I
                   Var!=Int(Val(Out2))
                   If Var!>=0 And Var!<=3600! Then
                      TreasureRecord.PersistTime=Var!
                   Endif
                Case 2
                   Strng="Persist discharge time in seconds(0-3600)? "
                   Call IO.I
                   Var2!=Int(Val(Out2))
                   If Var2!>=0 And Var2!<=3600! Then
                      TreasureRecord.DischargePersist=Var2!
                   Endif
                Case 3
                   Strng="Persist charges(0-32767)? "
                   Call IO.I
                   Var=Int(Val(Out2))
                   If Var>=0 And Var<=32767 Then
                      TreasureRecord.MaxPersistCharges=Var
                   Endif
                Case 4
                   Exit Do
                End Select
             Loop
          Else
             TreasureRecord.Persistent=False
             TreasureRecord.PersistTime=SFalse
             TreasureRecord.DischargePersist=SFalse
             TreasureRecord.MaxPersistCharges=False
          Endif
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
 Call Write.Record(TreasureFile,Temp5!)
 Strng="Treasure '"+Rtrim$(TreasureRecord.TreasureName)+"' changed."
 Call IO.O
ErrExit148:
 Exit Sub
ErrResume148:
 Resume ErrExit148
End Sub

Sub Amount(Var#,Var$)
 If Instr(Str$(Var#),"D") Then
    Var$=Str$(Var#)
 Else
    Var$=" "+Form$(Var#)
 Endif
End Sub

Sub Find.Object2
 On Local Error Goto ErrResume105
 TempD!=SFalse
 Strng="Object name, or number"
 Strng=Strng+"(0-"+Mid$(Str$(Lof(ObjectFile)/ObjectRecLen),2)+")? "
 No.Input.Out="0"
 Call IO.I
 If Out2=Nul Then
    Exit Sub
 Endif
 Out2=Lcase$(Out2)
 Temp7!=SFalse
 If Instr(Out2,"#") Then
    Temp7!=Val(Mid$(Out2,Instr(Out2,"#")+1))
    Out2=Left$(Out2,Instr(Out2,"#")-1)
 Endif
 TempQ!=SFalse
 For Var2!=1! To Lof(ObjectFile)/ObjectRecLen
    Call Read.Record(ObjectFile,Var2!)
    Strng=Rtrim$(ObjectRecord.ObjectName)
    Var3$=Out2
    Call InstrSUB4(VarX,Var3$,0)
    If VarX Then
       TempQ!=TempQ!+1!
       If Temp7!=SFalse Or TempQ!=Temp7! Then
          Goto Exit105
       Endif
    Endif
 Next
 Var2!=Int(Val(Out2))
 If Var2!<=SFalse Or Var2!>Lof(ObjectFile)/ObjectRecLen Then
    Var2!=SFalse
 Else
    Call Read.Record(ObjectFile,Var2!)
 Endif
Exit105:
 TempD!=Var2!
ErrExit105:
 Exit Sub
ErrResume105:
 Resume ErrExit105
End Sub

Sub Find.Treasure2
 On Local Error Goto ErrResume106
 TempC!=SFalse
 Strng="Treasure name, or number"
 Strng=Strng+"(0-"+Mid$(Str$(Lof(TreasureFile)/TreasureRecLen),2)+")? "
 No.Input.Out="0"
 Call IO.I
 If Out2=Nul Then
    Exit Sub
 Endif
 Out2=Lcase$(Out2)
 Temp7!=SFalse
 If Instr(Out2,"#") Then
    Temp7!=Val(Mid$(Out2,Instr(Out2,"#")+1))
    Out2=Left$(Out2,Instr(Out2,"#")-1)
 Endif
 TempQ!=SFalse
 For Var2!=1! To Lof(TreasureFile)/TreasureRecLen
    Call Read.Record(TreasureFile,Var2!)
    Strng=Rtrim$(TreasureRecord.TreasureName)
    Var3$=Out2
    Call InstrSUB4(VarX,Var3$,0)
    If VarX Then
       TempQ!=TempQ!+1!
       If Temp7!=SFalse Or TempQ!=Temp7! Then
          Goto Exit106
       Endif
    Endif
 Next
 Var2!=Int(Val(Out2))
 If Var2!<=SFalse Or Var2!>Lof(TreasureFile)/TreasureRecLen Then
    Var2!=SFalse
 Else
    Call Read.Record(TreasureFile,Var2!)
 Endif
Exit106:
 TempC!=Var2!
ErrExit106:
 Exit Sub
ErrResume106:
 Resume ErrExit106
End Sub
