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

Sub Edit.Monster
 On Local Error Goto ErrResume35
 Call Edit.Status.Line
 Do While Lost.Carrier=False
    If TempC=False Then
       Graphics.Off=False
       Strng="Monster Edit utility v"+Left$(Version$,4)+" menu:"
       Call IO.O
       Graphics.Off=True
       Strng=RT$(176,"[A]")+"dd"
       Call IO.O
       Strng=RT$(177,"[C]")+"hange"
       Call IO.O
       Strng=RT$(178,"[L]")+"ist"
       Call IO.O
       Strng=RT$(179,"[P]")+"ack"
       Call IO.O
       Strng=RT$(180,"[R]")+"epair"
       Call IO.O
       Strng=RT$(181,"[S]")+"earch"
       Call IO.O
       Strng=RT$(182,"[M]")+"onclass"
       Call IO.O
       Strng=RT$(183,"[T]")+"alk responses"
       Call IO.O
       Strng=RT$(184,"[U]")+"ser command responses"
       Call IO.O
       If Local.Mode Then
          Strng=RT$(586,"[V]")+"Print"
          Call IO.O
       Endif
       Graphics.Off=False
    Endif
    Strng="Monster edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(176,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Add.Monster
          Temp5!=Lof(MonsterFile)/MonsterRecLen
          Call Change.Monster
       Endif
    Case "C"
       If RT$(177,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Monster(0)
          If Temp5! Then
             Call Change.Monster
          Endif
       Endif
    Case "L"
       If RT$(178,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call List.Monster
       Endif
    Case "P"
       If RT$(179,"[P]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Pack.Monsters
       Endif
    Case "R"
       If RT$(180,"[R]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Repair.Monsters(True)
       Endif
    Case "S"
       If RT$(181,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Search.Monsters
       Endif
    Case "M"
       If RT$(182,"[M]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Edit.Monclass
       Endif
    Case "T"
       If RT$(183,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Edit.MonsterTalk
       Endif
    Case "U"
       If RT$(184,"[U]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Edit.Command
       Endif
    Case "V"
       If Local.Mode Then
          If RT$(586,"[V]")="[*]" Then
             Strng="Command restricted.."
             Call IO.O
          Else
             Call Print.Monsters
          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
ErrExit35:
 Exit Sub
ErrResume35:
 Resume ErrExit35
End Sub

Sub Add.Monster
 On Local Error Goto ErrResume36
 Temp5!=Lof(MonsterFile)/MonsterRecLen+1!
 MonsterRecord.MonsterName=Nul
 MonsterRecord.PluralName=Nul
 MonsterRecord.Experience=False
 MonsterRecord.Gold=False
 MonsterRecord.NumberAppearing=False
 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=False
 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=False
 MonsterRecord.RemainsInRoom=False
 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(MonsterFile,Temp5!)
 UserRecord.ObjectsCreated(3)=UserRecord.ObjectsCreated(3)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
ErrExit36:
 Exit Sub
ErrResume36:
 Resume ErrExit36
End Sub

Sub List.Monster
 On Local Error Goto ErrResume37
 Temp3!=Lof(MonsterFile)/MonsterRecLen
 Call Get.Record.Range(Temp!,Temp2!,Temp3!)
 Allow.Break=True
 Break=False
 Continuous=False
 For Temp5!=Temp! To Temp2!
    Call Read.Record(MonsterFile,Temp5!)
    For VarQ=1 To 24
       Call Display.Monster(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
ErrExit37:
 Exit Sub
ErrResume37:
 Resume ErrExit37
End Sub

Sub Print.Monsters
 On Local Error Goto ErrResume37a
 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(MonsterFile)/MonsterRecLen
    Call Get.Record.Range(Temp!,Temp2!,Temp3!)
    For Temp5!=Temp! To Temp2!
       Call Read.Record(MonsterFile,Temp5!)
       For VarQ=1 To 22
          Call Print.Monster(VarQ)
       Next
       Print #TempFile1,Chr$(12);
    Next
 Endif
ErrExit37a:
 Close #TempFile1
 Exit Sub
ErrResume37a:
 Resume ErrExit37a
End Sub

Sub Change.Monster
 On Local Error Goto ErrResume38
 Call Read.Record(MonsterFile,Temp5!)
 Do While Lost.Carrier=False
    Allow.Break=True
    Break=False
    Call Write.Record(MonsterFile,Temp5!)
    For VarQ=1 To 24
       Call Display.Monster(True,VarQ)
       If Break Then
          Exit For
       Endif
    Next
    Allow.Break=False
    Break=False
    Graphics.Off=False
    Strng="Monster change option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(185,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster 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$(186,"[B]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Plural of name(30 characters):"
          Call IO.O
          Strng="?"
          No.Input.Out=Nul
          Call IO.I
          Out2=Lcase$(Out2)
          MonsterRecord.PluralName=Out2
       Endif
    Case "C"
       If RT$(187,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster level(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2))>=1 And Int(Val(Out2))<=32767 Then
             MonsterRecord.Level=Int(Val(Out2))
          Endif
       Endif
    Case "D"
       If RT$(188,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Magical monster(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Magic=Yes
       Endif
    Case "E"
       If RT$(189,"[E]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Hit points(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2))>=1 And Int(Val(Out2))<=32767 Then
             MonsterRecord.Hits=Int(Val(Out2))
          Endif
       Endif
    Case "F"
       If RT$(190,"[F]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Experience points(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2))>=1 And Int(Val(Out2))<=32767 Then
             MonsterRecord.Experience=Int(Val(Out2))
          Endif
       Endif
    Case "G"
       If RT$(191,"[G]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Number appearing(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2))>=1 And Int(Val(Out2))<=32767 Then
             MonsterRecord.NumberAppearing=Int(Val(Out2))
          Endif
       Endif
    Case "H"
       If RT$(192,"[H]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Poisonous monster(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 monster will poison(1-100)? "
             No.Input.Out="50"
             Call IO.I
             MonsterRecord.PoisonPercent=Int(Val(Out2))
          Endif
       Endif
    Case "I"
       If RT$(193,"[I]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Level draining monster(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 monster will level drain(1-100)? "
             No.Input.Out="50"
             Call IO.I
             MonsterRecord.DrainPercent=Int(Val(Out2))
          Endif
       Endif
    Case "J"
       If RT$(194,"[J]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster 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 monster will block exits(1-100)? "
             No.Input.Out="50"
             Call IO.I
             MonsterRecord.BlockPercent=Int(Val(Out2))
          Endif
       Endif
    Case "K"
       If RT$(195,"[K]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster prevents user from 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 monster prevents user taking treasure(1-100)? "
             No.Input.Out="50"
             Call IO.I
             MonsterRecord.PreventPercent=Int(Val(Out2))
          Endif
       Endif
    Case "L"
       If RT$(196,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster 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 monster will follow user(1-100)? "
             No.Input.Out="50"
             Call IO.I
             MonsterRecord.FollowPercent=Int(Val(Out2))
             Strng="Percent chance monster will teleport with user(1-100)? "
             No.Input.Out="50"
             Call IO.I
             MonsterRecord.TeleportPercent=Int(Val(Out2))
          Endif
       Endif
    Case "M"
       If RT$(197,"[M]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster 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 monster casts spell(1-100)? "
                No.Input.Out="50"
                Call IO.I
                MonsterRecord.SpellPercent=Int(Val(Out2))
             Endif
          Endif
       Endif
    Case "N"
       If RT$(198,"[N]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster jails attacker(y/n)? "
          Line.Length=TempD
          No.Input.Out="Y"
          Call IO.I
          MonsterRecord.Jail=Yes
       Endif
    Case "O"
       If RT$(199,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster encounter rate(# of action prompts)? "
          No.Input.Out="6"
          Call IO.I
          MonsterRecord.Rate=Int(Val(Out2))
          Strng="Monster encounter percent(1-100)? "
          No.Input.Out="50"
          Call IO.I
          MonsterRecord.RatePercent=Int(Val(Out2))
       Endif
    Case "P"
       If RT$(200,"[P]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster is permanent(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          MonsterRecord.Permanent=Yes
          Strng="Monster is invisible(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          MonsterRecord.Invisible=Yes
          Strng="Monster remains in room(y/n)? "
          Line.Length=TempD
          No.Input.Out="N"
          Call IO.I
          MonsterRecord.RemainsInRoom=Yes
       Endif
    Case "R"
       If RT$(201,"[R]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Monster 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 "S"
       If RT$(202,"[S]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Edit.Mon.Inventory
       Endif
    Case "T"
       If RT$(203,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Monster has attack equation(y/n)? "
          Call IO.I
          MonsterRecord.Equation=False
          MonsterRecord.MonsterEquate=Nul
          If Yes Then
             Strng="Enter monster attack equation:"
             Call IO.I
             MonsterRecord.Equation=True
             MonsterRecord.MonsterEquate=Ucase$(Out2)
          Endif
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Monster has surprise equation(y/n)? "
          Call IO.I
          MonsterRecord.MonsterSurprise=Nul
          If Yes Then
             Strng="Enter monster surprise equation:"
             Call IO.I
             MonsterRecord.MonsterSurprise=Ucase$(Out2)
          Endif
          Line.Length=TempD
          No.Input.Out="Y"
          Strng="Monster has saving throw equation(y/n)? "
          Call IO.I
          MonsterRecord.MonsterSavingThrow=Nul
          If Yes Then
             Strng="Enter monster saving throw equation:"
             Call IO.I
             MonsterRecord.MonsterSavingThrow=Ucase$(Out2)
          Endif
       Endif
    Case "U"
       If RT$(204,"[U]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Gold points(1-32767)? "
          No.Input.Out="1"
          Call IO.I
          If Int(Val(Out2))>=1 And Int(Val(Out2))<=32767 Then
             MonsterRecord.Gold=Int(Val(Out2))
          Endif
          Strng="Reset kills counter(y/n)? "
          No.Input.Out="N"
          Call IO.I
          If Yes Then
              MonsterRecord.Buffer15=0
              MonsterRecord.Buffer16=0
          Endif
       Endif
    Case "V"
       If RT$(205,"[V]")="[*]" 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 "W"
       If RT$(206,"[A]")="[*]" 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 "X"
       If RT$(207,"[X]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             If TempC=False Then
                Graphics.Off=False
                Strng="Monster talk rewards menu:
                Call IO.O
                Graphics.Off=True
                Strng=RT$(208,"[M]")+"onster reward"
                Call IO.O
                Strng=RT$(209,"[E]")+"ncounter reward"
                Call IO.O
                Strng=RT$(210,"[N]")+"one"
                Call IO.O
             Endif
             Graphics.Off=False
             Strng="Monster rewards edit option(q to quit)? "
             Line.Length=TempD
             No.Input.Out="Q"
             Call IO.I
             Select Case Ucase$(Out2)
             Case "N"
                If RT$(210,"[N]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   MonsterRecord.PerMonster=0
                   MonsterRecord.TalkGold=0
                   MonsterRecord.TalkGoldTimes=0
                   MonsterRecord.TalkGoldPercent=0
                   MonsterRecord.TalkItem=0
                   MonsterRecord.TalkItemTimes=0
                   MonsterRecord.TalkItemPercent=0
                   MonsterRecord.TalkMoveDirection=0
                   Strng="Monster rewards reset."
                   Call IO.O
                Endif
             Case "M", "E"
                Var=False
                If Ucase$(Out2)="M" Then
                   If RT$(208,"[M]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Var=1
                   Endif
                Endif
                If Ucase$(Out2)="E" Then
                   If RT$(209,"[E]")="[*]" Then
                      Strng="Command restricted.."
                      Call IO.O
                   Else
                      Var=2
                   Endif
                Endif
                If Var Then
                   If Var=1 Then
                      Var2=211
                   Else
                      Var2=218
                   Endif
                   MonsterRecord.PerMonster=Var
                   Do While Lost.Carrier=False
                      Graphics.Off=True
                      If TempC=False Then
                         Strng=RT$(Var2,"[1]")+"Talk Gold:"
                         Strng=Strng+Str$(MonsterRecord.TalkGold)
                         Call IO.O
                         Strng=RT$(Var2+1,"[2]")+"Talk Gold Count:"
                         If MonsterRecord.TalkGoldTimes=-1 Then
                            Strng=Strng+" (unlimited)"
                         Else
                            Strng=Strng+Str$(MonsterRecord.TalkGoldTimes)
                         Endif
                         Call IO.O
                         Strng=RT$(Var2+2,"[3]")+"Talk Gold Percent:"
                         Strng=Strng+Str$(MonsterRecord.TalkGoldPercent)
                         Call IO.O
                         Strng=RT$(Var2+3,"[4]")+"Talk Item:"
                         Temp!=MonsterRecord.TalkItem
                         If Temp!>SFalse And Temp!<=Lof(TreasureFile)/TreasureRecLen Then
                            Call Read.Record(TreasureFile,Temp!)
                            Out3=TreasureRecord.TreasureName
                            Out3=Lcase$(Out3)
                            Strng=Strng+" "+Out3
                         Else
                            Strng=Strng+" (none)"
                         Endif
                         Call IO.O
                         Strng=RT$(Var2+4,"[5]")+"Talk Item Count:"
                         If MonsterRecord.TalkItemTimes=-1 Then
                            Strng=Strng+" (unlimited)"
                         Else
                            Strng=Strng+Str$(MonsterRecord.TalkItemTimes)
                         Endif
                         Call IO.O
                         Strng=RT$(Var2+5,"[6]")+"Talk Item Percent:"
                         Strng=Strng+Str$(MonsterRecord.TalkItemPercent)
                         Call IO.O
                         Strng=RT$(Var2+6,"[7]")+"Talk Move Direction:"
                         If MonsterRecord.TalkMoveDirection Then
                            Select Case MonsterRecord.TalkmoveDirection
                            Case 1
                               Strng=Strng+" north"
                            Case 2
                               Strng=Strng+" east"
                            Case 3
                               Strng=Strng+" south"
                            Case 4
                               Strng=Strng+" west"
                            Case 5
                               Strng=Strng+" northeast"
                            Case 6
                               Strng=Strng+" southeast"
                            Case 7
                               Strng=Strng+" southwest"
                            Case 8
                               Strng=Strng+" northwest"
                            Case 9
                               Strng=Strng+" up"
                            Case 10
                               Strng=Strng+" down"
                            Case 11
                               Strng=Strng+" in"
                            Case 12
                               Strng=Strng+" out"
                            Case 13
                               Strng=Strng+" (custom1)"
                            Case 14
                               Strng=Strng+" (custom2)"
                            Case -1
                               Strng=Strng+" (random)"
                            End Select
                         Else
                            Strng=Strng+" (none)"
                         Endif
                         Call IO.O
                         Graphics.Off=False
                      Endif
                      Strng="Monster reward edit option(q to quit)? "
                      Line.Length=TempD
                      No.Input.Out="Q"
                      Call IO.I
                      Select Case Ucase$(Out2)
                      Case "1"
                         If RT$(Var2,"[1]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Talk Gold?"
                            Call IO.I
                            MonsterRecord.TalkGold=Int(Val(Out2))
                         Endif
                      Case "2"
                         If RT$(Var2+1,"[2]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Talk Gold Times(-1=unlimited)?"
                            Call IO.I
                            If Int(Val(Out2))=-1 Then
                               MonsterRecord.TalkGoldTimes=-1
                            Else
                               If Int(Val(Out2))>=0 Then
                                  MonsterRecord.TalkGoldTimes=Int(Val(Out2))
                               Endif
                            Endif
                         Endif
                      Case "3"
                         If RT$(Var2+2,"[3]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Talk Gold Percent?"
                            Call IO.I
                            Var3=Int(Val(Out2))
                            If Var3>=0 And Var3<=100 Then
                               MonsterRecord.TalkGoldPercent=Var3
                            Endif
                         Endif
                      Case "4"
                         If RT$(Var2+3,"[4]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Call Find.Treasure
                            MonsterRecord.TalkItem=TempC!
                         Endif
                      Case "5"
                         If RT$(Var2+4,"[5]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Talk Item Times(-1=unlimited)?"
                            Call IO.I
                            If Int(Val(Out2))=-1 Then
                               MonsterRecord.TalkItemTimes=-1
                            Else
                               If Int(Val(Out2))>=0 Then
                                  MonsterRecord.TalkItemTimes=Int(Val(Out2))
                               Endif
                            Endif
                         Endif
                      Case "6"
                         If RT$(Var2+5,"[6]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Talk Gold Percent?"
                            Call IO.I
                            Var3=Int(Val(Out2))
                            If Var3>=0 And Var3<=100 Then
                               MonsterRecord.TalkItemPercent=Var3
                            Endif
                         Endif
                      Case "7"
                         If RT$(Var2+6,"[7]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Direction(N,E,S,W,NE,SE,SW,NW,U,D,I,O,1,2,-1=random)? "
                            Call IO.I
                            Temp7=False
                            Select Case Ucase$(Out2)
                            Case "N"
                               Temp7=1
                            Case "E"
                               Temp7=2
                            Case "S"
                               Temp7=3
                            Case "W"
                               Temp7=4
                            Case "NE"
                               Temp7=5
                            Case "SE"
                               Temp7=6
                            Case "SW"
                               Temp7=7
                            Case "NW"
                               Temp7=8
                            Case "U"
                               Temp7=9
                            Case "D"
                               Temp7=10
                            Case "I"
                               Temp7=11
                            Case "O"
                               Temp7=12
                            Case "1"
                               Temp7=13
                            Case "2"
                               Temp7=14
                            Case "-1"
                               Temp7=-1
                            Case Else
                               Temp7=False
                            End Select
                            MonsterRecord.TalkMoveDirection=Temp7
                         Endif
                      Case "Q"
                         Exit Do
                      End Select
                   Loop
                Endif
             Case "Q"
                Exit Do
             End Select
          Loop
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
 Call Write.Record(MonsterFile,Temp5!)
 Strng="Monster '"+Rtrim$(MonsterRecord.MonsterName)+"' changed."
 Call IO.O
ErrExit38:
 Exit Sub
ErrResume38:
 Resume ErrExit38
End Sub

Sub Edit.Monclass
 On Local Error Goto ErrResume39
 If Lof(MonClassFile)=SFalse Then
    Call Add.Monclass
 Endif
 Do While Lost.Carrier=False
    Graphics.Off=True
    If TempC=False Then
       Strng=RT$(225,"[A]")+"dd class"
       Call IO.O
       Strng=RT$(226,"[C]")+"hange class"
       Call IO.O
       Strng=RT$(227,"[L]")+"ist class"
       Call IO.O
       If Local.Mode Then
          Strng="[P]rint
          Call IO.O
       Endif
       Strng="[S]earch class"
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="Monster class edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(225,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Add.Monclass
          Temp!=Lof(MonClassFile)/MonClassRecLen
          Call Change.Monclass
       Endif
    Case "C"
       If RT$(226,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Monclass
          If Temp! Then
             Call Change.Monclass
          Endif
       Endif
    Case "L"
       If RT$(227,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call List.Monclass
       Endif
    Case "P"
       If Local.Mode Then
          Call Print.Monclass
       Endif
    Case "S"
       Call Search.Monclass
    Case "Q"
       Exit Do
    End Select
 Loop
ErrExit39:
 Exit Sub
ErrResume39:
 Resume ErrExit39
End Sub

Sub Add.Monclass
 On Local Error Goto ErrResume40
 Temp!=Lof(MonClassFile)/MonClassRecLen+1!
 For Temp6=1 To MaxMonClass
    MonclassRecord.Monsters(Temp6)=SFalse
 Next
 Call Write.Record(MonClassFile,Temp!)
 UserRecord.ObjectsCreated(2)=UserRecord.ObjectsCreated(2)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
ErrExit40:
 Exit Sub
ErrResume40:
 Resume ErrExit40
End Sub

Sub Find.Monclass
 On Local Error Goto ErrResume41
 Temp2!=Lof(MonClassFile)/MonClassRecLen
 Strng="Monster class"
 Call Get.Record.Range2(SFalse,Temp2!,Temp!)
ErrExit41:
 Exit Sub
ErrResume41:
 Resume ErrExit41
End Sub

Sub Change.Monclass
 On Local Error Goto ErrResume42
 Call Read.Record(MonClassFile,Temp!)
 Strng="Enter ten monster names:"
 Call IO.O
 Strng="Press "+Enter$+" for none."
 Call IO.O
 Graphics.Off=True
 For Temp2=1 To MaxMonClass
    Call Find.Monster(-1)
    MonclassRecord.Monsters(Temp2)=TempD!
 Next
 Call Write.Record(MonClassFile,Temp!)
 Graphics.Off=False
 Strng="Monclass number"+Str$(Temp!)+" changed."
 Call IO.O
ErrExit42:
 Exit Sub
ErrResume42:
 Resume ErrExit42
End Sub

Sub List.Monclass
 On Local Error Goto ErrResume43
 Temp3!=Lof(MonClassFile)/MonClassRecLen
 Call Get.Record.Range(Temp1!,Temp2!,Temp3!)
 Allow.Break=True
 Break=False
 Continuous=False
 For Temp6!=Temp1! To Temp2!
    Call Read.Record(MonClassFile,Temp6!)
    Graphics.Off=True
    Strng="Monster class number"+Str$(Temp6!)+":"
    Call IO.O
    For Temp3=1 To MaxMonClass
       Temp5!=MonclassRecord.Monsters(Temp3)
       If Temp5! Then
          Call Read.Record(MonsterFile,Temp5!)
          Strng="Monster number"+Str$(Temp3)+": "+MonsterRecord.MonsterName
          If Temp3<10 Then
             Strng=Strng+"  :"
          Else
             Strng=Strng+" :"
          Endif
          Strng=Strng+" #("+Mid$(Str$(Temp5!),2)+")"
          Call IO.O
       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
ErrExit43:
 Exit Sub
ErrResume43:
 Resume ErrExit43
End Sub

Sub Print.Monclass
 On Local Error Goto ErrResume43a
 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(MonClassFile)/MonClassRecLen
    Call Get.Record.Range(Temp1!,Temp2!,Temp3!)
    For Temp6!=Temp1! To Temp2!
       Call Read.Record(MonClassFile,Temp6!)
       Strng="Monster class number"+Str$(Temp6!)+":"
       Print #TempFile1,Strng
       For Temp3=1 To MaxMonClass
          Temp5!=MonclassRecord.Monsters(Temp3)
          If Temp5! Then
             Call Read.Record(MonsterFile,Temp5!)
             Strng="Monster number"+Str$(Temp3)+": "+MonsterRecord.MonsterName
             If Temp3<10 Then
                Strng=Strng+"  :"
             Else
                Strng=Strng+" :"
             Endif
             Strng=Strng+" #("+Mid$(Str$(Temp5!),2)+")"
             Print #TempFile1,Strng
          Endif
       Next
       Print #TempFile1,Chr$(12);
    Next
 Endif
ErrExit43a:
 Close #TempFile1
 Exit Sub
ErrResume43a:
 Resume ErrExit43a
End Sub

Sub Search.Monclass
 On Local Error Goto ErrResume43Z
 Strng="Monster name? "
 Call IO.I
 If Out2=Nul Then
    Exit Sub
 Endif
 Temp1$=Lcase$(Out2)
 Temp3!=Lof(MonClassFile)/MonClassRecLen
 Call Get.Record.Range(Temp1!,Temp2!,Temp3!)
 Allow.Break=True
 Break=False
 Continuous=False
 VarZ1!=0!
 VarZ2!=0!
 VarZ=Instr(Temp1$,"#")
 If VarZ Then
    VarZ2!=Int(Val(Mid$(Temp1$,VarZ+1)))
    Temp1$=Left$(Temp1$,VarZ-1)
 Endif
 For Temp6!=Temp1! To Temp2!
    VarQ=False
    Call Read.Record(MonClassFile,Temp6!)
    For Temp3=1 To MaxMonClass
       TempX=False
       Temp5!=MonclassRecord.Monsters(Temp3)
       If Temp5! Then
          Call Read.Record(MonsterFile,Temp5!)
          Var$=Lcase$(Rtrim$(MonsterRecord.MonsterName))
          Call InstrSUB(VarX,Var$,Temp1$)
          If VarX Then
             VarZ1!=VarZ1!+1!
             If VarZ2!=0! Or VarZ1!=VarZ2! Then
                TempX=True
             Endif
          Endif
          If TempX Then
             If VarQ=False Then
                VarQ=True
                Graphics.Off=True
                Strng="Monster class number"+Str$(Temp6!)+":"
                Call IO.O
             Endif
             Strng="Monster number"+Str$(Temp3)+": "
             Strng=Strng+Rtrim$(MonsterRecord.MonsterName)
             Strng=Strng+" (#"+Mid$(Str$(Temp5!),2)+")"
             Call IO.O
          Endif
       Endif
    Next
    If VarQ Then
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Exit For
          Endif
       Endif
    Endif
    If Break Then
       Exit For
    Endif
 Next
 Allow.Break=False
 Break=False
ErrExit43Z:
 Exit Sub
ErrResume43Z:
 Resume ErrExit43Z
End Sub

Sub Edit.MonsterTalk
 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$(228,"[A]")+"dd response"
       Call IO.O
       Strng=RT$(229,"[C]")+"hange response"
       Call IO.O
       Strng=RT$(230,"[L]")+"ist response"
       Call IO.O
       Strng=RT$(231,"[M]")+"onster 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$(228,"[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$(229,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Temp3!=Lof(MonTalkFile)/MonTalkRecLen
          Strng="Response number to change"
          Call Get.Record.Range2(0!,Temp3!,Temp!)
          If Temp!>0! Then
             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
       Endif
    Case "L"
       If RT$(230,"[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 "M"
       If RT$(231,"[M]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Find.Monster(-1)
          If TempD! Then
             Call Read.Record(MonsterFile,TempD!)
             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(MonsterFile,TempD!)
             Strng="Monster 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))
          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 Repair.Monsters(VarK)
 On Local Error Goto ErrResume65a
 Call Search.Mess2(Var2)
 If Var2 Then
    Strng="Can't repair while node/user online."
    Call IO.O
    Exit Sub
 Endif
 If VarK Then
    Strng="Repair monster 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 monster 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 monster inventory file"
 Call IO.O
 VarD=False
 VarE=False
 VarF!=Timeit!
 Var4!=SFalse
 VarZ1!=SFalse
 For Temp1!=1! To Lof(MonsterFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(MonsterFile,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(MonsterFile)/MonsterRecLen
    VarY1!=0!
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(MonsterFile,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(MonsterFile)/MonsterRecLen
    VarY1!=0!
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(MonsterFile,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(MonsterFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(MonsterFile,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(MonsterFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(MonsterFile,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(MonsterFile)/MonsterRecLen
    Call Dot.Display(VarD,VarE,VarF!)
    Call Read.Record(MonsterFile,Temp1!)
    Temp2!=MonsterRecord.First
    If Temp2! Then
       Do
          Call Read.Record(MonInvFile,Temp2!)
          Temp6!=MessWorkRecord6.Next
          Temp3!=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="Monster 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(MonsterFile,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(MonsterFile,Temp1!)
 Return
ErrExit65a:
 Exit Sub
ErrResume65a:
 Resume ErrExit65a
End Sub

Sub Search.Monsters
 On Local Error Goto ErrResume56
 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
    Temp14=False
    Temp15=False
    Do While Lost.Carrier=False
       Graphics.Off=True
       If TempC=False Then
          Strng="[A]monster name substring"
          If Temp1$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp1$+")"
          Endif
          Call IO.O
          Strng="[B]monster 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 monsters"
          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
          Strng="[K]permanent"
          If Temp14 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Strng="[L]invisible"
          If Temp15 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"(selected)"
          Endif
          Call IO.O
          Graphics.Off=False
       Endif
       Strng="Monster 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="Monster name substring? "
          Call IO.I
          Out2=Lcase$(Out2)
          Temp1$=Out2
       Case "B"
          Strng="Monster level? "
          Call IO.I
          Temp1=Int(Val(Out2))
       Case "C"
          Strng="Enter range: "
          Call IO.O
          No.Input.Out="1"
          Strng="From? "
          Call IO.I
          Temp3=Int(Val(Out2))
          No.Input.Out="10"
          Strng="To? "
          Call IO.I
          Temp4=Int(Val(Out2))
       Case "D"
          Strng="Enter range: "
          Call IO.O
          No.Input.Out="1"
          Strng="From? "
          Call IO.I
          Temp6#=Int(Val(Out2))
          No.Input.Out="10"
          Strng="To? "
          Call IO.I
          Temp7#=Int(Val(Out2))
       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 "K"
          Temp14=True
       Case "L"
          Temp15=True
       Case "S"
          Temp5!=Lof(MonsterFile)/MonsterRecLen
          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(MonsterFile,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 Temp14 Then
                If MonsterRecord.Permanent Then
                   TempX=True
                Endif
             Endif
             If Temp15 Then
                If MonsterRecord.Invisible Then
                   TempX=True
                Endif
             Endif
             If TempX Then
                For VarQ=1 To 22
                   Call Display.Monster(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
ErrExit56:
 Exit Sub
ErrResume56:
 Resume ErrExit56
End Sub

Sub Delete.List.Node(VarZ!)
 On Local Error Goto ErrorTrp32a
 Call Read.Record(MonsterFile,Temp5!)
 If MonsterRecord.First=VarZ! Then
    Call Read.Record(MonInvFile,VarZ!)
    MonsterRecord.First=MessWorkRecord6.Next
    Call Write.Record(MonsterFile,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(MonsterFile,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.Monster(TempX,Var)
 On Local Error Goto ErrResume108
 If TempX Then
    If TempC Then
       Exit Sub
    Endif
 Endif
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="Monster number"+Str$(Temp5!)+":"
 Call IO.O
 Graphics.Off=True
 Case 2
 If TempX Then
    Strng=RT$(185,"[A]")
 Endif
 Strng=Strng+"Monster name: "+Rtrim$(MonsterRecord.MonsterName)
 If TempX=False Then
    Strng=Strng+" ("+Rtrim$(MonsterRecord.PluralName)+")"
 Endif
 Call IO.O
 Case 3
 If TempX Then
    Strng=RT$(186,"[B]")
    Strng=Strng+"Plural of monster name: "+Rtrim$(MonsterRecord.PluralName)
    Call IO.O
 Endif
 Case 4
 If TempX Then
    Strng=RT$(187,"[C]")
 Endif
 Strng=Strng+"Monster level: "+Form$(Cdbl(MonsterRecord.Level))
 Call IO.O
 Case 5
 If TempX Then
    Strng=RT$(188,"[D]")
 Endif
 Strng=Strng+"Magical monster: "
 If MonsterRecord.Magic Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 6
 If TempX Then
    Strng=RT$(189,"[E]")
 Endif
 Strng=Strng+"Hit points: "+Form$(Cdbl(MonsterRecord.Hits))
 Call IO.O
 Case 7
 If TempX Then
    Strng=RT$(190,"[F]")
 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 8
 If TempX Then
    Strng=RT$(191,"[G]")
 Endif
 Strng=Strng+"Number appearing:"+Str$(MonsterRecord.NumberAppearing)
 Call IO.O
 Case 9
 If TempX Then
    Strng=RT$(192,"[H]")
 Endif
 Strng=Strng+"Poisonous monster: "
 If MonsterRecord.Poison Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.PoisonPercent),2)+" percent)"
 Call IO.O
 Case 10
 If TempX Then
    Strng=RT$(193,"[I]")
 Endif
 Strng=Strng+"Level draining monster: "
 If MonsterRecord.LevelDrain Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.DrainPercent),2)+" percent)"
 Call IO.O
 Case 11
 If TempX Then
    Strng=RT$(194,"[J]")
 Endif
 Strng=Strng+"Monster 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 12
 If TempX Then
    Strng=RT$(195,"[K]")
 Endif
 Strng=Strng+"Monster 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 13
 If TempX Then
    Strng=RT$(196,"[L]")
 Endif
 Strng=Strng+"Monster 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 14
 If TempX Then
    Strng=RT$(197,"[M]")
 Endif
 Strng=Strng+"Monster 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 15
 If TempX Then
    Strng=RT$(198,"[N]")
 Endif
 Strng=Strng+"Monster jails attacker: "
 If MonsterRecord.Jail Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Call IO.O
 Case 16
 If TempX Then
    Strng=RT$(199,"[O]")
 Endif
 Strng=Strng+"Encounter rate:"+Str$(MonsterRecord.Rate)+ _
 " ("+Mid$(Str$(MonsterRecord.RatePercent),2)+" percent)"
 Call IO.O
 Case 17
 If TempX Then
    Strng=RT$(200,"[P]")
 Endif
 Strng=Strng+"Permanent monster: "
 If MonsterRecord.Permanent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 If MonsterRecord.Invisible Then
    Strng=Strng+" [inv]"
 Endif
 If MonsterRecord.RemainsInRoom Then
    Strng=Strng+" [static]"
 Endif
 Call IO.O
 Case 18
 If TempX Then
    Strng=RT$(201,"[R]")
 Endif
 Strng=Strng+"Monster 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 19
 If TempX Then
    Strng=RT$(202,"[S]")+"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 21
 If TempX Then
    Strng=RT$(203,"[T]")
 Endif
 Strng=Strng+"Monster 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+"Monster 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+"Monster 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 22
 If TempX Then
    Strng=RT$(204,"[U]")
 Endif
 If Instr(Str$(MonsterRecord.Gold),"D") Then
    Strng=Strng+"Gold points:"+Str$(MonsterRecord.Gold)
 Else
    Strng=Strng+"Gold points: "+Form$(MonsterRecord.Gold)
 Endif
 Var#=0#
 If MonsterRecord.Buffer15 Then
    Var#=1000000 * MonsterRecord.Buffer15
 Endif
 Var#=Var#+MonsterRecord.Buffer16
 Strng=Strng+" Times killed: "+Form$(Var#)
 Call IO.O
 Case 23
 If TempX Then
    Strng=RT$(205,"[V]")
 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 24
 If TempX Then
    Strng=RT$(206,"[W]")+"Armament "
    Strng=Strng+RT$(207,"[X]")+"Talk Rewards "
    If MonsterRecord.PerMonster Then
       Strng=Strng+"(activated)"
    Else
       Strng=Strng+"(none)"
    Endif
    Call IO.O
 Endif
 End Select
ErrExit108:
 Exit Sub
ErrResume108:
 Resume ErrExit108
End Sub

Sub Print.Monster(Var)
 On Local Error Goto ErrResume108a
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="Monster number"+Str$(Temp5!)+":"
 Print #TempFile1,Strng
 Graphics.Off=True
 Case 2
 Strng=Nul
 Strng=Strng+"Monster name: "+Rtrim$(MonsterRecord.MonsterName)
 Print #TempFile1,Strng
 Case 3
 Strng=Nul
 Strng=Strng+"Plural of monster name: "+MonsterRecord.PluralName
 Print #TempFile1,Strng
 Case 4
 Strng=Nul
 Strng=Strng+"Monster level: "+Form$(Cdbl(MonsterRecord.Level))
 Print #TempFile1,Strng
 Case 5
 Strng=Nul
 Strng=Strng+"Magical monster: "
 If MonsterRecord.Magic Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 6
 Strng=Nul
 Strng=Strng+"Hit points: "+Form$(Cdbl(MonsterRecord.Hits))
 Print #TempFile1,Strng
 Case 7
 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 8
 Strng=Nul
 Strng=Strng+"Number appearing:"+Str$(MonsterRecord.NumberAppearing)
 Print #TempFile1,Strng
 Case 9
 Strng=Nul
 Strng=Strng+"Poisonous monster: "
 If MonsterRecord.Poison Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.PoisonPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 10
 Strng=Nul
 Strng=Strng+"Level draining monster: "
 If MonsterRecord.LevelDrain Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Strng=Strng+"("+Mid$(Str$(MonsterRecord.DrainPercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 11
 Strng=Nul
 Strng=Strng+"Monster 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 12
 Strng=Nul
 Strng=Strng+"Monster 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 13
 Strng=Nul
 Strng=Strng+"Monster 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 14
 Strng=Nul
 Strng=Strng+"Monster 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 15
 Strng=Nul
 Strng=Strng+"Monster jails attacker: "
 If MonsterRecord.Jail Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 Print #TempFile1,Strng
 Case 16
 Strng=Nul
 Strng=Strng+"Encounter rate:"+Str$(MonsterRecord.Rate)+ _
 " ("+Mid$(Str$(MonsterRecord.RatePercent),2)+" percent)"
 Print #TempFile1,Strng
 Case 17
 Strng=Nul
 Strng=Strng+"Permanent monster: "
 If MonsterRecord.Permanent Then
    Strng=Strng+"Yes"
 Else
    Strng=Strng+"No"
 Endif
 If MonsterRecord.Invisible Then
    Strng=Strng+" [inv]"
 Endif
 If MonsterRecord.RemainsInRoom Then
    Strng=Strng+" [static]"
 Endif
 Print #TempFile1,Strng
 Case 18
 Strng=Nul
 Strng=Strng+"Monster 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 19
 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 21
 Strng=Nul
 Strng=Strng+"Monster 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
 Case 22
 Strng=Nul
 If Instr(Str$(MonsterRecord.Gold),"D") Then
    Strng=Strng+"Gold points:"+Str$(MonsterRecord.Gold)
 Else
    Strng=Strng+"Gold points: "+Form$(MonsterRecord.Gold)
 Endif
 Var#=0#
 If MonsterRecord.Buffer15 Then
    Var#=1000000 * MonsterRecord.Buffer15
 Endif
 Var#=Var#+MonsterRecord.Buffer16
 Strng=Strng+" Times killed: "+Form$(Var#)
 Print #TempFile1,Strng
 End Select
ErrExit108a:
 Exit Sub
ErrResume108a:
 Resume ErrExit108a
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.Monsters(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 Edit.Command
 On Local Error Goto ErrResume44a
 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$(232,"[A]")+"dd response"
       Call IO.O
       Strng=RT$(233,"[C]")+"hange response"
       Call IO.O
       Strng=RT$(234,"[D]")+"elete response"
       Call IO.O
       Strng=RT$(235,"[L]")+"ist response"
       Call IO.O
       If Local.Mode Then
          Strng="[P]rint"
          Call IO.O
       Endif
       Graphics.Off=False
    Endif
    Strng="Command response edit option(q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(232,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Enter command(80 characters):"
          Call IO.O
          Strng="?"
          Call IO.I
          Out3=Out2
          Strng="Enter response(80 characters):"
          Call IO.O
          Strng="?"
          Call IO.I
          Out4=Out2
          Temp!=Lof(MonTalkFile)/MonTalkRecLen+1!
          BufferRecord.Buffer=Chr$(34)+Out3+Chr$(34)+Out4
          Call Write.Record(MonTalkFile,Temp!)
       Endif
    Case "C"
       If RT$(233,"[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=BufferRecord.Buffer
          Strng="Not a command response."
          If Left$(Out2,1)=Chr$(34) Then
             Strng="Enter command(80 characters):"
             Call IO.O
             Strng="?"
             Call IO.I
             Out3=Out2
             Strng="Enter response(80 characters):"
             Call IO.O
             Strng="?"
             Call IO.I
             Out4=Out2
             BufferRecord.Buffer=Chr$(34)+Out3+Chr$(34)+Out4
             Call Write.Record(MonTalkFile,Temp!)
             Strng="Response number"+Str$(Temp!)+" changed."
          Endif
          Call IO.O
       Endif
    Case "D"
       If RT$(234,"[D]")="[*]" 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=BufferRecord.Buffer
          Strng="Not a command response."
          If Left$(Out2,1)=Chr$(34) Then
             BufferRecord.Buffer=Nul
             Call Write.Record(MonTalkFile,Temp!)
             Strng="Response number"+Str$(Temp!)+" deleted."
          Endif
          Call IO.O
       Endif
    Case "L"
       If RT$(235,"[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="Command response number"+Str$(Temp!)+":"
                Call IO.O
                Strng=Mid$(Out2,2)
                Var$=Mid$(Strng,Instr(Strng,Chr$(34))+1)
                Strng=Left$(Strng,Instr(Strng,Chr$(34))-1)
                Call IO.O
                Strng=Var$
                Call IO.O
                If Break Then
                   Exit For
                Endif
                Temp5=Temp5+3
                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 "P"
       If Local.Mode Then
          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
             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="Command response number"+Str$(Temp!)+":"
                   Print #TempFile1,Strng
                   Strng=Mid$(Out2,2)
                   Var$=Mid$(Strng,Instr(Strng,Chr$(34))+1)
                   Strng=Left$(Strng,Instr(Strng,Chr$(34))-1)
                   Print #TempFile1,Strng
                   Strng=Var$
                   Print #TempFile1,Strng
                   Temp5=Temp5+3
                   If Temp5>=57 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
ErrExit44a:
 Exit Sub
ErrResume44a:
 Resume ErrExit44a
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$(236,"[O]")+"bjects"
       Call IO.O
       Strng=RT$(237,"[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$(236,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(238,"[A]")+"dd"
             Call IO.O
             Strng=RT$(239,"[D]")+"elete"
             Call IO.O
             Strng=RT$(240,"[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$(238,"[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.Node1(Temp6!)
                   Strng="Object added to monster inventory."
                Endif
                Call IO.O
             Endif
          Case "D"
             If RT$(239,"[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))
                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$(240,"[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$(237,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Do While Lost.Carrier=False
          Graphics.Off=True
          If TempC=False Then
             Strng=RT$(241,"[A]")+"dd"
             Call IO.O
             Strng=RT$(242,"[D]")+"elete"
             Call IO.O
             Strng=RT$(243,"[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$(241,"[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.Node1(Temp6!)
                   Strng="Treasure added to monster inventory."
                Endif
                Call IO.O
             Endif
          Case "D"
             If RT$(242,"[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))
                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$(243,"[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 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
