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

 On Error Goto ErrMain0
 Call Stdin(Var)
 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,"7")
    If Var=False Then
       Call Terminate.Program
       End
    Endif
 Endif
 Call Edit.Nonplayer
MainExit0:
 End
ErrMain0:
 Resume MainExit0
 End

Sub Edit.Nonplayer
 On Local Error Goto ErrResume66
 Call Edit.Status.Line
 Do While Lost.Carrier=False
    If TempC=False Then
       Graphics.Off=False
       Strng="Nonplayer Edit utility v"+Left$(Version$,4)+" menu:"
       Call IO.O
       Graphics.Off=True
       Strng=RT$(244,"[A]")+"dd"
       Call IO.O
       Strng=RT$(245,"[C]")+"hange"
       Call IO.O
       Strng=RT$(246,"[L]")+"ist"
       Call IO.O
       Strng=RT$(247,"[P]")+"ack"
       Call IO.O
       Strng=RT$(248,"[R]")+"epair"
       Call IO.O
       Strng=RT$(249,"[S]")+"earch"
       Call IO.O
       Strng=RT$(250,"[T]")+"alk responses"
       Call IO.O
       If Local.Mode Then
          Strng=RT$(587,"[V]")+"Print"
          Call IO.O
       Endif
       Graphics.Off=False
    Endif
    Strng="Nonplayer edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(244,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Add.Nonplayer
          Temp5!=Lof(NonPlayerFile)/NonPlayerRecLen
          Call Change.Nonplayer
       Endif
    Case "C"
       If RT$(245,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Nonplayer
          If Temp5! Then
             Call Change.Nonplayer
          Endif
       Endif
    Case "L"
       If RT$(246,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call List.Nonplayer
       Endif
    Case "P"
       If RT$(247,"[P]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Pack.Monsters
       Endif
    Case "R"
       If RT$(248,"[R]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Repair.Nonplayers(True)
       Endif
    Case "S"
       If RT$(249,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Search.Nonplayers
       Endif
    Case "T"
       If RT$(250,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Edit.NonplayerTalk
       Endif
    Case "V"
       If Local.Mode Then
          If RT$(587,"[V]")="[*]" Then
             Strng="Command restricted.."
             Call IO.O
          Else
             Call Print.Nonplayers
          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
ErrExit66:
 Exit Sub
ErrResume66:
 Resume ErrExit66
End Sub

Sub Add.Nonplayer
 On Local Error Goto ErrResume67
 Temp!=Lof(NonPlayerFile)/NonPlayerRecLen+1!
 MonsterRecord.MonsterName=Nul
 MonsterRecord.PluralName=Nul
 MonsterRecord.Experience=False
 MonsterRecord.Gold=False
 MonsterRecord.NumberAppearing=1
 MonsterRecord.Level=False
 MonsterRecord.Hits=False
 MonsterRecord.Poison=False
 MonsterRecord.LevelDrain=False
 MonsterRecord.Spell=SFalse
 MonsterRecord.Block=False
 MonsterRecord.Prevent=False
 MonsterRecord.Follow=False
 MonsterRecord.Magic=True
 MonsterRecord.Jail=False
 MonsterRecord.TeleportPercent=False
 MonsterRecord.FollowPercent=False
 MonsterRecord.BlockPercent=False
 MonsterRecord.PreventPercent=False
 MonsterRecord.SpellPercent=False
 MonsterRecord.PoisonPercent=False
 MonsterRecord.DrainPercent=False
 MonsterRecord.Rate=False
 MonsterRecord.RatePercent=False
 MonsterRecord.Permanent=-2
 For Temp6=1 To MaxMonTalk
    MonsterRecord.Talk(Temp6)=SFalse
 Next
 MonsterRecord.Psionic=False
 MonsterRecord.PsionicSpell=SFalse
 MonsterRecord.Equation=False
 MonsterRecord.MonsterEquate=Nul
 MonsterRecord.MonsterSurprise=Nul
 MonsterRecord.MonsterSavingThrow=Nul
 MonsterRecord.Prefix1=Nul
 MonsterRecord.First=SFalse
 MonsterRecord.Last=SFalse
 MonsterRecord.Weapon=SFalse
 MonsterRecord.Shield=SFalse
 MonsterRecord.Armor=SFalse
 MonsterRecord.PerMonster=0
 MonsterRecord.TalkGold=0
 MonsterRecord.TalkGoldTimes=0
 MonsterRecord.TalkGoldPercent=0
 MonsterRecord.TalkItem=0
 MonsterRecord.TalkItemTimes=0
 MonsterRecord.TalkItemPercent=0
 MonsterRecord.TalkMoveDirection=0
 MonsterRecord.Buffer15=0
 MonsterRecord.Buffer16=0
 Call Write.Record(NonPlayerFile,Temp!)
 UserRecord.ObjectsCreated(4)=UserRecord.ObjectsCreated(4)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
ErrExit67:
 Exit Sub
ErrResume67:
 Resume ErrExit67
End Sub

Sub List.Nonplayer
 On Local Error Goto ErrResume68
 Temp3!=Lof(NonPlayerFile)/NonPlayerRecLen
 Call Get.Record.Range(Temp!,Temp2!,Temp3!)
 Allow.Break=True
 Break=False
 Continuous=False
 For Temp5!=Temp! To Temp2!
    Call Read.Record(NonPlayerFile,Temp5!)
    For VarQ=1 To 21
       Call Display.Nonplayer(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
ErrExit68:
 Exit Sub
ErrResume68:
 Resume ErrExit68
End Sub

Sub Print.Nonplayers
 On Local Error Goto ErrResume68a
 Strng="Printer port(1-3)? "
 Call IO.I
 VarP=Int(Val(Out2)+.5)
 If VarP>=1 And VarP<=3 Then
    Close #TempFile1
    VarP$="LPT"+Mid$(Str$(VarP),2)+":"
    Open VarP$ For Output As #TempFile1
    Temp3!=Lof(NonPlayerFile)/NonPlayerRecLen
    Call Get.Record.Range(Temp!,Temp2!,Temp3!)
    For Temp5!=Temp! To Temp2!
       Call Read.Record(NonPlayerFile,Temp5!)
       For VarQ=1 To 18
          Call Print.Nonplayer(VarQ)
       Next
       Print #TempFile1,Chr$(12);
    Next
 Endif
ErrExit68a:
 Close #TempFile1
 Exit Sub
ErrResume68a:
 Resume ErrExit68a
End Sub

Sub Change.Nonplayer
 On Local Error Goto ErrResume69
 Call Read.Record(NonPlayerFile,Temp5!)
 Do While Lost.Carrier=False
    Allow.Break=True
    Break=False
    Call Write.Record(NonPlayerFile,Temp5!)
    For VarQ=1 To 21
       Call Display.Nonplayer(True,VarQ)
       If Break Then
          Exit For
       Endif
    Next
    Allow.Break=False
    Break=False
    Graphics.Off=False
    Strng="Nonplayer change option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(251,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer name(30 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          Out2=Lcase$(Out2)
          MonsterRecord.MonsterName=Out2
       Endif
    Case "B"
       If RT$(252,"[B]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Rooms(separated by commas):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          Out2=Lcase$(Out2)
          MonsterRecord.PluralName=Out2
       Endif
    Case "C"
       If RT$(253,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer level(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2)+.5)>=1 And Int(Val(Out2)+.5)<=32767 Then
             MonsterRecord.Level=Int(Val(Out2)+.5)
          Endif
       Endif
    Case "D"
       If RT$(254,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Hit points(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2)+.5)>=1 And Int(Val(Out2)+.5)<=32767 Then
             MonsterRecord.Hits=Int(Val(Out2)+.5)
          Endif
       Endif
    Case "E"
       If RT$(255,"[E]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Experience points(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2)+.5)>=1 And Int(Val(Out2)+.5)<=32767 Then
             MonsterRecord.Experience=Int(Val(Out2)+.5)
          Endif
       Endif
    Case "F"
       If RT$(256,"[F]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Poisonous nonplayer(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Poison=False
          MonsterRecord.PoisonPercent=False
          If Yes Then
             MonsterRecord.Poison=True
             Strng="Percent chance nonplayer will poison(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp3=Int(Val(Out2)+.5)
             If Temp3>=1 And Temp3<=100 Then
                MonsterRecord.PoisonPercent=Temp3
             Endif
          Endif
       Endif
    Case "G"
       If RT$(257,"[G]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Level draining nonplayer(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.LevelDrain=False
          MonsterRecord.DrainPercent=False
          If Yes Then
             MonsterRecord.LevelDrain=True
             Strng="Percent chance nonplayer will level drain(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp3=Int(Val(Out2)+.5)
             If Temp3>=1 And Temp3<=100 Then
                MonsterRecord.DrainPercent=Temp3
             Endif
          Endif
       Endif
    Case "H"
       If RT$(258,"[H]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer blocks exits(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Block=False
          MonsterRecord.BlockPercent=False
          If Yes Then
             MonsterRecord.Block=True
             Strng="Percent chance nonplayer will block exits(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp3=Int(Val(Out2)+.5)
             If Temp3>=1 And Temp3<=100 Then
                MonsterRecord.BlockPercent=Temp3
             Endif
          Endif
       Endif
    Case "I"
       If RT$(259,"[I]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer prevents taking treasure(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Prevent=False
          MonsterRecord.PreventPercent=False
          If Yes Then
             MonsterRecord.Prevent=True
             Strng="Percent chance nonplayer prevents taking treasure(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp3=Int(Val(Out2)+.5)
             If Temp3>=1 And Temp3<=100 Then
                MonsterRecord.PreventPercent=Temp3
             Endif
          Endif
       Endif
    Case "J"
       If RT$(260,"[J]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer follows user(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Follow=False
          MonsterRecord.FollowPercent=False
          MonsterRecord.TeleportPercent=False
          If Yes Then
             MonsterRecord.Follow=True
             Strng="Percent chance nonplayer will follow user(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp3=Int(Val(Out2)+.5)
             If Temp3>=1 And Temp3<=100 Then
                MonsterRecord.FollowPercent=Temp3
             Endif
             Strng="Percent chance nonplayer will teleport with user(1-100)? "
             No.Input.Out="50"
             Call IO.I
             Temp3=Int(Val(Out2)+.5)
             If Temp3>=1 And Temp3<=100 Then
                MonsterRecord.TeleportPercent=Temp3
             Endif
          Endif
       Endif
    Case "K"
       If RT$(261,"[K]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer casts spells(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Spell=SFalse
          MonsterRecord.SpellPercent=False
          If Yes Then
             Call Find.Spell(-1)
             If TempD! Then
                MonsterRecord.Spell=TempD!
                Strng="Percent chance nonplayer casts spell(1-100)? "
                No.Input.Out="50"
                Call IO.I
                Temp3=Int(Val(Out2)+.5)
                If Temp3>=1 And Temp3<=100 Then
                   MonsterRecord.SpellPercent=Temp3
                Endif
             Endif
          Endif
       Endif
    Case "L"
       If RT$(262,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer jails attacker(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Jail=yes
       Endif
    Case "M"
       If RT$(264,"[M]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer encounter rate(# of action prompts)? "
          No.Input.Out="6"
          Call IO.I
          MonsterRecord.Rate=Int(Val(Out2)+.5)
          Strng="Nonplayer encounter percent(1-100)? "
          No.Input.Out="50"
          Call IO.I
          Temp3=Int(Val(Out2)+.5)
          If Temp3>=1 And Temp3<=100 Then
             MonsterRecord.RatePercent=Temp3
          Endif
       Endif
    Case "N"
       If RT$(265,"[N]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Nonplayer uses psionics(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Psionic=False
          MonsterRecord.PsionicSpell=SFalse
          If Yes Then
             Strng="Psionic spell?"
             Call Find.Spell(-1)
             If TempD! Then
                If SpellRecord.Psionic=False Then
                   Strng="That spell is not a psionic spell!"
                   Call IO.O
                   MonsterRecord.Psionic=False
                   MonsterRecord.PsionicSpell=SFalse
                Else
                   MonsterRecord.Psionic=True
                   MonsterRecord.PsionicSpell=TempD!
                Endif
             Endif
          Endif
       Endif
    Case "O"
       If RT$(266,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Edit.Mon.Inventory
       Endif
    Case "P"
       If RT$(267,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Nonplayer has attack equation(y/n)? "
          Call IO.I
          MonsterRecord.Equation=False
          MonsterRecord.MonsterEquate=Nul
          If Yes Then
             Strng="Enter nonplayer attack equation:"
             Call IO.I
             MonsterRecord.Equation=True
             MonsterRecord.MonsterEquate=Ucase$(Out2)
          Endif
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Nonplayer has surprise equation(y/n)? "
          Call IO.I
          MonsterRecord.MonsterSurprise=Nul
          If Yes Then
             Strng="Enter nonplayer surprise equation:"
             Call IO.I
             MonsterRecord.MonsterSurprise=Ucase$(Out2)
          Endif
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Nonplayer has saving throw equation(y/n)? "
          Call IO.I
          MonsterRecord.MonsterSavingThrow=Nul
          If Yes Then
             Strng="Enter nonplayer saving throw equation:"
             Call IO.I
             MonsterRecord.MonsterSavingThrow=Ucase$(Out2)
          Endif
       Endif
    Case "R"
       If RT$(268,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Graphics.Off=True
          If ANSIPrefixChar=Nul Then
             Strng="ANSI prefix codes not enabled."
             Call IO.O
             Call More.Prompt
          Else
             Do
                Strng="ANSI prefix code(8 characters, ? for help):"
                Call IO.O
                Strng="?"
                No.Input.Out=Nul
                Call IO.I
                Out2=Ucase$(Out2)
                If Out2="?" Then
                   Call Display.ANSI.Prefixes
                Else
                   Call Check.ANSI.Prefix(V%)
                   If V% Then
                      MonsterRecord.Prefix1=Out2
                      Exit Do
                   Endif
                   Strng="Invalid ANSI code."
                   Call IO.O
                   Call More.Prompt
                Endif
             Loop
          Endif
       Endif
    Case "S"
       If RT$(269,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Weapon: "
          If MonsterRecord.Weapon Then
             Call Read.Record(TreasureFile,MonsterRecord.Weapon)
             Strng=Strng+Lcase$(Rtrim$(TreasureRecord.TreasureName))
          Else
             Strng=Strng+"<none>"
          Endif
          Call IO.O
          Strng="Shield: "
          If MonsterRecord.Shield Then
             Call Read.Record(TreasureFile,MonsterRecord.Shield)
             Strng=Strng+Lcase$(Rtrim$(TreasureRecord.TreasureName))
          Else
             Strng=Strng+"<none>"
          Endif
          Call IO.O
          Strng="Armor: "
          If MonsterRecord.Armor Then
             Call Read.Record(TreasureFile,MonsterRecord.Armor)
             Strng=Strng+Lcase$(Rtrim$(TreasureRecord.TreasureName))
          Else
             Strng=Strng+"<none>"
          Endif
          Call IO.O
          Strng="Weapon:"
          Call IO.O
          Call Find.Treasure
          If TempC!=SFalse Then
             Strng="Item removed from monster."
             MonsterRecord.Weapon=SFalse
          Else
             If TreasureRecord.WeaponNumber=7 Then
                MonsterRecord.Weapon=TempC!
                Strng="Item added to monster."
             Else
                Strng="Item not added to monster."
             Endif
          Endif
          Call IO.O
          Strng="Shield:"
          Call IO.O
          Call Find.Treasure
          If TempC!=SFalse Then
             Strng="Item removed from monster."
             MonsterRecord.Shield=SFalse
          Else
             If TreasureRecord.WeaponNumber=5 Then
                MonsterRecord.Shield=TempC!
                Strng="Item added to monster."
             Else
                Strng="Item not added to monster."
             Endif
          Endif
          Call IO.O
          Strng="Armor:"
          Call IO.O
          Call Find.Treasure
          If TempC!=SFalse Then
             Strng="Item removed from monster."
             MonsterRecord.Armor=SFalse
          Else
             If TreasureRecord.WeaponNumber=1 Then
                MonsterRecord.Armor=TempC!
                Strng="Item added to monster."
             Else
                Strng="Item not added to monster."
             Endif
          Endif
          Call IO.O
          Call More.Prompt
       Endif
    Case "T"
       If RT$(204,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Gold points(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2)+.5)>=1 And Int(Val(Out2)+.5)<=32767 Then
             MonsterRecord.Gold=Int(Val(Out2)+.5)
          Endif
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
 Call Write.Record(NonPlayerFile,Temp5!)
 Strng="Nonplayer '"+Rtrim$(MonsterRecord.MonsterName)+"' changed."
 Call IO.O
ErrExit69:
 Exit Sub
ErrResume69:
 Resume ErrExit69
End Sub

Sub Edit.Mon.Inventory
 On Local Error Goto ErrResume149
 Do While Lost.Carrier=False
    Graphics.Off=True
    If TempC=False Then
       Strng=RT$(270,"[O]")+"bjects"
       Call IO.O
       Strng=RT$(271,"[T]")+"reasure"
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="Monster inventory edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "O"
       If RT$(270,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(272,"[A]")+"dd"
             Call IO.O
             Strng=RT$(273,"[D]")+"elete"
             Call IO.O
             Strng=RT$(274,"[L]")+"ist"
             Call IO.O
             Graphics.Off=False
          Endif
          Strng="Inventory object edit option(q to quit)? "
          Line.Length=TempD
          No.Input.Out="Q"
          Call IO.I
          Select Case Ucase$(Out2)
          Case "A"
             If RT$(272,"[A]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                Call Find.Object
                If TempD!=SFalse Then
                   Strng="Object not added to monster inventory."
                Endif
                If TempD! Then
                   Temp6!=Lof(MonInvFile)/MessWorkRecLen6+1!
                   MessWorkRecord6.Room=SFalse
                   MessWorkRecord6.User=-TempD!
                   MessWorkRecord6.Index=-Temp5!
                   MessWorkRecord6.Charges=False
                   MessWorkRecord6.Plus=False
                   Call Add.List.Node2(Temp6!)
                   Strng="Object added to monster inventory."
                Endif
                Call IO.O
             Endif
          Case "D"
             If RT$(273,"[D]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                Strng="Number to delete? "
                No.Input.Out="1"
                Call IO.I
                VarQ=False
                Temp4!=Int(Val(Out2)+.5)
                TempX!=SFalse
                Temp9!=MonsterRecord.First
                If Temp9! Then
                   Do While Lost.Carrier=False
                      Call Read.Record(MonInvFile,Temp9!)
                      Temp6!=MessWorkRecord6.Next
                      If MessWorkRecord6.User<SFalse Then
                         TempX!=TempX!+1!
                         If TempX!=Temp4! Then
                            Call Delete.List.Node(Temp9!)
                            Call Clear.List.Node
                            Call Write.Record(MonInvFile,Temp9!)
                            VarQ=True
                            Exit Do
                         Endif
                      Endif
                      If Temp6!=SFalse Then
                         Exit Do
                      Endif
                      Temp9!=Temp6!
                   Loop
                Endif
                If VarQ=True Then
                   Strng="Object deleted from monster inventory."
                Else
                   Strng="Object not deleted from monster inventory."
                Endif
                Call IO.O
             Endif
          Case "L"
             If RT$(274,"[L]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                Graphics.Off=True
                VarZ=False
                Continuous=False
                Allow.Break=True
                Break=False
                Temp4!=MonsterRecord.First
                TempX!=SFalse
                If Temp4! Then
                   Do While Lost.Carrier=False
                      Call Read.Record(MonInvFile,Temp4!)
                      Temp6!=MessWorkRecord6.Next
                      Temp!=MessWorkRecord6.User
                      If Temp!<SFalse Then
                         Temp!=Abs(Temp!)
                         If Temp!>SFalse And Temp!<=Lof(ObjectFile)/ObjectRecLen Then
                            Call Read.Record(ObjectFile,Temp!)
                            Out3=ObjectRecord.ObjectName
                            Out3=Lcase$(Out3)
                            TempX!=TempX!+1!
                            Strng=Mid$(Str$(TempX!),2)+"."+Out3
                            Call IO.O
                            If Break Then
                               Exit Do
                            Endif
                            VarZ=VarZ+1
                            If VarZ>=User.Pagelength-2 Then
                               VarZ=False
                               If Continuous=False Then
                                  Call More.Prompt
                                  If No Or Quit Then
                                     Exit Do
                                  Endif
                               Endif
                            Endif
                         Endif
                      Endif
                      If Temp6!=SFalse Then
                         Exit Do
                      Endif
                      Temp4!=Temp6!
                   Loop
                Endif
                Allow.Break=False
                If VarZ Then
                   Call More.Prompt
                Endif
             Endif
          Case "Q"
             Exit Do
          End Select
       Loop
       Endif
    Case "T"
       If RT$(271,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(275,"[A]")+"dd"
             Call IO.O
             Strng=RT$(276,"[D]")+"elete"
             Call IO.O
             Strng=RT$(277,"[L]")+"ist"
             Call IO.O
             Graphics.Off=False
          Endif
          Strng="Inventory treasure edit option(q to quit)? "
          Line.Length=TempD
          No.Input.Out="Q"
          Call IO.I
          Select Case Ucase$(Out2)
          Case "A"
             If RT$(275,"[A]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                Call Find.Treasure
                If TempC!=SFalse Then
                   Strng="Treasure not added to monster inventory."
                Endif
                If TempC! Then
                   Temp6!=Lof(MonInvFile)/MessWorkRecLen6+1!
                   MessWorkRecord6.Room=SFalse
                   MessWorkRecord6.User=TempC!
                   MessWorkRecord6.Index=-Temp5!
                   MessWorkRecord6.Charges=TreasureRecord.Charges
                   MessWorkRecord6.Plus=False
                   Call Add.List.Node2(Temp6!)
                   Strng="Treasure added to monster inventory."
                Endif
                Call IO.O
             Endif
          Case "D"
             If RT$(276,"[D]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                Strng="Number to delete? "
                No.Input.Out="1"
                Call IO.I
                VarQ=False
                Temp4!=Int(Val(Out2)+.5)
                TempX!=SFalse
                Temp9!=MonsterRecord.First
                If Temp9! Then
                   Do While Lost.Carrier=False
                      Call Read.Record(MonInvFile,Temp9!)
                      Temp6!=MessWorkRecord6.Next
                      If MessWorkRecord6.User>SFalse Then
                         TempX!=TempX!+1!
                         If TempX!=Temp4! Then
                            Call Delete.List.Node(Temp9!)
                            Call Clear.List.Node
                            Call Write.Record(MonInvFile,Temp9!)
                            VarQ=True
                            Exit Do
                         Endif
                      Endif
                      If Temp6!=SFalse Then
                         Exit Do
                      Endif
                      Temp9!=Temp6!
                   Loop
                Endif
                If VarQ=True Then
                   Strng="Treasure deleted from monster inventory."
                Else
                   Strng="Treasure not deleted from monster inventory."
                Endif
                Call IO.O
             Endif
          Case "L"
             If RT$(277,"[L]")="[*]" Then
                Strng="Command restricted.."
                Call IO.O
             Else
                Graphics.Off=True
                VarZ=False
                Continuous=False
                Allow.Break=True
                Break=False
                Temp4!=MonsterRecord.First
                TempX!=SFalse
                If Temp4! Then
                   Do While Lost.Carrier=False
                      Call Read.Record(MonInvFile,Temp4!)
                      Temp6!=MessWorkRecord6.Next
                      Temp!=MessWorkRecord6.User
                      If Temp!>SFalse And Temp!<=Lof(TreasureFile)/TreasureRecLen Then
                         Call Read.Record(TreasureFile,Temp!)
                         Out3=TreasureRecord.TreasureName
                         Out3=Lcase$(Out3)
                         TempX!=TempX!+1!
                         Strng=Mid$(Str$(TempX!),2)+"."+Out3
                         Call IO.O
                         If Break Then
                            Exit Do
                         Endif
                         VarZ=VarZ+1
                         If VarZ>=User.Pagelength-2 Then
                            VarZ=False
                            If Continuous=False Then
                               Call More.Prompt
                               If No Or Quit Then
                                  Exit Do
                               Endif
                            Endif
                         Endif
                      Endif
                      If Temp6!=SFalse Then
                         Exit Do
                      Endif
                      Temp4!=Temp6!
                   Loop
                Endif
                Allow.Break=False
                If VarZ Then
                   Call More.Prompt
                Endif
             Endif
          Case "Q"
             Exit Do
          End Select
       Loop
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
ErrExit149:
 Exit Sub
ErrResume149:
 Resume ErrExit149
End Sub

Sub Pack.Monsters
 On Local Error Goto ErrResume53
 Call Search.Mess2(Var2)
 If Var2 Then
    Strng="Can't pack while node/user online."
    Call IO.O
    Exit Sub
 Endif
 Strng="Pack monster inventory file(y/n)? "
 Line.Length=TempD
 No.Input.Out="Y"
 Call IO.I
 If No Then
    Exit Sub
 Endif
 Call Repair.Nonplayers(False)
 Close #TempFile1
 FileName=Data.Path1+"MONINV.BAK"
 If Dir$(FileName)<>Nul Then
    Kill FileName
 Endif
 Open FileName For Random Shared As #TempFile1 Len=MessWorkRecLen6
 For Temp5!=1! To Lof(MonInvFile)/MessWorkRecLen6
    Call Read.Record(MonInvFile,Temp5!)
    Call Write.TempFile(7,Temp5!)
 Next
 Close #MonInvFile
 FileName=MonInv.FileName
 If Dir$(FileName)<>Nul Then
    Kill FileName
 Endif
 Open FileName For Random Shared As #MonInvFile Len=MessWorkRecLen6
 For Temp5!=1! To Lof(MonsterFile)/MonsterRecLen
    Call Read.Record(MonsterFile,Temp5!)
    Temp!=MonsterRecord.First
    If Temp! Then
       MonsterRecord.First=SFalse
       MonsterRecord.Last=SFalse
       Call Write.Record(MonsterFile,Temp5!)
       Do
          Call Read.TempFile(7,Temp!)
          Temp6!=MessWorkRecord6.Next
          Temp7!=Lof(MonInvFile)/MessWorkRecLen6+1!
          Call Add.List.Node1(Temp7!)
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp!=Temp6!
       Loop
    Endif
 Next
 Strng="Monster inventory file packed."
 Call IO.O
 For Temp5!=1! To Lof(NonplayerFile)/MonsterRecLen
    Call Read.Record(NonplayerFile,Temp5!)
    Temp!=MonsterRecord.First
    If Temp! Then
       MonsterRecord.First=SFalse
       MonsterRecord.Last=SFalse
       Call Write.Record(NonplayerFile,Temp5!)
       Do
          Call Read.TempFile(7,Temp!)
          Temp6!=MessWorkRecord6.Next
          Temp7!=Lof(MonInvFile)/MessWorkRecLen6+1!
          Call Add.List.Node2(Temp7!)
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp!=Temp6!
       Loop
    Endif
 Next
 Strng="Nonplayer inventory file packed."
 Call IO.O
ErrExit53:
 Exit Sub
ErrResume53:
 Resume ErrExit53
End Sub

Sub Repair.Nonplayers(VarK)
 On Local Error Goto ErrResume65a
 Call Search.Mess2(Var1)
 If Var1 Then
    Strng="Can't repair while node/user online."
    Call IO.O
    Exit Sub
 Endif
 If VarK Then
    Strng="Repair nonplayer inventory file(y/n)? "
    Line.Length=TempD
    No.Input.Out="Y"
    Call IO.I
    If No Then
       Exit Sub
    Endif
 Endif
 Carriage.Return=True
 Graphics.Off=True
 Strng="Making backup of nonplayer inventory file"
 Call IO.O
 Close #TempFile1
 FileName=Data.Path1+"MONINV2.BAK"
 If Dir$(FileName)<>Nul Then
    Kill FileName
 Endif
 VarD=False
 VarE=False
 VarF!=Timeit!
 Open FileName For Random Shared As #TempFile1 Len=MessWorkRecLen6
 For Temp5!=1! To Lof(MonInvFile)/MessWorkRecLen6
    Call Read.Record(MonInvFile,Temp5!)
    Call Write.TempFile(7,Temp5!)
    Call Dot.Display(VarD,VarE,VarF!)
 Next
 Call IO.O
 Carriage.Return=True
 Graphics.Off=True
 Strng="Repairing nonplayer inventory file"
 Call IO.O
 VarD=False
 VarE=False
 VarF!=Timeit!
 Var4!=SFalse
 VarZ1!=SFalse
 For Temp1!=1! To Lof(NonplayerFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(NonplayerFile,Temp1!)
    Temp2!=MonsterRecord.First
    Temp3!=MonsterRecord.Last
    If Temp2!>SFalse And Temp3!>SFalse Then
       If Temp2!=Temp3! Then
          Call Read.Record(MonInvFile,Temp2!)
          If MessWorkRecord6.Prev<>SFalse Or MessWorkRecord6.Next<>SFalse Then
             VarZ1!=VarZ1!+1!
             MessWorkRecord6.Prev=SFalse
             MessWorkRecord6.Next=SFalse
             Call Write.Record(MonInvFile,Temp2!)
          Endif
       Else
          Call Read.Record(MonInvFile,Temp2!)
          If MessWorkRecord6.Prev<>SFalse Then
             VarZ1!=VarZ1!+1!
             MessWorkRecord6.Prev=SFalse
             Call Write.Record(MonInvFile,Temp2!)
          Endif
          Call Read.Record(MonInvFile,Temp3!)
          If MessWorkRecord6.Next<>SFalse Then
             VarZ1!=VarZ1!+1!
             MessWorkRecord6.Next=SFalse
             Call Write.Record(MonInvFile,Temp3!)
          Endif
       Endif
    Endif
 Next
 VarZ2!=SFalse
 Close #TempFile1
 FileName=GetFilename$("TABLE","BK3")
 Open FileName For Random Shared As #TempFile1 Len=4
 Field #TempFile1,4 As S$
 For Temp1!=1! To Lof(NonplayerFile)/MonsterRecLen
    VarY1!=0!
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(NonplayerFile,Temp1!)
    Temp2!=MonsterRecord.First
    If Temp2! Then
       Do
          Call Read.Record(MonInvFile,Temp2!)
          VarY1!=VarY1!+1!
          Lset S$=Mks$(Temp2!)
          Put #TempFile1,VarY1!
          Temp6!=MessWorkRecord6.Next
          If Temp6!>SFalse Then
             Call Read.Record(MonInvFile,Temp6!)
             For Temp7!=1! To VarY1!
                Get #TempFile1,Temp7!
                Temp8!=Cvs(S$)
                If Temp6!=Temp8! Then
                   Gosub Truncate1
                   Exit Do
                Endif
             Next
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp2!=Temp6!
       Loop
    Endif
 Next
 For Temp1!=1! To Lof(NonplayerFile)/MonsterRecLen
    VarY1!=0!
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(NonplayerFile,Temp1!)
    Temp2!=MonsterRecord.Last
    If Temp2! Then
       Do
          Call Read.Record(MonInvFile,Temp2!)
          VarY1!=VarY1!+1!
          Lset S$=Mks$(Temp2!)
          Put #TempFile1,VarY1!
          Temp6!=MessWorkRecord6.Prev
          If Temp6!>SFalse Then
             Call Read.Record(MonInvFile,Temp6!)
             For Temp7!=1! To VarY1!
                Get #TempFile1,Temp7!
                Temp8!=Cvs(S$)
                If Temp6!=Temp8! Then
                   Gosub Truncate2
                   Exit Do
                Endif
             Next
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp2!=Temp6!
       Loop
    Endif
 Next
 Close #TempFile1
 Kill Filename
 For Temp1!=1! To Lof(NonplayerFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(NonplayerFile,Temp1!)
    Temp2!=MonsterRecord.First
    If Temp2! Then
       Do
          Call Read.Record(MonInvFile,Temp2!)
          Temp6!=MessWorkRecord6.Next
          If Temp6!>SFalse Then
             Call Read.Record(MonInvFile,Temp6!)
             If Temp2!<>MessWorkRecord6.Prev Then
                Gosub Truncate1
                Exit Do
             Endif
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp2!=Temp6!
       Loop
    Endif
 Next
 For Temp1!=1! To Lof(NonplayerFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(NonplayerFile,Temp1!)
    Temp2!=MonsterRecord.Last
    If Temp2! Then
       Do
          Call Read.Record(MonInvFile,Temp2!)
          Temp6!=MessWorkRecord6.Prev
          If Temp6!>SFalse Then
             Call Read.Record(MonInvFile,Temp6!)
             If Temp2!<>MessWorkRecord6.Next Then
                Gosub Truncate2
                Exit Do
             Endif
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp2!=Temp6!
       Loop
    Endif
 Next
 VarZ3!=SFalse
 For Temp1!=1! To Lof(NonplayerFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(NonplayerFile,Temp1!)
    Temp2!=MonsterRecord.First
    If Temp2! Then
       Do
          Call Read.Record(MonInvFile,Temp2!)
          Temp6!=MessWorkRecord6.Next
          Temp3!=Abs(MessWorkRecord6.Index)
          If Temp3!<>Temp1! Then
             VarZ3!=VarZ3!+1!
             MessWorkRecord6.Index=-Temp1!
             Call Write.Record(MonInvFile,Temp2!)
          Endif
          If Temp6!=SFalse Then
             Exit Do
          Endif
          Temp2!=Temp6!
       Loop
    Endif
 Next
 Call IO.O
 Graphics.Off=False
 Strng="Nonplayer inventory file repaired."
 Call IO.O
 Strng="Reset"+Str$(VarZ1!)+" nodes."
 Call IO.O
 Strng="Deleted"+Str$(VarZ2!)+" nodes."
 Call IO.O
 Strng="Repaired"+Str$(VarZ3!)+" nodes."
 Call IO.O
 Exit Sub
Truncate1:
 VarZ2!=VarZ2!+1!
 Call Read.Record(MonInvFile,Temp2!)
 MessWorkRecord6.Next=SFalse
 Call Write.Record(MonInvFile,Temp2!)
 MonsterRecord.Last=Temp2!
 Call Write.Record(NonplayerFile,Temp1!)
 Return
Truncate2:
 VarZ2!=VarZ2!+1!
 Call Read.Record(MonInvFile,Temp2!)
 MessWorkRecord6.Prev=SFalse
 Call Write.Record(MonInvFile,Temp2!)
 MonsterRecord.First=Temp2!
 Call Write.Record(NonplayerFile,Temp1!)
 Return
ErrExit65a:
 Exit Sub
ErrResume65a:
 Resume ErrExit65a
End Sub

Sub Search.Nonplayers
 On Local Error Goto ErrResume57
 Do While Lost.Carrier=False
    Temp1$=Nul
    Temp1=False
    Temp3=False
    Temp4=False
    Temp6#=DFalse
    Temp7#=DFalse
    Temp8=False
    Temp9=False
    Temp10=False
    Temp11=False
    Temp12=False
    Temp13=False
    Do While Lost.Carrier=False
       Graphics.Off=True
       If TempC=False Then
          Strng="[A]nonplayer name substring"
          If Temp1$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp1$+")"
          Endif
          Call IO.O
          Strng="[B]nonplayer level"
          If Temp1 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp1),2)+")"
          Endif
          Call IO.O
          Strng="[C]hit points"
          If Temp3>=False And Temp4>False Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp3),2)+"-"+Mid$(Str$(Temp4),2)+")"
          Endif
          Call IO.O
          Strng="[D]experience"
          If Temp6#>=DFalse And Temp7#>DFalse Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp6#),2)+"-"+Mid$(Str$(Temp7#),2)+")"
          Endif
          Call IO.O
          Strng="[E]poisons"
          If Temp8 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[F]drains levels"
          If Temp9 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[G]casts spells"
          If Temp10 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[H]jails attacker"
          If Temp11 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[I]psionic nonplayers"
          If Temp12 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[J]equation"
          If Temp13 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Graphics.Off=False
       Endif
       Strng="Nonplayer 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="Nonplayer name substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp1$=Out2
       Case "B"
          Strng="Nonplayer level? "
          Call IO.I
          Temp1=Int(Val(Out2)+.5)
       Case "C"
          Strng="Enter range: "
          Call IO.O
          No.Input.Out="1"
          Strng="From? "
          Call IO.I
          Temp3=Int(Val(Out2)+.5)
          No.Input.Out="10"
          Strng="To? "
          Call IO.I
          Temp4=Int(Val(Out2)+.5)
       Case "D"
          Strng="Enter range: "
          Call IO.O
          No.Input.Out="1"
          Strng="From? "
          Call IO.I
          Temp6#=Int(Val(Out2)+.5)
          No.Input.Out="10"
          Strng="To? "
          Call IO.I
          Temp7#=Int(Val(Out2)+.5)
       Case "E"
          Temp8=True
       Case "F"
          Temp9=True
       Case "G"
          Temp10=True
       Case "H"
          Temp11=True
       Case "I"
          Temp12=True
       Case "J"
          Temp13=True
       Case "S"
          Temp5!=Lof(NonPlayerFile)/NonPlayerRecLen
          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))+.5)
                Temp1$=Left$(Temp1$,VarZ-1)
             Endif
          Endif
          For Temp5!=Temp! To Temp2!
             TempX=False
             Call Read.Record(NonPlayerFile,Temp5!)
             If Temp1$<>Nul Then
                Out3=Rtrim$(MonsterRecord.MonsterName)
                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 Then
                If MonsterRecord.Level=Temp1 Then
                   TempX=True
                Endif
             Endif
             If Temp3>=False And Temp4>False Then
                If MonsterRecord.Hits>=Temp3 And _
                MonsterRecord.Hits<=Temp4 Then
                   TempX=True
                Endif
             Endif
             If Temp6#>=DFalse And Temp7#>DFalse Then
                If MonsterRecord.Experience>=Temp6# And _
                MonsterRecord.Experience<=Temp7# Then
                   TempX=True
                Endif
             Endif
             If Temp8 Then
                If MonsterRecord.Poison Then
                   TempX=True
                Endif
             Endif
             If Temp9 Then
                If MonsterRecord.LevelDrain Then
                   TempX=True
                Endif
             Endif
             If Temp10 Then
                If MonsterRecord.Spell Then
                   TempX=True
                Endif
             Endif
             If Temp11 Then
                If MonsterRecord.Jail Then
                   TempX=True
                Endif
             Endif
             If Temp12 Then
                If MonsterRecord.Psionic Then
                   TempX=True
                Endif
             Endif
             If Temp13 Then
                If MonsterRecord.Equation Then
                   TempX=True
                Endif
             Endif
             If TempX Then
                For VarQ=1 To 21
                   Call Display.Nonplayer(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
ErrExit57:
 Exit Sub
ErrResume57:
 Resume ErrExit57
End Sub

Sub Edit.NonplayerTalk
 On Local Error Goto ErrResume44
 If Lof(MonTalkFile)=SFalse Then
    BufferRecord.Buffer=Nul
    Call Write.Record(MonTalkFile,1!)
 Endif
 Do While Lost.Carrier=False
    Graphics.Off=True
    If TempC=False Then
       Strng=RT$(278,"[A]")+"dd response"
       Call IO.O
       Strng=RT$(279,"[C]")+"hange response"
       Call IO.O
       Strng=RT$(280,"[L]")+"ist response"
       Call IO.O
       Strng=RT$(281,"[N]")+"onplayer response"
       Call IO.O
       If Local.Mode Then
          Strng="[P]rint"
          Call IO.O
       Endif
       Graphics.Off=False
    Endif
    Strng="Monster talk edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(278,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Enter response(80 characters):"
          Call IO.O
          Strng="Press "+Enter$+" for none."
          Call IO.O
          Strng="?"
          Call IO.I
          While Left$(Out2,1)=Chr$(34)
             Out2=Mid$(Out2,2)
          Wend
          Temp!=Lof(MonTalkFile)/MonTalkRecLen+1!
          BufferRecord.Buffer=Out2
          Call Write.Record(MonTalkFile,Temp!)
       Endif
    Case "C"
       If RT$(279,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Temp3!=Lof(MonTalkFile)/MonTalkRecLen
          Strng="Response number to change"
          Call Get.Record.Range2(1!,Temp3!,Temp!)
          Call Read.Record(MonTalkFile,Temp!)
          Out2=Rtrim$(BufferRecord.Buffer)
          If Left$(Out2,1)=Chr$(34) Then
             Strng="Not a monster response."
             Call IO.O
          Else
             Strng="Enter response:"
             Call IO.O
             Strng="?"
             Call IO.I
             BufferRecord.Buffer=Out2
             Call Write.Record(MonTalkFile,Temp!)
             Strng="Response number "+Mid$(Str$(Temp!),2)+" changed."
             Call IO.O
          Endif
       Endif
    Case "L"
       If RT$(280,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Allow.Break=True
          Break=False
          Continuous=False
          Temp5=False
          For Temp!=1! To Lof(MonTalkFile)/MonTalkRecLen
             Call Read.Record(MonTalkFile,Temp!)
             Graphics.Off=True
             Out2=Rtrim$(BufferRecord.Buffer)
             If Left$(Out2,1)<>Chr$(34) Then
                Strng="Response number"+Str$(Temp!)+":"
                Call IO.O
                Strng=Out2
                Call IO.O
                If Break Then
                   Exit For
                Endif
                Temp5=Temp5+2
                If Temp5>=User.Pagelength-2 Then
                   Temp5=False
                   If Continuous=False Then
                      Call More.Prompt
                      If No Or Quit Then
                         Exit For
                      Endif
                   Endif
                Endif
             Endif
          Next
          Allow.Break=False
          Break=False
          If Temp5 Then
             Call More.Prompt
          Endif
       Endif
    Case "N"
       If RT$(281,"[N]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Nonplayer
          If Temp5! Then
             Call Read.Record(NonplayerFile,Temp5!)
             Strng="Enter five response numbers:"
             Call IO.O
             Strng="Press "+Enter$+" for none."
             Call IO.O
             Temp3!=Lof(MonTalkFile)/MonTalkRecLen
             For Temp5=1 To MaxMonTalk
                Strng="Enter response number "+Mid$(Str$(Temp5),2)+":"
                Call IO.O
                Strng="Range"
                Call Get.Record.Range2(SFalse,Temp3!,Temp2!)
                If Temp2!>SFalse Then
                   Call Read.Record(MonTalkFile,Temp2!)
                   Out2=Rtrim$(BufferRecord.Buffer)
                   If Left$(Out2,1)=Chr$(34) Then
                      Strng="Not a monster response."
                      Call IO.O
                   Else
                      MonsterRecord.Talk(Temp5)=Temp2!
                   Endif
                Else
                   MonsterRecord.Talk(Temp5)=SFalse
                Endif
             Next
             Call Write.Record(NonplayerFile,Temp5!)
             Strng="Nonplayer response numbers changed."
             Call IO.O
          Endif
       Endif
    Case "P"
       If Local.Mode Then
          Strng="Printer port(1-3)? "
          Call IO.I
          VarP=Int(Val(Out2)+.5)
          If VarP>=1 And VarP<=3 Then
             Close #TempFile1
             VarP$="LPT"+Mid$(Str$(VarP),2)+":"
             Open VarP$ For Output As #TempFile1
             Temp5=False
             For Temp!=1! To Lof(MonTalkFile)/MonTalkRecLen
                Call Read.Record(MonTalkFile,Temp!)
                Out2=Rtrim$(BufferRecord.Buffer)
                If Left$(Out2,1)<>Chr$(34) Then
                   Strng="Response number"+Str$(Temp!)+":"
                   Print #TempFile1,Strng
                   Strng=Out2
                   Print #TempFile1,Strng
                   Temp5=Temp5+2
                   If Temp5>=58 Then
                      Temp5=False
                      Print #TempFile1,Chr$(12);
                   Endif
                Endif
             Next
             If Temp5 Then
                Print #TempFile1,Chr$(12);
             Endif
          Endif
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
ErrExit44:
 Exit Sub
ErrResume44:
 Resume ErrExit44
End Sub

Sub Find.Nonplayer
 On Local Error Goto ErrResume106
 Temp5!=SFalse
 Strng="Nonplayer name, or number"
 Strng=Strng+"(1-"+Mid$(Str$(Lof(NonPlayerFile)/NonPlayerRecLen),2)+")? "
 No.Input.Out="1"
 Call IO.I
 If Out2=Nul Then
    Exit Sub
 Endif
 Temp7!=SFalse
 Out2=Lcase$(Out2)
 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(NonPlayerFile)/NonPlayerRecLen
    Call Read.Record(NonPlayerFile,Var2!)
    Strng=Rtrim$(MonsterRecord.MonsterName)
    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)+.5)
 If Var2!<=SFalse Or Var2!>Lof(NonPlayerFile)/NonPlayerRecLen Then
    Var2!=SFalse
    Strng="Nonplayer name not found."
    Call IO.O
 Else
    Call Read.Record(NonPlayerFile,Var2!)
 Endif
Exit106:
 Temp5!=Var2!
ErrExit106:
 Exit Sub
ErrResume106:
 Resume ErrExit106
End Sub

Sub Delete.List.Node(VarZ!)
 On Local Error Goto ErrorTrp32a
 Call Read.Record(NonplayerFile,Temp5!)
 If MonsterRecord.First=VarZ! Then
    Call Read.Record(MonInvFile,VarZ!)
    MonsterRecord.First=MessWorkRecord6.Next
    Call Write.Record(NonplayerFile,Temp5!)
    If MonsterRecord.First>SFalse Then
       Call Read.Record(MonInvFile,MonsterRecord.First)
       MessWorkRecord6.Prev=SFalse
       Call Write.Record(MonInvFile,MonsterRecord.First)
    Endif
 Else
    If MonsterRecord.Last=VarZ! Then
       Call Read.Record(MonInvFile,VarZ!)
       MonsterRecord.Last=MessWorkRecord6.Prev
       Call Write.Record(NonplayerFile,Temp5!)
       If MonsterRecord.Last>SFalse Then
          Call Read.Record(MonInvFile,MonsterRecord.Last)
          MessWorkRecord6.Next=SFalse
          Call Write.Record(MonInvFile,MonsterRecord.Last)
       Endif
    Else
       Call Read.Record(MonInvFile,VarZ!)
       Previous.Node!=MessWorkRecord6.Prev
       Next.Node!=MessWorkRecord6.Next
       Call Read.Record(MonInvFile,Previous.Node!)
       MessWorkRecord6.Next=Next.Node!
       Call Write.Record(MonInvFile,Previous.Node!)
       Call Read.Record(MonInvFile,Next.Node!)
       MessWorkRecord6.Prev=Previous.Node!
       Call Write.Record(MonInvFile,Next.Node!)
    Endif
 Endif
ErrorRsm32a:
 Exit Sub
ErrorTrp32a:
 Resume ErrorRsm32a
End Sub

Sub Display.Nonplayer(TempX,Var)
 On Local Error Goto ErrResume111
 If TempX Then
    If TempC Then
       Exit Sub
    Endif
 Endif
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="Nonplayer number"+Str$(Temp5!)+":"
 Call IO.O
 Graphics.Off=True
 Case 2
 If TempX Then
    Strng=RT$(251,"[A]")
 Endif
 Strng=Strng+"Nonplayer name: "+Rtrim$(MonsterRecord.MonsterName)
 Call IO.O
 Case 3
 If TempX Then
    Strng=RT$(252,"[B]")
 Endif
 Strng=Strng+"Nonplayer rooms: "+MonsterRecord.PluralName
 Call IO.O
 Case 4
 If TempX Then
    Strng=RT$(253,"[C]")
 Endif
 Strng=Strng+"Nonplayer level: "+Form$(Cdbl(MonsterRecord.Level))
 Call IO.O
 Case 5
 If TempX Then
    Strng=RT$(254,"[D]")
 Endif
 Strng=Strng+"Hit points: "+Form$(Cdbl(MonsterRecord.Hits))
 Call IO.O
 Case 6
 If TempX Then
    Strng=RT$(255,"[E]")
 Endif
 If Instr(Str$(MonsterRecord.Experience),"D") Then
    Strng=Strng+"Experience points:"+Str$(MonsterRecord.Experience)
 Else
    Strng=Strng+"Experience points: "+Form$(MonsterRecord.Experience)
 Endif
 Call IO.O
 Case 7
 If TempX Then
    Strng=RT$(256,"[F]")
 Endif
 Strng=Strng+"Poisonous nonplayer: "
 If MonsterRecord.Poison Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.PoisonPercent),2)+" percent)"
 Call IO.O
 Case 8
 If TempX Then
    Strng=RT$(257,"[G]")
 Endif
 Strng=Strng+"Level draining nonplayer: "
 If MonsterRecord.LevelDrain Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.DrainPercent),2)+" percent)"
 Call IO.O
 Case 9
 If TempX Then
    Strng=RT$(258,"[H]")
 Endif
 Strng=Strng+"Nonplayer blocks exits: "
 If MonsterRecord.Block Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.BlockPercent),2)+" percent)"
 Call IO.O
 Case 10
 If TempX Then
    Strng=RT$(259,"[I]")
 Endif
 Strng=Strng+"Nonplayer prevents treasure take: "
 If MonsterRecord.Prevent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.PreventPercent),2)+" percent)"
 Call IO.O
 Case 11
 If TempX Then
    Strng=RT$(260,"[J]")
 Endif
 Strng=Strng+"Nonplayer follows user: "
 If MonsterRecord.Follow Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.FollowPercent),2)+" percent) "+ _
 "("+Mid$(Str$(MonsterRecord.TeleportPercent),2)+"% teleport)"
 Call IO.O
 Case 12
 If TempX Then
    Strng=RT$(261,"[K]")
 Endif
 Strng=Strng+"Nonplayer casts spells: "
 If MonsterRecord.Spell=SFalse Then
    Strng=Strng+"No"
 Else
    Call Read.Record(SpellFile,MonsterRecord.Spell)
    Strng=Strng+"Yes, "+Rtrim$(SpellRecord.SpellName)
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.SpellPercent),2)+" percent)"
 Call IO.O
 Case 13
 If TempX Then
    Strng=RT$(262,"[L]")
 Endif
 Strng=Strng+"Nonplayer jails attacker: "
 If MonsterRecord.Jail Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 14
 If TempX Then
    Strng=RT$(264,"[M]")
 Endif
 Strng=Strng+"Encounter rate:"+Str$(MonsterRecord.Rate)+ _
 " ("+Mid$(Str$(MonsterRecord.RatePercent),2)+" percent)"
 Call IO.O
 Case 15
 If TempX Then
    Strng=RT$(265,"[N]")
 Endif
 Strng=Strng+"Nonplayer uses psionics: "
 If MonsterRecord.Psionic=False Then
    Strng=Strng+"No"
 Else
    Call Read.Record(SpellFile,MonsterRecord.PsionicSpell)
    Strng=Strng+"Yes, "+SpellRecord.SpellName
 Endif
 Call IO.O
 Case 16
 If TempX Then
    Strng=RT$(266,"[O]")+"Edit inventory:"
 Else
    Strng="Inventory:"
 Endif
 Temp3!=SFalse
 Temp2!=MonsterRecord.First
 If Temp2! Then
    Do While Lost.Carrier=False
       Call Read.Record(MonInvFile,Temp2!)
       Temp6!=MessWorkRecord6.Next
       VarX!=MessWorkRecord6.User
       If VarX! Then
          Temp3!=Temp3!+1!
       Endif
       If Temp6!=SFalse Then
          Exit Do
       Endif
       Temp2!=Temp6!
    Loop
 Endif
 Strng=Strng+Str$(Temp3!)+" items."
 Call IO.O
 Case 18
 If TempX Then
    Strng=RT$(267,"[P]")
 Endif
 Strng=Strng+"Nonplayer has attack equation: "
 If MonsterRecord.Equation Then
    Strng=Strng+"Yes: "
    Out2=MonsterRecord.MonsterEquate
    Out2=Rtrim$(Out2)
    Strng=Strng+Out2
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 If TempX=False Then
    Strng=Strng+"Nonplayer has surprise equation: "
    Out2=Rtrim$(MonsterRecord.MonsterSurprise)
    If Len(Out2) Then
       Strng=Strng+"Yes: "+Out2
    Else
       Strng=Strng+"No"
    Endif
    Call IO.O
    Strng=Strng+"Nonplayer has saving throw equation: "
    Out2=Rtrim$(MonsterRecord.MonsterSavingThrow)
    If Len(Out2) Then
       Strng=Strng+"Yes: "+Out2
    Else
       Strng=Strng+"No"
    Endif
    Call IO.O
 Endif
 Case 19
 If TempX Then
    Strng=RT$(268,"[R]")
 Endif
 Strng=Strng+"ANSI prefix code: "
 If Rtrim$(MonsterRecord.Prefix1)=Nul Then
    Strng=Strng+"<none>"
 Else
    Strng=Strng+Rtrim$(MonsterRecord.Prefix1)
 Endif
 Call IO.O
 Case 20
 If TempX Then
    Strng=RT$(269,"[S]")
 Endif
 Strng=Strng+"Armament: "
 Strng2=Nul
 If MonsterRecord.Weapon Then
    Call Read.Record(TreasureFile,MonsterRecord.Weapon)
    Strng2=Strng2+Lcase$(Rtrim$(TreasureRecord.TreasureName))+", "
 Endif
 If MonsterRecord.Shield Then
    Call Read.Record(TreasureFile,MonsterRecord.Shield)
    Strng2=Strng2+Lcase$(Rtrim$(TreasureRecord.TreasureName))+", "
 Endif
 If MonsterRecord.Armor Then
    Call Read.Record(TreasureFile,MonsterRecord.Armor)
    Strng2=Strng2+Lcase$(Rtrim$(TreasureRecord.TreasureName))+", "
 Endif
 If Len(Strng2) Then
    Strng2=Left$(Strng2,Len(Strng2)-2)
 Endif
 If Strng2=Nul Then
    Strng=Strng+"<none>"
 Else
    Strng=Strng+Strng2
 Endif
 Call IO.O
 Case 21
 If TempX Then
    Strng=RT$(204,"[T]")
 Endif
 If Instr(Str$(MonsterRecord.Gold),"D") Then
    Strng=Strng+"Gold:"+Str$(MonsterRecord.Gold)
 Else
    Strng=Strng+"Gold: "+Form$(MonsterRecord.Gold)
 Endif
 Call IO.O
 End Select
ErrExit111:
 Exit Sub
ErrResume111:
 Resume ErrExit111
End Sub

Sub Print.Nonplayer(Var)
 On Local Error Goto ErrResume111a
 Select Case Var
 Case 1
 Strng="Nonplayer number"+Str$(Temp5!)+":"
 Print #TempFile1,Strng
 Case 2
 Strng=Nul
 Strng=Strng+"Nonplayer name: "+Rtrim$(MonsterRecord.MonsterName)
 Print #TempFile1,Strng
 Case 3
 Strng=Nul
 Strng=Strng+"Nonplayer rooms: "+MonsterRecord.PluralName
 Print #TempFile1,Strng
 Case 4
 Strng=Nul
 Strng=Strng+"Nonplayer level: "+Form$(Cdbl(MonsterRecord.Level))
 Print #TempFile1,Strng
 Case 5
 Strng=Nul
 Strng=Strng+"Hit points: "+Form$(Cdbl(MonsterRecord.Hits))
 Print #TempFile1,Strng
 Case 6
 Strng=Nul
 If Instr(Str$(MonsterRecord.Experience),"D") Then
    Strng=Strng+"Experience points:"+Str$(MonsterRecord.Experience)
 Else
    Strng=Strng+"Experience points: "+Form$(MonsterRecord.Experience)
 Endif
 Print #TempFile1,Strng
 Case 7
 Strng=Nul
 Strng=Strng+"Poisonous nonplayer: "
 If MonsterRecord.Poison Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.PoisonPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 8
 Strng=Nul
 Strng=Strng+"Level draining nonplayer: "
 If MonsterRecord.LevelDrain Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.DrainPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 9
 Strng=Nul
 Strng=Strng+"Nonplayer blocks exits: "
 If MonsterRecord.Block Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.BlockPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 10
 Strng=Nul
 Strng=Strng+"Nonplayer prevents treasure take: "
 If MonsterRecord.Prevent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.PreventPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 11
 Strng=Nul
 Strng=Strng+"Nonplayer follows user: "
 If MonsterRecord.Follow Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.FollowPercent),2)+" percent) "+ _
 "("+Mid$(Str$(MonsterRecord.TeleportPercent),2)+"% teleport)"
 Print #TempFile1,Strng
 Case 12
 Strng=Nul
 Strng=Strng+"Nonplayer casts spells: "
 If MonsterRecord.Spell=SFalse Then
    Strng=Strng+"No"
 Else
    Call Read.Record(SpellFile,MonsterRecord.Spell)
    Strng=Strng+"Yes, "+Rtrim$(SpellRecord.SpellName)
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.SpellPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 13
 Strng=Nul
 Strng=Strng+"Nonplayer jails attacker: "
 If MonsterRecord.Jail Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 14
 Strng=Nul
 Strng=Strng+"Encounter rate:"+Str$(MonsterRecord.Rate)+ _
 " ("+Mid$(Str$(MonsterRecord.RatePercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 15
 Strng=Nul
 Strng=Strng+"Nonplayer uses psionics: "
 If MonsterRecord.Psionic=False Then
    Strng=Strng+"No"
 Else
    Call Read.Record(SpellFile,MonsterRecord.PsionicSpell)
    Strng=Strng+"Yes, "+SpellRecord.SpellName
 Endif
 Print #TempFile1,Strng
 Case 16
 Strng=Nul
 Strng="Inventory:"
 Temp3!=SFalse
 Temp2!=MonsterRecord.First
 If Temp2! Then
    Do While Lost.Carrier=False
       Call Read.Record(MonInvFile,Temp2!)
       Temp6!=MessWorkRecord6.Next
       VarX!=MessWorkRecord6.User
       If VarX! Then
          Temp3!=Temp3!+1!
       Endif
       If Temp6!=SFalse Then
          Exit Do
       Endif
       Temp2!=Temp6!
    Loop
 Endif
 Strng=Strng+Str$(Temp3!)+" items."
 Print #TempFile1,Strng
 Case 18
 Strng=Nul
 Strng=Strng+"Nonplayer has attack equation: "
 If MonsterRecord.Equation Then
    Strng=Strng+"Yes: "
    Out2=MonsterRecord.MonsterEquate
    Out2=Rtrim$(Out2)
    Strng=Strng+Out2
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 End Select
ErrExit111a:
 Exit Sub
ErrResume111a:
 Resume ErrExit111a
End Sub

Sub Add.List.Node1(VarZ!)
 On Local Error Goto ErrorTrp27b
 If MonsterRecord.First=SFalse Then
    MonsterRecord.First=VarZ!
    MonsterRecord.Last=VarZ!
    Call Write.Record(MonsterFile,Temp5!)
    MessWorkRecord6.Prev=SFalse
    MessWorkRecord6.Next=SFalse
    Call Write.Record(MonInvFile,VarZ!)
    Exit Sub
 Endif
 MessWorkRecord6.Prev=MonsterRecord.Last
 MessWorkRecord6.Next=SFalse
 Call Write.Record(MonInvFile,VarZ!)
 Call Read.Record(MonInvFile,MonsterRecord.Last)
 MessWorkRecord6.Next=VarZ!
 Call Write.Record(MonInvFile,MonsterRecord.Last)
 Call Read.Record(MonInvFile,VarZ!)
 MonsterRecord.Last=VarZ!
 Call Write.Record(MonsterFile,Temp5!)
ErrorRsm27b:
 Exit Sub
ErrorTrp27b:
 Resume ErrorRsm27b
End Sub

Sub Add.List.Node2(VarZ!)
 On Local Error Goto ErrorTrp27c
 If MonsterRecord.First=SFalse Then
    MonsterRecord.First=VarZ!
    MonsterRecord.Last=VarZ!
    Call Write.Record(NonplayerFile,Temp5!)
    MessWorkRecord6.Prev=SFalse
    MessWorkRecord6.Next=SFalse
    Call Write.Record(MonInvFile,VarZ!)
    Exit Sub
 Endif
 MessWorkRecord6.Prev=MonsterRecord.Last
 MessWorkRecord6.Next=SFalse
 Call Write.Record(MonInvFile,VarZ!)
 Call Read.Record(MonInvFile,MonsterRecord.Last)
 MessWorkRecord6.Next=VarZ!
 Call Write.Record(MonInvFile,MonsterRecord.Last)
 Call Read.Record(MonInvFile,VarZ!)
 MonsterRecord.Last=VarZ!
 Call Write.Record(NonplayerFile,Temp5!)
ErrorRsm27c:
 Exit Sub
ErrorTrp27c:
 Resume ErrorRsm27c
End Sub
