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

Sub Display.User(TempX,Var)
 On Local Error Goto ErrResume138
 If TempX Then
    If TempC Then
       Exit Sub
    Endif
 Endif
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="User number"+Str$(Temp5!)+":"
 Out2=UserRecord2.CodeName
 Out2=Rtrim$(Out2)
 Out2=Lcase$(Out2)
 If Left$(Out2,9)=Deleted$ Then
    Strng=Strng+" (deleted)"
 Endif
 Call Search.Mess.File(Temp5!,Var1)
 If Var1 Then
    Strng=Strng+" (online)"
    VarY=True
    Call Read.Message.Record(MessWorkFile7,TempA+1)
 Else
    Strng=Strng+" (offline)"
    VarY=False
 Endif
 Call IO.O
 Graphics.Off=True
 Case 2
 Strng=Nul
 If TempX Then
    If Local.Mode=False Then
       If Allow.Remote.Edit=False Then
          Strng="[*]"
       Else
          Strng=RT$(505,"[A]")
       Endif
    Else
       Strng=RT$(505,"[A]")
    Endif
 Endif
 If VarY Then
    Out2=MessWorkRecord7.CodeName
 Else
    Out2=UserRecord2.CodeName
 Endif
 Out2=Rtrim$(Out2)
 Out2=Lcase$(Out2)
 Mid$(Out2,1,1)=Ucase$(Mid$(Out2,1,1))
 Strng=Strng+"Codename: "+Out2
 If TempX Then
    If Local.Mode=False Then
       If Allow.Remote.Edit=False Then
          Strng=Strng+" [*]"
       Else
          Strng=Strng+" "+RT$(506,"[B]")
       Endif
    Else
       Strng=Strng+" "+RT$(506,"[B]")
    Endif
    If Local.Mode Then
       Var3$=Rtrim$(UserRecord2.PassWord3)
       Call Crypto(Var3$)
       Var3$=Rtrim$(Var3$)
       For Tmp1=1 To Len(Var3$)
          If Asc(Mid$(Var3$,Tmp1,1))<32 Then
             Mid$(Var3$,Tmp1,1)="?"
          Endif
       Next
       If Var3$=String$(20,"?") Then
          Var3$="????????"
       Endif
       Strng=Strng+"Password: "+Var3$
       Strng2=UserRecord2.Answer
       If Len(Rtrim$(Strng2)) Then
          Call Crypto(Strng2)
          Strng2=Rtrim$(Strng2)
          If Len(Strng2) Then
             Strng=Strng+" {"+Strng2+"}"
          Endif
       Endif
    Else
       Strng=Strng+"Password: "+String$(8,Mask$)
    Endif
 Endif
 Call IO.O
 Case 3
 Strng=Nul
 If TempX Then
    Strng=RT$(507,"[C]")
 Endif
 Strng=Strng+"Level: "
 If VarY Then
    VarZ=MessWorkRecord7.Level
 Else
    VarZ=UserRecord2.Level
 Endif
 If VarZ=0 Then
    Strng=Strng+Dead$
 Else
    Strng=Strng+Form$(Cdbl(VarZ))
 Endif
 Strng=Strng+" Race: "
 If VarY Then
    Strng=Strng+Race(MessWorkRecord7.Race)
 Else
    Strng=Strng+Race(UserRecord2.Race)
 Endif
 Call IO.O
 Case 4
 Strng=Nul
 If TempX Then
    Strng=RT$(508,"[D]")
 Endif
 If UserRecord2.ClassType=False Then
    UserRecord2.ClassType=1
 Endif
 Strng=Strng+"Class: "
 If VarY Then
    Strng=Strng+Rtrim$(Class.Name(MessWorkRecord7.ClassType))
 Else
    Strng=Strng+Rtrim$(Class.Name(UserRecord2.ClassType))
 Endif
 Call IO.O
 Case 5
 Strng=Nul
 If TempX Then
    Strng=RT$(509,"[E]")
 Endif
 If UserRecord2.Proficiency=False Then
    UserRecord2.Proficiency=1
 Endif
 Strng=Strng+"Weapon proficiency: "
 If VarY Then
    Strng=Strng+Rtrim$(Weapon.Type.Name(MessWorkRecord7.Proficiency))
 Else
    Strng=Strng+Rtrim$(Weapon.Type.Name(UserRecord2.Proficiency))
 Endif
 Call IO.O
 Case 6
 Strng=Nul
 If TempX Then
    Strng=RT$(510,"[F]")
 Endif
 Strng=Strng+"Blunt proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon1)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(1))
 Endif
 Call IO.O
 Case 7
 Strng=Nul
 If TempX Then
    Strng=RT$(511,"[G]")
 Endif
 Strng=Strng+"Pole proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon2)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(2))
 Endif
 Call IO.O
 Case 8
 Strng=Nul
 If TempX Then
    Strng=RT$(512,"[H]")
 Endif
 Strng=Strng+"Sharp proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon3)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(3))
 Endif
 Call IO.O
 Case 9
 Strng=Nul
 If TempX Then
    Strng=RT$(513,"[I]")
 Endif
 Strng=Strng+"Thrusting proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon4)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(4))
 Endif
 Call IO.O
 Case 10
 Strng=Nul
 If TempX Then
    Strng=RT$(514,"[J]")
 Endif
 Strng=Strng+"Classname: "
 If VarY Then
    Out2=MessWorkRecord7.ClassName
 Else
    Out2=UserRecord2.ClassName
 Endif
 Out2=Rtrim$(Out2)
 Strng=Strng+Out2
 Call IO.O
 Case 11 ' stats
 Strng=Nul
 If TempX Then
    Strng=RT$(515,"[K]")
 Endif
 Strng=Strng+"Statistics: <list>"
 Call IO.O
 Case 12
 Strng=Nul
 If TempX Then
    Strng=RT$(516,"[L]")
 Endif
 Strng=Strng+"Experience:"
 If VarY Then
    If Instr(Str$(MessWorkRecord7.Experience),"D") Then
       Strng=Strng+Str$(MessWorkRecord7.Experience)
    Else
       Strng=Strng+" "+Form$(MessWorkRecord7.Experience)
    Endif
 Else
    If Instr(Str$(UserRecord2.Experience),"D") Then
       Strng=Strng+Str$(UserRecord2.Experience)
    Else
       Strng=Strng+" "+Form$(UserRecord2.Experience)
    Endif
 Endif
 Call IO.O
 Case 13
 Strng=Nul
 If TempX Then
    Strng=RT$(517,"[M]")
 Endif
 Strng=Strng+"Gold:"
 If VarY Then
    If Instr(Str$(MessWorkRecord7.Gold),"D") Then
       Strng=Strng+Str$(MessWorkRecord7.Gold)
    Else
       Strng=Strng+" "+Form$(MessWorkRecord7.Gold)
    Endif
 Else
    If Instr(Str$(UserRecord2.Gold),"D") Then
       Strng=Strng+Str$(UserRecord2.Gold)
    Else
       Strng=Strng+" "+Form$(UserRecord2.Gold)
    Endif
 Endif
 Call IO.O
 Case 14
 Strng=Nul
 If TempX Then
    Strng=RT$(518,"[N]")
 Endif
 Strng=Strng+"Room number:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Room)
 Else
    Strng=Strng+Str$(UserRecord2.Room)
 Endif
 Call IO.O
 Case 15
 Strng=Nul
 If TempX Then
    Strng=RT$(519,"[O]")
 Endif
 Strng=Strng+"Max calls:"
 Var2=Int(UserRecord2.MaxCalls)
 Select Case Var2
 Case -1
    Strng=Strng+" Unlimited"
 Case 0
    Strng=Strng+" Default"
 Case Else
    Strng=Strng+Str$(Var2)
 End Select
 Var1=UserRecord2.FromHour
 Var2=UserRecord2.FromMin
 Var3=UserRecord2.ToHour
 Var4=UserRecord2.ToMin
 If Var1 Or Var2 Or Var3 Or Var4 Then
    Strng=Strng+" ("+_
    Right$("0"+Mid$(Str$(Var1),2),2)+":"+_
    Right$("0"+Mid$(Str$(Var2),2),2)+"-"+_
    Right$("0"+Mid$(Str$(Var3),2),2)+":"+_
    Right$("0"+Mid$(Str$(Var4),2),2)+")"
 Endif
 Call IO.O
 Case 16
 Strng=Nul
 If TempX Then
    Strng=RT$(520,"[P]")
 Endif
 VarZ!=SFalse
 If VarY Then
    For Var4!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
       Call Read.Record(MessWorkFile6,Var4!)
       If MessWorkRecord6.User=Temp5! Then
          VarZ!=VarZ!+1!
       Endif
    Next
 Else
    Var4!=UserRecord2.First
    If Var4! Then
       Do While Lost.Carrier=False
          Call Read.Record(UserInvFile,Var4!)
          Var6!=MessWorkRecord6.Next
          VarZ!=VarZ!+1!
          If Var6!=SFalse Then
             Exit Do
          Endif
          Var4!=Var6!
       Loop
    Endif
 Endif
 Var4!=UserRecord2.First2
 If Var4! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Var4!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             VarZ!=VarZ!+1!
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Var4!=Var6!
    Loop
 Endif
 Strng=Strng+"Inventory:"+Str$(VarZ!)+" item"
 If VarZ!<>1! Then
    Strng=Strng+"s"
 Endif
 Strng=Strng+"."
 Call IO.O
 Case 17
 Strng=Nul
 If TempX Then
    Strng=RT$(521,"[R]")
 Endif
 Strng=Strng+"Special characters: "
 Temp=False
 If VarY Then
    Temp9=MessWorkRecord7.SpecialFlags
 Else
    Temp9=UserRecord2.Flags
 Endif
 If Temp9 And Special.Char1 Then
    Strng=Strng+"Town Mayor, "
    Temp=True
 Endif
 If Temp9 And Special.Char2 Then
    Strng=Strng+"Governor, "
    Temp=True
 Endif
 If Temp9 And Special.Char3 Then
    Strng=Strng+"Guild Master, "
    Temp=True
 Endif
 If Temp9 And Special.Char4 Then
    Strng=Strng+"Sysop, "
    Temp=True
 Endif
 If Temp Then
    Strng=Left$(Strng,Len(Strng)-2)+"."
 Else
    Strng=Strng+"none."
 Endif
 Call IO.O
 Case 18
 Strng=Nul
 If TempX Then
    Strng=RT$(522,"[S]")
 Endif
 Strng=Strng+"ANSI prefixes: "
 Var1$=Rtrim$(UserRecord2.Prefix1)
 Var2$=Rtrim$(UserRecord2.Prefix2)
 If Len(Var1$) Or Len(Var2$) Then
    If Var1$="" Then
       Strng=Strng+"<n/a>,"
    Else
       Strng=Strng+Var1$+","
    Endif
    If Var2$="" Then
       Strng=Strng+"<n/a>"
    Else
       Strng=Strng+Var2$
    Endif
 Else
    Strng=Strng+"<none>"
 Endif
 Call IO.O
 Case 19
 Strng=Nul
 If TempX Then
    Strng=RT$(697,"[T]")
 Endif
 Strng=Strng+"Objects created: "
 Var2#=0#
 For Var1=1 To 10
    Var2#=Var2#+UserRecord2.ObjectsCreated(Var1)
 Next
 If Var2#=0# Then
    Strng=Strng+"0"
 Else
    Strng=Strng+Form$(Var2#)
 Endif
 Call IO.O
 Case 20
 Strng=Nul
 If TempX Then
    Strng=RT$(698,"[W]")
 Endif
 Strng=Strng+"Wishes left: "
 Select Case UserRecord2.WishsLeft
 Case True
    Strng=Strng+"Unlimited"
 Case False
    Strng=Strng+"None"
 Case Else
    Strng=Strng+Form$(Cdbl(UserRecord2.WishsLeft))
 End Select
 Call IO.O
 Case 21
 If Local.Mode Or Sysop Then
    Strng=RT$(659,"[Z]")+"Nodelist: "
    VarZ=0
    For VarQ=1 To 127
       If Mid$(UserRecord2.Nodelist,VarQ,1)="0" Then
          VarZ=VarZ+1
       Endif
    Next
    If VarZ=0 Then
       Strng=Strng+"<none>"
    Else
       Strng=Strng+"<"+Mid$(Str$(VarZ),2)+" inactive>"
    Endif
    Call IO.O
    Strng=RT$(663,"[!]")+"Command List:"
    If UserRecord2.NodeList2>0! Then
       Strng=Strng+Str$(UserRecord2.NodeList2)
    Else
       Strng=Strng+" <none>"
    Endif
    Call IO.O
 Endif
 End Select
ErrExit138:
 Exit Sub
ErrResume138:
 Resume ErrExit138
End Sub

Sub Search.Users
 On Local Error Goto ErrResume61
 Do While Lost.Carrier=False
    Temp1$=Nul
    Temp2$=Nul
    Temp3$=Nul
    Temp1=False
    Temp3=False
    Temp4=False
    Temp6=False
    Temp7=False
    Temp8=False
    Temp9=False
    Temp10=False
    Temp11=False
    Temp12=False
    Temp13#=DFalse
    Temp14#=DFalse
    Temp15#=DFalse
    Temp16#=DFalse
    Temp17!=SFalse
    Temp18=False
    Do While Lost.Carrier=False
       Graphics.Off=True
       If TempC=False Then
          Strng="[A]username substring"
          If Temp1$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp1$+")"
          Endif
          Call IO.O
          Strng="[B]password"
          If Temp2$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+String$(8,Mask$)+")"
          Endif
          Call IO.O
          Strng="[C]classname substring"
          If Temp3$<>Nul Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Temp3$+")"
          Endif
          Call IO.O
          Strng="[D]level"
          If Temp1 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp1),2)+")"
          Endif
          Call IO.O
          Strng="[E]class"
          If Temp3 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Rtrim$(Class.Name(Temp3))+")"
          Endif
          Call IO.O
          Strng="[F]weapon proficiency"
          If Temp4 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Rtrim$(Weapon.Type.Name(Temp4))+")"
          Endif
          Call IO.O
          Strng="[G]strength"
          If Temp6 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp6),2)+")"
          Endif
          Call IO.O
          Strng="[H]intelligence"
          If Temp7 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp7),2)+")"
          Endif
          Call IO.O
          Strng="[I]wisdom"
          If Temp8 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp8),2)+")"
          Endif
          Call IO.O
          Strng="[J]dexterity"
          If Temp9 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp9),2)+")"
          Endif
          Call IO.O
          Strng="[K]constitution"
          If Temp10 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp10),2)+")"
          Endif
          Call IO.O
          Strng="[L]piety"
          If Temp11 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp11),2)+")"
          Endif
          Call IO.O
          Strng="[M]charisma"
          If Temp12 Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp12),2)+")"
          Endif
          Call IO.O
          Strng="[N]experience"
          If Temp13#>=DFalse And Temp14#>DFalse Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp13#),2)+"-"+ _
             Mid$(Str$(Temp14#),2)+")"
          Endif
          Call IO.O
          Strng="[O]gold"
          If Temp15#>=DFalse And Temp16#>DFalse Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp15#),2)+"-"+ _
             Mid$(Str$(Temp16#),2)+")"
          Endif
          Call IO.O
          Strng="[P]room number"
          If Temp17! Then
             Strng=Strng+Space$(30-Len(Strng))
             Strng=Strng+"("+Mid$(Str$(Temp17!),2)+")"
          Endif
          Call IO.O
          Strng="[R]special character"
          If Temp18 Then
             Strng=Strng+Space$(30-Len(Strng))
             Select Case Temp18
             Case 1
                Strng=Strng+"(Town Mayor)"
             Case 2
                Strng=Strng+"(Governor)"
             Case 3
                Strng=Strng+"(Guild Master)"
             Case 4
                Strng=Strng+"(Sysop)"
             Case 5
                Strng=Strng+"(AsstDM)"
             Case 6
                Strng=Strng+"(DM)"
             End Select
          Endif
          Call IO.O
          Graphics.Off=False
       Endif
       Strng="User 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="Username substring? "
          Call IO.I
          Out2=Ucase$(Out2)
          Temp1$=Out2
       Case "B"
          Strng="Password? "
          Hidden=True
          Line.Length=20
          Call IO.I
          Hidden=False
          Out2=Ucase$(Out2)
          Call Cryptograph(Out2)
          Temp2$=Rtrim$(Out2)
       Case "C"
          Strng="Classname substring? "
          Call IO.I
          Out2=Ucase$(Out2)
          Temp3$=Out2
       Case "D"
          Strng="Level? "
          Call IO.I
          Temp1=Int(Val(Out2))
       Case "E"
          If TempC=False Then
             Graphics.Off=True
             For Temp5=1 To MaxClasses+2
                Strng="["+Mid$(Str$(Temp5),2)+"]"+Rtrim$(Class.Name(Temp5))
                Call IO.O
             Next
             Graphics.Off=False
          Endif
          Strng="Class(1-10)? "
          Call IO.I
          Temp3=Int(Val(Out2))
          If Temp3<1 Or Temp3>10 Then
             Temp3=False
          Endif
       Case "F"
          If TempC=False Then
             Graphics.Off=True
             For Temp5=1 To MaxWeapons
                Strng="["+Mid$(Str$(Temp5),2)+"]"+ _
                Rtrim$(Weapon.Type.Name(Temp5))
                Call IO.O
             Next
             Graphics.Off=False
          Endif
          No.Input.Out="1"
          Line.Length=TempD
          Strng="Weapon proficiency(1-4)? "
          Call IO.I
          Temp4=Int(Val(Out2))
          If Temp4<1 Or Temp4>4 Then
             Temp4=False
          Endif
       Case "G"
          Strng="Strength? "
          Call IO.I
          Temp6=Int(Val(Out2))
       Case "H"
          Strng="Intelligence? "
          Call IO.I
          Temp7=Int(Val(Out2))
       Case "I"
          Strng="Wisdom? "
          Call IO.I
          Temp8=Int(Val(Out2))
       Case "J"
          Strng="Dexterity? "
          Call IO.I
          Temp9=Int(Val(Out2))
       Case "K"
          Strng="Constitution? "
          Call IO.I
          Temp10=Int(Val(Out2))
       Case "L"
          Strng="Piety? "
          Call IO.I
          Temp11=Int(Val(Out2))
       Case "M"
          Strng="Charisma? "
          Call IO.I
          Temp12=Int(Val(Out2))
       Case "N"
          Strng="Enter range: "
          Call IO.O
          No.Input.Out="1"
          Strng="From? "
          Call IO.I
          Temp13#=Int(Val(Out2))
          No.Input.Out="10"
          Strng="To? "
          Call IO.I
          Temp14#=Int(Val(Out2))
       Case "O"
          Strng="Enter range: "
          Call IO.O
          No.Input.Out="1"
          Strng="From? "
          Call IO.I
          Temp15#=Int(Val(Out2))
          No.Input.Out="10"
          Strng="To? "
          Call IO.I
          Temp16#=Int(Val(Out2))
       Case "P"
          Strng="Room number? "
          Call IO.I
          Temp17!=Int(Val(Out2))
       Case "R"
          If TempC=False Then
             Graphics.Off=True
             Strng="[1]Town Mayor"
             Call IO.O
             Strng="[2]Governor"
             Call IO.O
             Strng="[3]Guild Master"
             Call IO.O
             Strng="[4]Sysop"
             Call IO.O
             Strng="[5]AsstDM"
             Call IO.O
             Strng="[6]DM"
             Call IO.O
             Graphics.Off=False
          Endif
          No.Input.Out="1"
          Line.Length=TempD
          Strng="Special character(1-6)? "
          Call IO.I
          Var=Int(Val(Out2))
          If Var>=1 And Var<=6 Then
             Temp18=Var
          Endif
       Case "S"
          Temp5!=Lof(UserFile2)/UserRecLen
          Call Get.Record.Range(Temp!,Temp2!,Temp5!)
          Allow.Break=True
          Break=False
          Continuous=False
          For Temp5!=Temp! To Temp2!
             Call Read.Record(UserFile2,Temp5!)
             TempX=False
             If Temp1$<>Nul Then
                Out3=UserRecord2.Codename
                Call InstrSUB(TempZ,Out3,Temp1$)
                If TempZ Then
                   TempX=True
                Endif
             Endif
             If Temp2$<>Nul Then
                Out3=Rtrim$(UserRecord2.PassWord)
                Call InstrSUB(TempZ,Out3,Temp3$)
                If TempZ Then
                   TempX=True
                Endif
             Endif
             If Temp3$<>Nul Then
                Out3=UserRecord2.Classname
                Call InstrSUB(TempZ,Out3,Temp3$)
                If TempZ Then
                   TempX=True
                Endif
             Endif
             If Temp1 Then
                If UserRecord2.Level=Temp1 Then
                   TempX=True
                Endif
             Endif
             If Temp3 Then
                If UserRecord2.ClassType=Temp3 Then
                   TempX=True
                Endif
             Endif
             If Temp4 Then
                If UserRecord2.Proficiency=Temp4 Then
                   TempX=True
                Endif
             Endif
             If Temp6 Then
                If UserRecord2.Stats(1)=Temp6 Then
                   TempX=True
                Endif
             Endif
             If Temp7 Then
                If UserRecord2.Stats(2)=Temp7 Then
                   TempX=True
                Endif
             Endif
             If Temp8 Then
                If UserRecord2.Stats(3)=Temp8 Then
                   TempX=True
                Endif
             Endif
             If Temp9 Then
                If UserRecord2.Stats(4)=Temp9 Then
                   TempX=True
                Endif
             Endif
             If Temp10 Then
                If UserRecord2.Stats(5)=Temp10 Then
                   TempX=True
                Endif
             Endif
             If Temp11 Then
                If UserRecord2.Stats(6)=Temp11 Then
                   TempX=True
                Endif
             Endif
             If Temp12 Then
                If UserRecord2.Stats(7)=Temp12 Then
                   TempX=True
                Endif
             Endif
             If Temp13#>=DFalse And Temp14#>DFalse Then
                If UserRecord2.Experience>=Temp13# And _
                UserRecord2.Experience<=Temp14# Then
                   TempX=True
                Endif
             Endif
             If Temp15#>=DFalse And Temp16#>DFalse Then
                If UserRecord2.Gold>=Temp15# And _
                UserRecord2.Gold<=Temp16# Then
                   TempX=True
                Endif
             Endif
             If Temp17! Then
                If UserRecord2.Room=Temp17! Then
                   TempX=True
                Endif
             Endif
             If Temp18 Then
                Select Case Temp18
                Case 1
                   If UserRecord2.Flags And Special.Char1 Then
                      TempX=True
                   Endif
                Case 2
                   If UserRecord2.Flags And Special.Char2 Then
                      TempX=True
                   Endif
                Case 3
                   If UserRecord2.Flags And Special.Char3 Then
                      TempX=True
                   Endif
                Case 4
                   If UserRecord2.Flags And Special.Char4 Then
                      TempX=True
                   Endif
                Case 5
                   If UserRecord2.ClassType=AsstDM Then
                      TempX=True
                   Endif
                Case 6
                   If UserRecord2.ClassType=DM Then
                      TempX=True
                   Endif
                End Select
             Endif
             If TempX Then
                Out3=UserRecord2.Codename
                If Left$(Out3,9)<>Deleted$ Then
                   For VarQ=1 To 18
                      Call Display.User(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
             Endif
          Next
          Allow.Break=False
          Break=False
          Exit Do
       Case "Q"
          Exit Sub
       End Select
    Loop
 Loop
ErrExit61:
 Exit Sub
ErrResume61:
 Resume ErrExit61
End Sub

Sub Top.Ten
 On Local Error Goto ErrTrap9
 Allow.Break=False
 Break=False
 Graphics.Off=False
 Strng="Top ten. "
 If Local.Mode Then
    Var$="Press <ctrl-break>/<ctrl-c> to interrupt."
 Else
    Var$="Press <control-c>/<control-k> to interrupt."
 Endif
 Strng=Strng+Var$
 Call IO.O
 Graphics.Off=True
 TempX!=Lof(UserFile)/UserRecLen
 If TempX!=SFalse Then
    Strng="No users exist."
    Call IO.O
    Exit Sub
 Endif
 Close #TempFile1
 FileName=DND.Path+"SORT5"+NodeX+".SWP"
 Open FileName For Random Shared As #TempFile1 Len=12
 Field #TempFile1,4 As U$,8 As Z$
 Allow.Break=True
 Break=False
 Do While Lost.Carrier=False
    Allow.Break=True
    Strng="DNDBBS v"+Version$+" Top Ten Player Rankings For "+Fclock$+"."
    Call IO.O
    If Break Then
       Exit Do
    Endif
    Strng=Nul
    Call IO.O
    If Break Then
       Exit Do
    Endif
    TempZ!=SFalse
    For Temp.User.Index=1! To TempX!
       Call Read.Record(UserFile2,Temp.User.Index)
       Strng=UserRecord2.CodeName
       If (UserRecord2.Flags And Locked.User)=False Then
          If Left$(Strng,9)<>Deleted$ Then
             If UserRecord2.Level>=1 Then
                TempA#=Cdbl(UserRecord2.PermanentKilled*UserRecord2.Level*10)+ _
                Cdbl(UserRecord2.PlayersKilled*UserRecord2.Level*2)+ _
                Cdbl(UserRecord2.MonstersKilled*UserRecord2.Level)
                If TempA#>DFalse Then
                   TempZ!=TempZ!+1!
                   Lset U$=Mks$(Temp.User.Index)
                   Lset Z$=Mkd$(TempA#)
                   Put #TempFile1,TempZ!
                Endif
             Endif
          Endif
       Endif
    Next
    If TempZ!>SFalse Then
       For VarS1!=1! To TempZ!
          For VarS2!=VarS1!+1! To TempZ!
             Get #TempFile1,VarS1!
             TempZ1!=Cvs(U$)
             TempX1#=Cvd(Z$)
             Get #TempFile1,VarS2!
             TempZ2!=Cvs(U$)
             TempX2#=Cvd(Z$)
             If TempX1#<TempX2# Then
                Lset U$=Mks$(TempZ1!)
                Lset Z$=Mkd$(TempX1#)
                Put #TempFile1,VarS2!
                Lset U$=Mks$(TempZ2!)
                Lset Z$=Mkd$(TempX2#)
                Put #TempFile1,VarS1!
             Endif
          Next
       Next
    Endif
    If TempZ!>10! Then
       TempZ!=10!
    Endif
    If User.LineLength=40 Then
       Strng="Username                       Level"
       Call IO.O
       Strng="Classname            Ranking"
       Call IO.O
       Call Display.Line(38)
    Else
       Strng="Username                       Level   Classname            Ranking"
       Call IO.O
       Call Display.Line(67)
    Endif
    If Break Then
       Exit Do
    Endif
    TempX=False
    For Temp1!=1! To TempZ!
       Get #TempFile1,Temp1!
       TempX!=Cvs(U$)
       TempZ#=Cvd(Z$)
       Call Read.Record(UserFile2,TempX!)
       Strng=UserRecord2.CodeName
       Strng=Lcase$(Strng)
       Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
       Strng=Rtrim$(Strng)
       Strng=Left$(Strng,30)
       VarQ=31-Len(Strng)
       Strng=Rtrim$(UserRecord2.Prefix1)+Strng
       Call Convert.ANSI(True,VarQ,VarR)
       Carriage.Return=True
       Graphics.On=True
       Call IO.O
       Graphics.On=False
       Carriage.Return=True
       Strng=Space$(VarQ)
       If UserRecord2.Level>32000 Then
          Strng=Strng+"Ghod  "
       Else
          Strng=Strng+Mid$(Str$(UserRecord2.Level),2)
          Strng=Strng+Space$(7-Len(Str$(UserRecord2.Level)))
       Endif
       Strng=Strng+"  "
       Call IO.O
       If User.LineLength=40 Then
          Call IO.O
       Endif
       Strng=UserRecord2.ClassName
       Strng=Rtrim$(Strng)
       Strng=Left$(Strng,20)
       VarQ=21-Len(Strng)
       Strng=Rtrim$(UserRecord2.Prefix2)+Strng
       Call Convert.ANSI(True,VarQ,VarR)
       Carriage.Return=True
       Graphics.On=True
       Call IO.O
       Graphics.On=False
       TempX=True
       Strng=Space$(VarQ)
       Strng=Strng+Mid$(Str$(TempZ#),2)
       Call IO.O
       If Break Then
          Exit Do
       Endif
    Next
    Exit Do
 Loop
 Allow.Break=False
 Break=False
 If TempX=False Then
    Strng="No users have top scores."
    Call IO.O
 Endif
 Call More.Prompt
 Break=False
 Close #TempFile1
 If Dir$(FileName)<>"" Then
    Kill FileName
 Endif
ErrResume9:
 Exit Sub
ErrTrap9:
 Resume ErrResume9
End Sub

Sub Top.Ten.Teams
 On Local Error Goto ErrTrap10
 Allow.Break=False
 Break=False
 Graphics.Off=False
 Strng="Top ten teams. "
 If Local.Mode Then
    Var$="Press <ctrl-break>/<ctrl-c> to interrupt."
 Else
    Var$="Press <control-c>/<control-k> to interrupt."
 Endif
 Strng=Strng+Var$
 Call IO.O
 Graphics.Off=True
 TempX!=Lof(TeamFile)/TeamRecLen
 If TempX!=SFalse Then
    Strng="No teams exist."
    Call IO.O
    Exit Sub
 Endif
 Close #TempFile1
 FileName=DND.Path+"SORT5"+NodeX+".SWP"
 Open FileName For Random Shared As #TempFile1 Len=12
 Field #TempFile1,4 As U$,8 As Z$
 Allow.Break=True
 Break=False
 Do While Lost.Carrier=False
    Allow.Break=True
    Strng="DNDBBS v"+Version$+" Top Ten Team Rankings For "+Fclock$+"."
    Call IO.O
    If Break Then
       Exit Do
    Endif
    Strng=Nul
    Call IO.O
    If Break Then
       Exit Do
    Endif
    TempZ!=SFalse
    For Var1!=1! To TempX!
       Call Read.Record(TeamFile,Var1!)
       Strng=Rtrim$(TeamRecord.Name)
       Strng=Lcase$(Strng)
       If Len(Strng) And TeamRecord.Deleted=False Then
          TempQ=False
          TempA#=DFalse
          For Var2=1 To MaxTeamMembers
             Temp2$=Rtrim$(TeamRecord.Member(Var2))
             If Len(Temp2$) Then
                VarY!=TeamRecord.UserIndex(Var2)
                If VarY!>SFalse And VarY!<=Lof(UserFile2)/UserRecLen Then
                   Call Read.Record(UserFile2,VarY!)
                   Strng=UserRecord2.CodeName
                   If Left$(Strng,9)<>Deleted$ Then
                      TempQ=True
                      If UserRecord2.Level>=1 Then
                         TempA#=TempA#+Cdbl(UserRecord2.PermanentKilled*UserRecord2.Level*10)+ _
                         Cdbl(UserRecord2.PlayersKilled*UserRecord2.Level*2)+ _
                         Cdbl(UserRecord2.MonstersKilled*UserRecord2.Level)
                      Endif
                   Endif
                Endif
             Endif
          Next
          If TempQ Then
             If TempA#>DFalse Then
                TempZ!=TempZ!+1!
                Lset U$=Mks$(Var1!)
                Lset Z$=Mkd$(TempA#)
                Put #TempFile1,TempZ!
             Endif
          Endif
       Endif
    Next
    If TempZ!>SFalse Then
       For VarS1!=1! To TempZ!
          For VarS2!=VarS1!+1! To TempZ!
             Get #TempFile1,VarS1!
             TempZ1!=Cvs(U$)
             TempX1#=Cvd(Z$)
             Get #TempFile1,VarS2!
             TempZ2!=Cvs(U$)
             TempX2#=Cvd(Z$)
             If TempX1#<TempX2# Then
                Lset U$=Mks$(TempZ1!)
                Lset Z$=Mkd$(TempX1#)
                Put #TempFile1,VarS2!
                Lset U$=Mks$(TempZ2!)
                Lset Z$=Mkd$(TempX2#)
                Put #TempFile1,VarS1!
             Endif
          Next
       Next
    Endif
    If TempZ!>10! Then
       TempZ!=10!
    Endif
    If User.LineLength=40 Then
       Strng="Teamname                       Members"
       Call IO.O
       Strng="Gold               Ranking"
       Call IO.O
       Call Display.Line(38)
    Else
       Strng="Teamname                       Members Gold               Ranking"
       Call IO.O
       Call Display.Line(65)
    Endif
    If Break Then
       Exit Do
    Endif
    TempX=False
    For Temp1!=1! To TempZ!
       Get #TempFile1,Temp1!
       TempX!=Cvs(U$)
       TempZ#=Cvd(Z$)
       Call Read.Record(TeamFile,TempX!)
       Strng=TeamRecord.Name
       Strng=Rtrim$(Strng)
       Strng=Lcase$(Strng)
       Call Capitalize(Strng)
       Strng=Left$(Strng,30)
       VarQ=31-Len(Strng)
       If Rtrim$(Strng)<>Nul Then
          Strng=Rtrim$(TeamRecord.Prefix1)+Strng
          Call Convert.ANSI(True,VarQ,VarR)
          Carriage.Return=True
          Graphics.On=True
	  Call IO.O
          Graphics.On=False
          TempQ=False
          For Temp2=1 To MaxTeamMembers
             VarY!=TeamRecord.UserIndex(Temp2)
             If VarY!>SFalse And VarY!<=Lof(UserFile2)/UserRecLen Then
                Call Read.Record(UserFile2,VarY!)
                Var2$=UserRecord2.CodeName
                If Left$(Var2$,9)<>Deleted$ Then
                   TempQ=TempQ+1
                Endif
             Endif
          Next
          Strng=Space$(VarQ)
          Strng=Strng+Mid$(Str$(TempQ),2)
          If User.LineLength=40 Then
             Call IO.O
          Else
             Strng=Strng+Space$(8-Len(Str$(TempQ)))
          Endif
          Temp#=TeamRecord.Gold
          Strng=Strng+Str$(Temp#)
          Strng=Strng+Space$(19-Len(Str$(Temp#)))
          Strng=Strng+Str$(TempZ#)
          TempX=True
          Call IO.O
          If Break Then
             Exit Do
          Endif
       Endif
    Next
    Exit Do
 Loop
 Allow.Break=False
 Break=False
 If TempX=False Then
    Strng="No teams have top scores."
    Call IO.O
 Endif
 Call More.Prompt
 Break=False
 Close #TempFile1
 If Dir$(FileName)<>"" Then
    Kill FileName
 Endif
ErrResume10:
 Exit Sub
ErrTrap10:
 Resume ErrResume10
End Sub

Sub New.Stats(VarX)
 On Local Error Goto ErrResume99
 Temp#=Cdbl(Training.Stats(UserRecord2.ClassType,1))*Cdbl(UserRecord2.Level)
 If Temp#>MaxInt Then
    Temp#=MaxInt
 Endif
 UserRecord2.Fatigue=Cint(Temp#)
 UserRecord2.FatigueMax=Cint(Temp#)
 Temp#=Cdbl(Training.Stats(UserRecord2.ClassType,2))*Cdbl(UserRecord2.Level)
 If Temp#>MaxInt Then
    Temp#=MaxInt
 Endif
 UserRecord2.Vitality=Cint(Temp#)
 UserRecord2.VitalityMax=Cint(Temp#)
 Temp#=Cdbl(Training.Stats(UserRecord2.ClassType,3))*Cdbl(UserRecord2.Level)
 If Temp#>MaxInt Then
    Temp#=MaxInt
 Endif
 UserRecord2.Magic=Cint(Temp#)
 UserRecord2.MagicMax=Cint(Temp#)
 Temp#=Cdbl(Training.Stats(UserRecord2.ClassType,4))*Cdbl(UserRecord2.Level)
 If Temp#>MaxInt Then
    Temp#=MaxInt
 Endif
 UserRecord2.Psionic=Cint(Temp#)
 UserRecord2.PsionicMax=Cint(Temp#)
 If UserRecord2.Fatigue<False Or _
 UserRecord2.Fatigue>UserRecord2.FatigueMax Then
    UserRecord2.Fatigue=UserRecord2.FatigueMax
 Endif
 If UserRecord2.Vitality<False Or _
 UserRecord2.Vitality>UserRecord2.VitalityMax Then
    UserRecord2.Vitality=UserRecord2.VitalityMax
 Endif
 If UserRecord2.Magic<False Or _
 UserRecord2.Magic>UserRecord2.MagicMax Then
    UserRecord2.Magic=UserRecord2.MagicMax
 Endif
 If UserRecord2.Psionic<False Or _
 UserRecord2.Psionic>UserRecord2.PsionicMax Then
    UserRecord2.Psionic=UserRecord2.PsionicMax
 Endif
 If VarX=False Then
    Exit Sub
 Endif
 If Allow.High.Class Then
    If UserRecord2.Level>=10 Then
       If UserRecord2.ClassType>=1 And UserRecord2.ClassType<=10 Then
          Out2=High.Class.Name(UserRecord2.ClassType)
          Call Valid(Out2,20)
          If Out2=Nul Then
             Strng="Illegal characters in high classname."
             Call IO.O
          Else
             UserRecord2.ClassName=Out2
          Endif
       Endif
    Endif
 Endif
ErrExit99:
 Exit Sub
ErrResume99:
 Resume ErrExit99
End Sub

Sub Read.DayFile
 On Local Error Goto ErrResume8
 Out5=Fclock$
 Strng="Dayfile for "+Out5+"."
 Call IO.O
 Continuous=False
 Graphics.Off=True
 Temp5=1
 TempX=False
 Allow.Break=True
 Break=False
 FileName=Day.File.FileName
 Close #DayFile1
 Open FileName For Random Shared As #DayFile1 Len=BufferRecLen
 For Temp!=1! To Lof(DayFile1)/BufferRecLen
    Call Read.Record(DayFile1,Temp!)
    Strng=BufferRecord.Buffer
    If Left$(Strng,10)=DateS$ Then
       Strng=Rtrim$(Strng)
       Call IO.O
       Temp5=Temp5+1
       TempX=True
       If Break Then
	  Exit For
       Endif
       If Temp5=23 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 TempX=False Then
    Strng="No dayfile log for "+Out5+"."
    Call IO.O
 Else
    If Temp5 Then
       Call More.Prompt
    Endif
 Endif
 Graphics.Off=False
ErrExit8:
 Exit Sub
ErrResume8:
 Resume ErrExit8
End Sub

Sub Edit.Sysnews
 On Local Error Goto ErrMain41x
 Strng="Reset last system news read for all users(y/n)? "
 No.Input.Out="N"
 Call IO.I
 If Yes Then
    For Temp5!=1! To Lof(UserFile2)/UserRecLen
       Call Read.Record(UserFile2,Temp5!)
       UserRecord2.SysNews="01-01-1980"
       Call Write.Record(UserFile2,Temp5!)
    Next
    Strng="System News last read reset for all users.."
    Call IO.O
 Endif
MainExit41x:
 Exit Sub
ErrMain41x:
 Resume MainExit41x
End Sub

Sub Edit.Vehicles
 On Local Error Goto ErrMain41a
 Do While Lost.Carrier=False
    Graphics.Off=True
    If TempC=False Then
       Strng=RT$(702,"[C]")+"hange"
       Call IO.O
       Strng=RT$(703,"[D]")+"elete"
       Call IO.O
       Strng=RT$(704,"[L]")+"ist"
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="User vehicles edit option(c/d/l/q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "C"
       If RT$(702,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Change.Vehicle
       Endif
    Case "D"
       If RT$(703,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call Remove.Vehicle
       Endif
    Case "L"
       If RT$(704,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Call List.Vehicles
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
MainExit41a:
 Exit Sub
ErrMain41a:
 Resume MainExit41a
End Sub

Sub Change.Vehicle
 On Local Error Goto ErrMain41b
 Var1!=Lof(RoomInvFile)/MessWorkRecLen6
 Strng="Vehicle number"
 Call Get.Record.Range2(0!,Var1!,Temp!)
 TempZ=False
 If Temp!>SFalse Then
    Call Read.Record(RoomInvFile,Temp!)
    VarZ!=MessWorkRecord6.Index
    If VarZ!>SFalse And VarZ!<=Lof(TreasureFile)/TreasureRecLen Then
       Call Read.Record(TreasureFile,VarZ!)
       If TreasureRecord.Vehicle Then
          If MessWorkRecord6.User>SFalse Then
             Strng="Safe vehicle(y/n)? "
             Call IO.I
             If Yes Then
                MessWorkRecord6.Charges=True
                Call Write.Record(RoomInvFile,Temp!)
                Strng="Vehicle is now safe."
                Call IO.O
             Else
                VarX!=32767!
                Strng="Number of charges"
                Call Get.Record.Range2(0!,VarX!,Temp2!)
                MessWorkRecord6.Charges=Cint(Temp2!)
                Call Write.Record(RoomInvFile,Temp!)
                Out3=TreasureRecord.ShortName
                Out3=Rtrim$(Out3)
                Out3=Lcase$(Out3)
                Strng="The "+Out3+" now has"+Str$(Temp2!)+" hits!"
                Call IO.O
             Endif
             TempZ=True
          Endif
       Endif
    Endif
 Endif
 If TempZ Then
    Strng="Vehicle changed."
 Else
    Strng="No vehicle changed."
 Endif
 Call IO.O
MainExit41b:
 Exit Sub
ErrMain41b:
 Resume MainExit41b
End Sub

Sub Remove.Vehicle
 On Local Error Goto ErrMain41c
 Var1!=Lof(RoomInvFile)/MessWorkRecLen6
 Strng="Vehicle number"
 Call Get.Record.Range2(0!,Var1!,Temp!)
 TempZ=False
 If Temp!>SFalse Then
    Call Read.Record(RoomInvFile,Temp!)
    VarZ!=MessWorkRecord6.Index
    If VarZ!>SFalse And VarZ!<=Lof(TreasureFile)/TreasureRecLen Then
       Call Read.Record(TreasureFile,VarZ!)
       If TreasureRecord.Vehicle Then
          If MessWorkRecord6.User>SFalse Then
             If MessWorkRecord6.User=Temp5! Then
                Vehicle1=SFalse
             Endif
             Call Search.Mess.File(MessWorkRecord6.User,VarX)
             VarY=TempA
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Vehicle=SFalse
                MessWorkRecord7.Flags4=MessWorkRecord7.Flags4 Or 2^10
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
             MessWorkRecord6.User=SFalse
             If MessWorkRecord6.Temp(1)>SFalse Then
                MessWorkRecord6.User=MessWorkRecord6.Temp(1)
                For Var2=1 To 3
                   MessWorkRecord6.Temp(Var2)=MessWorkRecord6.Temp(Var2+1)
                Next
                MessWorkRecord6.Temp(4)=SFalse
             Endif
             Call Write.Record(RoomInvFile,Temp!)
             TempZ=True
          Endif
       Endif
    Endif
 Endif
 If TempZ Then
    Strng="Vehicle owner deleted."
 Else
    Strng="No vehicle owner deleted."
 Endif
 Call IO.O
MainExit41c:
 Exit Sub
ErrMain41c:
 Resume MainExit41c
End Sub

Sub List.Vehicles
 On Local Error Goto ErrMain41d
 VarZ=False
 Allow.Break=True
 Break=False
 Continuous=False
 For TempX!=1! To Lof(RoomInvFile)/MessWorkRecLen6
    Call Read.Record(RoomInvFile,TempX!)
    VarZ!=MessWorkRecord6.Index
    If VarZ!>SFalse And VarZ!<=Lof(TreasureFile)/TreasureRecLen Then
       Call Read.Record(TreasureFile,VarZ!)
       If TreasureRecord.Vehicle Then
          Var2!=MessWorkRecord6.User
          If Var2!>SFalse And Var2!<=Lof(UserFile2)/UserRecLen Then
             Strng=Mid$(Str$(TempX!),2)+"."
             Out3=TreasureRecord.TreasureName
             Out3=Rtrim$(Out3)
             Out3=Lcase$(Out3)
             Mid$(Out3,1,1)=UCase$(Mid$(Out3,1,1))
             Strng=Strng+Out3+": "
             Call Read.Record(UserFile2,Var2!)
             Out3=UserRecord2.CodeName
             Out3=Rtrim$(Out3)
             Out3=Lcase$(Out3)
             Mid$(Out3,1,1)=UCase$(Mid$(Out3,1,1))
             Strng=Strng+Out3
             VarQ=MessWorkRecord6.Charges
             Select Case VarQ
             Case -1
                Strng=Strng+" (safe)"
             Case 0
                Strng=Strng+" (damaged)"
             Case Else
                Out3=Mid$(Str$(VarQ),2)
                Strng=Strng+" ("+Out3+" charges)"
             End Select
             Strng=Strng+"."
             Call IO.O
             If Break Then
                Exit For
             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 For
                   Endif
                Endif
             Endif
          Endif
       Endif
    Endif
 Next
 Allow.Break=False
 If VarZ Then
    Call More.Prompt
 Endif
MainExit41d:
 Exit Sub
ErrMain41d:
 Resume MainExit41d
End Sub

Sub Print.Users
 On Local Error Goto ErrMain41e
 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(UserFile2)/UserRecLen
    Call Get.Record.Range(Temp!,Temp2!,Temp3!)
    For Temp5!=Temp! To Temp2!
       Call Read.Record(UserFile2,Temp5!)
       For VarQ=1 To 27
          Call Print.User(VarQ)
       Next
       Print #TempFile1,Chr$(12);
    Next
 Endif
MainExit41e:
 Close #TempFile1
 Exit Sub
ErrMain41e:
 Resume MainExit41e
End Sub

Sub Print.User(Var)
 On Local Error Goto ErrMain41f
 Select Case Var
 Case 1
 Graphics.Off=False
 Strng="User number"+Str$(Temp5!)+":"
 Out2=UserRecord2.CodeName
 Out2=Rtrim$(Out2)
 Out2=Lcase$(Out2)
 If Left$(Out2,9)=Deleted$ Then
    Strng=Strng+" (deleted)"
 Endif
 Call Search.Mess.File(Temp5!,Var1)
 If Var1 Then
    Strng=Strng+" (online)"
    VarY=True
    Call Read.Message.Record(MessWorkFile7,TempA+1)
 Else
    Strng=Strng+" (offline)"
    VarY=False
 Endif
 Print #TempFile1,Strng
 Graphics.Off=True
 Case 2
 Strng=Nul
 If VarY Then
    Out2=MessWorkRecord7.CodeName
 Else
    Out2=UserRecord2.CodeName
 Endif
 Out2=Rtrim$(Out2)
 Out2=Lcase$(Out2)
 Mid$(Out2,1,1)=Ucase$(Mid$(Out2,1,1))
 Strng=Strng+"Codename: "+Out2
 Print #TempFile1,Strng
 Case 3
 Strng=Nul
 Strng=Strng+"Level:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Level)
 Else
    Strng=Strng+Str$(UserRecord2.Level)
 Endif
 Strng=Strng+" Race: "
 If VarY Then
    Strng=Strng+Race(MessWorkRecord7.Race)
 Else
    Strng=Strng+Race(UserRecord2.Race)
 Endif
 Print #TempFile1,Strng
 Case 4
 Strng=Nul
 If UserRecord2.ClassType=False Then
    UserRecord2.ClassType=1
 Endif
 Strng=Strng+"Class: "
 If VarY Then
    Strng=Strng+Rtrim$(Class.Name(MessWorkRecord7.ClassType))
 Else
    Strng=Strng+Rtrim$(Class.Name(UserRecord2.ClassType))
 Endif
 Print #TempFile1,Strng
 Case 5
 Strng=Nul
 If UserRecord2.Proficiency=False Then
    UserRecord2.Proficiency=1
 Endif
 Strng=Strng+"Weapon proficiency: "
 If VarY Then
    Strng=Strng+Rtrim$(Weapon.Type.Name(MessWorkRecord7.Proficiency))
 Else
    Strng=Strng+Rtrim$(Weapon.Type.Name(UserRecord2.Proficiency))
 Endif
 Print #TempFile1,Strng
 Case 6
 Strng=Nul
 Strng=Strng+"Blunt proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon1)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(1))
 Endif
 Print #TempFile1,Strng
 Case 7
 Strng=Nul
 Strng=Strng+"Pole proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon2)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(2))
 Endif
 Print #TempFile1,Strng
 Case 8
 Strng=Nul
 Strng=Strng+"Sharp proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon3)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(3))
 Endif
 Print #TempFile1,Strng
 Case 9
 Strng=Nul
 Strng=Strng+"Thrusting proficiency%:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Weapon4)
 Else
    Strng=Strng+Str$(UserRecord2.Weapons(4))
 Endif
 Print #TempFile1,Strng
 Case 10
 Strng=Nul
 Strng=Strng+"Classname: "
 If VarY Then
    Out2=MessWorkRecord7.ClassName
 Else
    Out2=UserRecord2.ClassName
 Endif
 Out2=Rtrim$(Out2)
 Strng=Strng+Out2
 Print #TempFile1,Strng
 Case 11
 Strng=Nul
 Strng=Strng+"Strength:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat1)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(1))
 Endif
 Print #TempFile1,Strng
 Case 12
 Strng=Nul
 Strng=Strng+"Intelligence:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat2)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(2))
 Endif
 Print #TempFile1,Strng
 Case 13
 Strng=Nul
 Strng=Strng+"Wisdom:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat3)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(3))
 Endif
 Print #TempFile1,Strng
 Case 14
 Strng=Nul
 Strng=Strng+"Dexterity:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat4)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(4))
 Endif
 Print #TempFile1,Strng
 Case 15
 Strng=Nul
 Strng=Strng+"Constitution:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat5)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(5))
 Endif
 Print #TempFile1,Strng
 Case 16
 Strng=Nul
 Strng=Strng+"Piety:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat6)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(6))
 Endif
 Print #TempFile1,Strng
 Case 17
 Strng=Nul
 Strng=Strng+"Charisma:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat7)
 Else
    Strng=Strng+Str$(UserRecord2.Stats(7))
 Endif
 Print #TempFile1,Strng
 Case 18
 Strng=Nul
 Strng=Strng+"Beauty:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat8)
 Else
    Strng=Strng+Str$(UserRecord2.Beauty)
 Endif
 Print #TempFile1,Strng
 Case 19
 Strng=Nul
 Strng=Strng+"Glamour:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Stat9)
 Else
    Strng=Strng+Str$(UserRecord2.Glamour)
 Endif
 Print #TempFile1,Strng
 Case 20
 Strng=Nul
 Strng=Strng+"Experience:"
 If VarY Then
    If Instr(Str$(MessWorkRecord7.Experience),"D") Then
       Strng=Strng+Str$(MessWorkRecord7.Experience)
    Else
       Strng=Strng+" "+Form$(MessWorkRecord7.Experience)
    Endif
 Else
    If Instr(Str$(UserRecord2.Experience),"D") Then
       Strng=Strng+Str$(UserRecord2.Experience)
    Else
       Strng=Strng+" "+Form$(UserRecord2.Experience)
    Endif
 Endif
 Print #TempFile1,Strng
 Case 21
 Strng=Nul
 Strng=Strng+"Gold:"
 If VarY Then
    If Instr(Str$(MessWorkRecord7.Gold),"D") Then
       Strng=Strng+Str$(MessWorkRecord7.Gold)
    Else
       Strng=Strng+" "+Form$(MessWorkRecord7.Gold)
    Endif
 Else
    If Instr(Str$(UserRecord2.Gold),"D") Then
       Strng=Strng+Str$(UserRecord2.Gold)
    Else
       Strng=Strng+" "+Form$(UserRecord2.Gold)
    Endif
 Endif
 Print #TempFile1,Strng
 Case 22
 Strng=Nul
 Strng=Strng+"Room number:"
 If VarY Then
    Strng=Strng+Str$(MessWorkRecord7.Room)
 Else
    Strng=Strng+Str$(UserRecord2.Room)
 Endif
 Print #TempFile1,Strng
 Case 23
 Strng=Nul
 Strng=Strng+"Max calls:"
 Var2=Int(UserRecord2.MaxCalls)
 Select Case Var2
 Case -1
    Strng=Strng+" Unlimited"
 Case 0
    Strng=Strng+" Default"
 Case Else
    Strng=Strng+Str$(Var2)
 End Select
 Var1=UserRecord2.FromHour
 Var2=UserRecord2.FromMin
 Var3=UserRecord2.ToHour
 Var4=UserRecord2.ToMin
 If Var1 Or Var2 Or Var3 Or Var4 Then
    Strng=Strng+" ("+_
    Right$("0"+Mid$(Str$(Var1),2),2)+":"+_
    Right$("0"+Mid$(Str$(Var2),2),2)+"-"+_
    Right$("0"+Mid$(Str$(Var3),2),2)+":"+_
    Right$("0"+Mid$(Str$(Var4),2),2)+")"
 Endif
 Print #TempFile1,Strng
 Case 24
 Strng=Nul
 VarZ!=SFalse
 If VarY Then
    For Var4!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
       Call Read.Record(MessWorkFile6,Var4!)
       If MessWorkRecord6.User=Var4! Then
          VarZ!=VarZ!+1!
       Endif
    Next
 Else
    Var4!=UserRecord2.First
    If Var4! Then
       Do While Lost.Carrier=False
          Call Read.Record(UserInvFile,Var4!)
          Var6!=MessWorkRecord6.Next
          VarZ!=VarZ!+1!
          If Var6!=SFalse Then
             Exit Do
          Endif
          Var4!=Var6!
       Loop
    Endif
 Endif
 Var4!=UserRecord2.First2
 If Var4! Then
    Do While Lost.Carrier=False
       Call Read.Record(ContainerFile,Var4!)
       Var6!=ContainerRecord.Next
       If ContainerRecord.WithinContainer=SFalse Then
          If ContainerRecord.DeletedContainer=False Then
             VarZ!=VarZ!+1!
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Var4!=Var6!
    Loop
 Endif
 Strng=Strng+"Inventory:"+Str$(VarZ!)+" item"
 If VarZ!<>1! Then
    Strng=Strng+"s"
 Endif
 Strng=Strng+"."
 Print #TempFile1,Strng
 Case 25
 Strng=Nul
 Strng=Strng+"Special characters: "
 Temp=False
 If VarY Then
    Temp9=MessWorkRecord7.SpecialFlags
 Else
    Temp9=UserRecord2.Flags
 Endif
 If Temp9 And Special.Char1 Then
    Strng=Strng+"Town Mayor, "
    Temp=True
 Endif
 If Temp9 And Special.Char2 Then
    Strng=Strng+"Governor, "
    Temp=True
 Endif
 If Temp9 And Special.Char3 Then
    Strng=Strng+"Guild Master, "
    Temp=True
 Endif
 If Temp9 And Special.Char4 Then
    Strng=Strng+"Sysop, "
    Temp=True
 Endif
 If Temp Then
    Strng=Left$(Strng,Len(Strng)-2)+"."
 Else
    Strng=Strng+"none."
 Endif
 Print #TempFile1,Strng
 Case 26
 Strng="Objects created: "
 Var2#=0#
 For Var1=1 To 10
    Var2#=Var2#+UserRecord2.ObjectsCreated(Var1)
 Next
 If Var2#=0# Then
    Strng=Strng+"0"
 Else
    Strng=Strng+Form$(Var2#)
 Endif
 Print #TempFile1,Strng
 Case 27
 Strng="Wishes left: "
 Select Case UserRecord2.WishsLeft
 Case True
    Strng=Strng+"Unlimited"
 Case False
    Strng=Strng+"None"
 Case Else
    Strng=Strng+Form$(Cdbl(UserRecord2.WishsLeft))
 End Select
 Print #TempFile1,Strng
 End Select
MainExit41f:
 Exit Sub
ErrMain41f:
 Resume MainExit41f
End Sub

Sub Edit.User.NodeList(VarX,VarY)
 On Local Error Goto ErrResume4x
 Do While Lost.Carrier=False
    If TempC=False Then
       Graphics.Off=False
       Strng="Node list activate:"
       Call IO.O
       Graphics.Off=True
       Strng=RT$(660,"[A]")+"ctivate"
       Call IO.O
       Strng=RT$(661,"[D]")+"eactivate"
       Call IO.O
       Strng=RT$(662,"[L]")+"ist nodes"
       Call IO.O
    Endif
    Graphics.Off=False
    Strng="Node list option(a/d/l/q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       If RT$(660,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Node number(0-9,A-Z,10-99)? "
          Call IO.I
          If Len(Out2) Then
             Out2=Ucase$(Out2)
             Select Case Len(Out2)
             Case 1
                Select Case Out2
                Case "0" To "9" ' 1-10
                   Var=Val(Out2)+1
                   Mid$(UserRecord2.NodeList,Var+1,1)="1"
                   Strng="Node activated."
                   Call IO.O
                   If VarX Then
                      Call Read.Message.Record(MessWorkFile7,VarY+1)
                      MessWorkRecord7.NodeList2=UserRecord2.NodeList
                      MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^5
                      Call Write.Message.Record(MessWorkFile7,VarY+1)
                   Endif
                Case "A" To "Z" ' 11-36
                   Var=Asc(Out2)-54
                   Mid$(UserRecord2.NodeList,Var+1,1)="1"
                   Strng="Node activated."
                   Call IO.O
                   If VarX Then
                      Call Read.Message.Record(MessWorkFile7,VarY+1)
                      MessWorkRecord7.NodeList2=UserRecord2.NodeList
                      MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^5
                      Call Write.Message.Record(MessWorkFile7,VarY+1)
                   Endif
                End Select
             Case 2
                VarX2=Int(Val(Out2)) ' 37-126
                If VarX2>=10 And VarX2<=99 Then
                   Var=VarX2+27
                   Mid$(UserRecord2.NodeList,Var+1,1)="1"
                   Strng="Node activated."
                   Call IO.O
                   If VarX Then
                      Call Read.Message.Record(MessWorkFile7,VarY+1)
                      MessWorkRecord7.NodeList2=UserRecord2.NodeList
                      MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^5
                      Call Write.Message.Record(MessWorkFile7,VarY+1)
                   Endif
                Endif
             End Select
          Endif
       Endif
    Case "D"
       If RT$(661,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Node number(0-9,A-Z,10-99)? "
          Call IO.I
          If Len(Out2) Then
             Out2=Ucase$(Out2)
             Select Case Len(Out2)
             Case 1
                Select Case Out2
                Case "0" To "9" ' 1-10
                   Var=Val(Out2)+1
                   Mid$(UserRecord2.NodeList,Var+1,1)="0"
                   Strng="Node deactivated."
                   Call IO.O
                   If VarX Then
                      Call Read.Message.Record(MessWorkFile7,VarY+1)
                      MessWorkRecord7.NodeList2=UserRecord2.NodeList
                      MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^5
                      Call Write.Message.Record(MessWorkFile7,VarY+1)
                   Endif
                Case "A" To "Z" ' 11-26
                   Var=Asc(Out2)-54
                   Mid$(UserRecord2.NodeList,Var+1,1)="0"
                   Strng="Node deactivated."
                   Call IO.O
                   If VarX Then
                      Call Read.Message.Record(MessWorkFile7,VarY+1)
                      MessWorkRecord7.NodeList2=UserRecord2.NodeList
                      MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^5
                      Call Write.Message.Record(MessWorkFile7,VarY+1)
                   Endif
                End Select
             Case 2
                VarX2=Int(Val(Out2)) ' 37-126
                If VarX2>=10 And VarX2<=99 Then
                   Var=VarX2+27
                   Mid$(UserRecord2.NodeList,Var+1,1)="0"
                   Strng="Node deactivated."
                   Call IO.O
                   If VarX Then
                      Call Read.Message.Record(MessWorkFile7,VarY+1)
                      MessWorkRecord7.NodeList2=UserRecord2.NodeList
                      MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^5
                      Call Write.Message.Record(MessWorkFile7,VarY+1)
                   Endif
                Endif
             End Select
          Endif
       Endif
    Case "L"
       If RT$(662,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
       Continuous=False
       Graphics.Off=False
       Strng="Node access list:"
       Call IO.O
       Graphics.Off=True
       For Var=0 To 9
          Strng="Node:"+Str$(Var)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+2,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       Call More.Prompt
       If No Or Quit Then
          Goto End.Nodelist
       Endif
       For Var=11 To 23
          Strng="Node: "+Chr$(Var+54)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Goto End.Nodelist
          Endif
       Endif
       For Var=24 To 36
          Strng="Node: "+Chr$(Var+54)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Goto End.Nodelist
          Endif
       Endif
       For Var=37 To 57
          Strng="Node:"+Str$(Var-27)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Goto End.Nodelist
          Endif
       Endif
       For Var=58 To 77
          Strng="Node:"+Str$(Var-27)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Goto End.Nodelist
          Endif
       Endif
       For Var=78 To 97
          Strng="Node:"+Str$(Var-27)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Goto End.Nodelist
          Endif
       Endif
       For Var=98 To 117
          Strng="Node:"+Str$(Var-27)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       If Continuous=False Then
          Call More.Prompt
          If No Or Quit Then
             Goto End.Nodelist
          Endif
       Endif
       For Var=118 To 126
          Strng="Node:"+Str$(Var-27)+"="
          Strng=Strng+Space$(9-Len(Strng))
          If Mid$(UserRecord2.NodeList,Var+1,1)="0" Then
             Strng=Strng+"deactivated."
          Else
             Strng=Strng+"activated."
          Endif
          Call IO.O
       Next
       Call More.Prompt
       Endif
End.Nodelist:
    Case "Q"
       Exit Do
    End Select
 Loop
ErrExit4x:
 Exit Sub
ErrResume4x:
 Resume ErrExit4x
End Sub

Sub Edit.User.Commands(VarX,VarY)
 On Local Error Goto ErrResume4y

 ' open command restriction file
 FileName=DND.Path+"restrict.dat"
 Close #TempFile1
 Open FileName For Random Shared As #TempFile1 Len=13

 ' Byte 1/0, FromHour/FromMin/ToHour/ToMin, ClassType, Level.
 Field #TempFile1,1 As B$,2 As FH$,2 As FM$,2 As TH$,2 As TM$,2 As CL$,2 As LV$

 ' get record length of sum of all commands
 Records!=MaxUserCommands+MaxDMCommands+MaxSysopCommands+MaxNodeCommands
 RecLen!=Records!*13!

 ' init command string array
 Redim Temp.ArrayS(1 To Records!) As String

 ' init first record
 If Debug.Mode Then
    Strng="Record length="+Str$(Records!)+"."
    Call IO.O
 Endif
 If Lof(TempFile1)=0 Then
    If Debug.Mode Then
       Strng="Init user command file."
       Call IO.O
    Endif
    For Var!=1! To Records! ' 206 commands
       Lset B$="1"
       Lset FH$=Mki$(0)
       Lset FM$=Mki$(0)
       Lset TH$=Mki$(0)
       Lset TM$=Mki$(0)
       Lset CL$=Mki$(0)
       Lset LV$=MKi$(0)
       Put #TempFile1,Var!
    Next
 Endif
 If Debug.Mode Then
    Strng="Editing: "+FileName
    Call IO.O
 Endif
 ' get node number
 Do While Lost.Carrier=False
    Strng="Read commands from file:"
    Call IO.O
    Strng="Input node number(<enter>,0-9,A-Z,10-99)? "
    Call IO.I
    Out2=Ucase$(Out2)
    Select Case Len(Out2)
    Case 0
       Node1$=Nul
       Exit Do
    Case 1
       Select Case Out2
       Case "0" To "9" ' 1-10
          Node1$=Out2
          Exit Do
       Case "A" To "Z" ' 11-26
          Node1$=Out2
          Exit Do
       Case Else
          Strng="Bad node."
          Call IO.O
       End Select
    Case 2
       Var=Int(Val(Out2)) ' 37-126
       If Var>=10 And Var<=99 Then
          Node1$=Mid$(Str$(Var),2)
          Exit Do
       Else
          Strng="Bad node."
          Call IO.O
       Endif
    End Select
 Loop
 ' read .cfg file
 FileName=DND.Path+"dnd"+Node1$+".cfg"
 If Dir$(FileName)="" Then
    Strng=FileName+" not found."
    Call IO.O
    Exit Sub
 Endif
 Close #TempFile1
 Open FileName For Input Shared As #TempFile1
 ' read commands
 Input #TempFile1,V$
 For Temp=1 To MaxConfigArray1
    Input #TempFile1,V$
 Next
 For Temp=1 To MaxConfigArray2
    Input #TempFile1,V$
 Next
 For Temp=1 To MaxConfigArray3
    Line Input #TempFile1,V$
    Select Case Temp
    Case 9 ' DM command prefix
       Var1$=Rtrim$(V$)
       If Var1$="" Then
          Var1$="?"
       Endif
    Case 78 ' Node command prefix
       Var2$=Rtrim$(V$)
       If Var2$="" Then
          Var2$="?"
       Endif
    Case 79 ' Sysop command prefix
       Var3$=Rtrim$(V$)
       If Var3$="" Then
          Var3$="?"
       Endif
    End Select
 Next
 For Temp1=1 To 40
    Input #TempFile1,V$
 Next
 For Temp=1 To 20
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 10
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 8
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 10
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 7
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 12
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 10
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 4
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 3
    Line Input #TempFile1,V$
 Next
 For Temp=1 To 3
    Line Input #TempFile1,V$
 Next
 VarN=0
 For Temp1=1 To MaxUserCommands
    Z$=""
    Line Input #TempFile1,V$ ' abbreviation
    Line Input #TempFile1,V$ ' command
    Z$=Rtrim$(V$)
    Line Input #TempFile1,V$ ' synonym
    Line Input #TempFile1,V$ ' synonym
    Input #TempFile1,V% ' parameters
    Z$=Z$+":"+Str$(V%)
    For Temp2=1 To 14
       Input #TempFile1,V%
    Next
    VarN=VarN+1
    Temp.ArrayS(VarN)=Z$
 Next
 For Temp=1 To MaxDMCommands
    Line Input #TempFile1,V$ ' command
    Input #TempFile1,V% ' parameter
    Z$=Var1$+Rtrim$(V$)+":"+Str$(V%)
    VarN=VarN+1
    Temp.ArrayS(VarN)=Z$
    For Temp2=1 To 3
       Input #TempFile1,V%
    Next
 Next
 For Temp=1 To MaxSysopCommands
    Line Input #TempFile1,V$ ' command
    Input #TempFile1,V%
    Z$=Var3$+Rtrim$(V$)
    VarN=VarN+1
    Temp.ArrayS(VarN)=Z$
 Next
 For Temp=1 To MaxNodeCommands
    Line Input #TempFile1,V$ ' command
    Z$=Var2$+Rtrim$(V$)
    VarN=VarN+1
    Temp.ArrayS(VarN)=Z$
    For Temp2=1 To 8
       Input #TempFile1,V%
    Next
 Next
 ' open command restriction file
 FileName=DND.Path+"restrict.dat"
 Close #TempFile1
 Open FileName For Random Shared As #TempFile1 Len=13
 Field #TempFile1,1 As B$,2 As FH$,2 As FM$,2 As TH$,2 As TM$,2 As CL$,2 As LV$
 Do While Lost.Carrier=False
    If TempC=False Then
       Graphics.Off=False
       Strng="Command list activate:"
       Call IO.O
       Graphics.Off=True
       Strng=RT$(664,"[A]")+"dd record"
       Call IO.O
       Strng=RT$(665,"[C]")+"hange record"
       Call IO.O
       Strng=RT$(666,"[L]")+"ist record"
       Call IO.O
       Strng=RT$(667,"[U]")+"ser apply"
       Call IO.O
    Endif
    Graphics.Off=False
    Strng="Node list option(a/c/l/u/q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A" ' add new record
       If RT$(664,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          ' fixed 09/05/2019
          For Var!=1! To Records! ' 206 commands
             Lset B$="1"
             Lset FH$=Mki$(0)
             Lset FM$=Mki$(0)
             Lset TH$=Mki$(0)
             Lset TM$=Mki$(0)
             Lset CL$=Mki$(0)
             Lset LV$=MKi$(0)
             Var1!=Lof(TempFile1)/13!+1!
             Put #TempFile1,Var1!
          Next
          Strng="New record added."
          Call IO.O
          Strng="Records in file:"+Str$(Lof(TempFile1)/RecLen!)
          Call IO.O
          Call More.Prompt
       Endif
    Case "C"
       If RT$(665,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Enter record(1-"+Mid$(Str$(Lof(TempFile1)/RecLen!),2)+")? "
          Call IO.I
          Graphics.Off=True
          Var1!=Int(Val(Out2))
          If Var1!>0! And Var1!<=Lof(TempFile1)/RecLen! Then
             Strng="Command may contain number, for example, STEAL#2"
             Call IO.O
             Strng="Enter command/number? "
             Call IO.I
             If Len(Out2) Then
                Tmp2=0
                Tmp1=Instr(Out2,"#")
                If Tmp1 Then
                   Tmp2=Int(Val(Mid$(Out2,Tmp1+1)))
                   Out2=Left$(Out2,Tmp1-1)
                Endif
                Tmp1=0
                VarN!=Int(Val(Out2))
                If VarN!=0! Then
                   If Len(Out2) Then
                      For VarQ!=1! To Records!
                         If Left$(Rtrim$(Temp.ArrayS(VarQ!)),Len(Out2))=Ucase$(Out2) Then
                            Tmp1=Tmp1+1
                            If Tmp2=0 Or Tmp1=Tmp2 Then
                               VarN!=VarQ!
                               Exit For
                            Endif
                         Endif
                      Next
                   Endif
                Endif
                If VarN!>0! And VarN!<=Records! Then
                   VarR!=(Var1!-1!)*Records!+VarN!
                   Get #TempFile1,VarR!
                   Do While Lost.Carrier=False
                      If TempC=False Then
                         Graphics.Off=False
                         Strng="Command restrict menu:"
                         Call IO.O
                         Z$="Command: "+Rtrim$(Temp.ArrayS(VarN!))+" params = "
                         Gosub Display.Item
                         Graphics.Off=True
                         Strng=RT$(668,"[A]")+"ctivate command"
                         Call IO.O
                         Strng=RT$(669,"[D]")+"eactivate command"
                         Call IO.O
                         Strng=RT$(670,"[L]")+"evel restriction"
                         Call IO.O
                         Strng=RT$(671,"[R]")+"estrict classtype"
                         Call IO.O
                         Strng=RT$(672,"[T]")+"ime restriction"
                         Call IO.O
                      Endif
                      Graphics.Off=False
                      Strng="Command restrict option(a/d/l/r/t/q to quit)? "
                      Line.Length=TempD
                      No.Input.Out="Q"
                      Call IO.I
                      Select Case Ucase$(Out2)
                      Case "A" ' activate command
                         If RT$(668,"[A]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Get #TempFile1,VarR!
                            Lset B$="1"
                            Put #TempFile1,VarR!
                            Strng="Command activated."
                            Call IO.O
                         Endif
                      Case "D" ' deactivate command
                         If RT$(669,"[D]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Get #TempFile1,VarR!
                            Lset B$="0"
                            Put #TempFile1,VarR!
                            Strng="Command deactivated."
                            Call IO.O
                         Endif
                      Case "L" ' level
                         If RT$(670,"[L]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Strng="Enter level(0-32767)? "
                            Call IO.I
                            V=Int(Val(Out2))
                            If V=0 Then
                               Get #TempFile1,VarR!
                               Lset LV$=Mki$(0)
                               Put #TempFile1,VarR!
                               Strng="Command level restriction removed."
                               Call IO.O
                            Else
                               If V>0 And V<=32767 Then
                                  Get #TempFile1,VarR!
                                  Lset LV$=Mki$(V)
                                  Put #TempFile1,VarR!
                                  Strng="Command level restricted."
                                  Call IO.O
                               Endif
                            Endif
                         Endif
                      Case "R" ' classtype
                         If RT$(671,"[R]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            Do While Lost.Carrier=False
                               If TempC=False Then
                                  Graphics.Off=True
                                  For Temp3=1 To MaxClasses
                                     Strng=RT$(672+Temp3,"["+Chr$(64+Temp3)+"]")
                                     Strng=Strng+Rtrim$(Class.Name(Temp3))
                                     Call IO.O
                                  Next
                                  If Local.Mode Then
                                     Strng=RT$(681,"[I]")+Rtrim$(Class.Name(9))
                                     Call IO.O
                                     Strng=RT$(682,"[J]")+Rtrim$(Class.Name(10))
                                     Call IO.O
                                  Endif
                                  Strng=RT$(683,"[X]")+"None"
                                  Call IO.O
                               Endif
                               Graphics.Off=False
                               If Local.Mode Then
                                  Strng="Class option(a-j/x/q to quit)? "
                               Else
                                  Strng="Class option(a-h/x/q to quit)? "
                               Endif
                               Line.Length=TempD
                               No.Input.Out="Q"
                               Call IO.I
                               Temp$=Ucase$(Out2)
                               Select Case Temp$
                               Case "A" To "H"
                                  Temp3=Asc(Temp$)-64
                                  If RT$(672+Temp3,"[?]")="[*]" Then
                                     Strng="Command restricted.."
                                     Call IO.O
                                  Else
                                     Get #TempFile1,VarR!
                                     C=Cvi(CL$) ' toggle restriction
                                     If (C And 2^Temp3)=2^Temp3 Then
                                        C=C And Not 2^Temp3
                                        Strng="Classtype restriction removed."
                                     Else
                                        C=C Or 2^Temp3
                                        Strng="Classtype restriction added."
                                     Endif
                                     Lset CL$=Mki$(C)
                                     Put #TempFile1,VarR!
                                     Call IO.O
                                  Endif
                               Case "I", "J"
                                  If Local.Mode Then
                                     Temp3=Asc(Temp$)-64
                                     If RT$(672+Temp3,"[?]")="[*]" Then
                                        Strng="Command restricted.."
                                        Call IO.O
                                     Else
                                        Get #TempFile1,VarR!
                                        C=Cvi(CL$) ' toggle restriction
                                        If (C And 2^Temp3)=2^Temp3 Then
                                           C=C And Not 2^Temp3
                                           Strng="Classtype restriction removed."
                                        Else
                                           C=C Or 2^Temp3
                                           Strng="Classtype restriction added."
                                        Endif
                                        Lset CL$=Mki$(C)
                                        Put #TempFile1,VarR!
                                        Call IO.O
                                     Endif
                                  Endif
                               Case "X"
                                  If RT$(683,"[X]")="[*]" Then
                                     Strng="Command restricted.."
                                     Call IO.O
                                  Else
                                     Get #TempFile1,VarR!
                                     Lset CL$=Mki$(0)
                                     Put #TempFile1,VarR!
                                  Endif
                               Case "Q"
                                  Exit Do
                               End Select
                            Loop
                         Endif
                      Case "T" ' time
                         If RT$(672,"[T]")="[*]" Then
                            Strng="Command restricted.."
                            Call IO.O
                         Else
                            FromHour=0 : FromMin=0 : ToHour=0 : ToMin=0
                            Do While Lost.Carrier=False
                               No.Input.Out="0"
                               Strng="From Hour(0-23)? "
                               Call IO.I
                               FromHour=Int(Val(Out2))
                               If FromHour>=0 And FromHour<=23 Then
                                  Exit Do
                               Endif
                               Strng="Invalid time."
                               Call IO.O
                            Loop
                            Do While Lost.Carrier=False
                               No.Input.Out="0"
                               Strng="From Minute(0-59)? "
                               Call IO.I
                               FromMin=Int(Val(Out2))
                               If FromMin>=0 And FromMin<=59 Then
                                  Exit Do
                               Endif
                               Strng="Invalid time."
                               Call IO.O
                            Loop
                            Do While Lost.Carrier=False
                               No.Input.Out="0"
                               Strng="To Hour(0-23)? "
                               Call IO.I
                               ToHour=Int(Val(Out2))
                               If ToHour>=0 And ToHour<=23 Then
                                  Exit Do
                               Endif
                               Strng="Invalid time."
                               Call IO.O
                            Loop
                            Do While Lost.Carrier=False
                               No.Input.Out="0"
                               Strng="To Minute(0-59)? "
                               Call IO.I
                               ToMin=Int(Val(Out2))
                               If ToMin>=0 And ToMin<=59 Then
                                  Exit Do
                               Endif
                               Strng="Invalid time."
                               Call IO.O
                            Loop
                            If FromHour=0 And FromMin=0 And ToHour=0 And ToMin=0 Then
                               Get #TempFile1,VarR!
                               Lset FH$=Mki$(0)
                               Lset FM$=Mki$(0)
                               Lset TH$=Mki$(0)
                               Lset TM$=Mki$(0)
                               Put #TempFile1,VarR!
                               Strng="Command time restriction removed."
                               Call IO.O
                            Else
                               Get #TempFile1,VarR!
                               Lset FH$=Mki$(FromHour)
                               Lset FM$=Mki$(FromMin)
                               Lset TH$=Mki$(ToHour)
                               Lset TM$=Mki$(ToMin)
                               Put #TempFile1,VarR!
                               Strng="Command time restricted."
                               Call IO.O
                            Endif
                         Endif
                      Case "Q"
                         Exit Do
                      End Select
                   Loop
                Else
                   Strng="Command not found."
                   Call IO.O
                Endif
             Else
                Strng="Command not found."
                Call IO.O
             Endif
          Else
             Strng="Record number out of range."
             Call IO.O
          Endif
       Endif
    Case "L" ' list commands in a record
       If RT$(666,"[L]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          No.Input.Out="1"
          Strng="Enter record(1-"+Mid$(Str$(Lof(TempFile1)/RecLen!),2)+")? "
          Call IO.I
          Continuous=False
          Graphics.Off=True
          P=2
          VarZ=0
          Var1!=Int(Val(Out2))
          If Var1!>0! And Var1!<=Lof(TempFile1)/RecLen! Then
             Var$=""
             Strng="Command may contain number, for example, STEAL#2"
             Call IO.O
             Strng="Search for command(<enter>=all)?"
             Call IO.I
             Out2=Ucase$(Rtrim$(Ltrim$(Out2)))
             Tmp2=0
             If Len(Out2) Then
                Var$=Out2
                Tmp1=Instr(Var$,"#")
                If Tmp1 Then
                   Tmp2=Int(Val(Mid$(Var$,Tmp1+1)))
                   Var$=Left$(Var$,Tmp1-1)
                Endif
             Endif
             Tmp1=0
             Graphics.Off=True
             Gosub Display.Header
             For VarN!=1! To Records!
                Get #TempFile1,(Var1!-1!)*Records!+VarN!
                VarQ=-1
                If Len(Var$) Then
                   If Left$(Temp.ArrayS(VarN!),Len(Var$))=Var$ Then
                      Tmp1=Tmp1+1
                      If Tmp2=0 Or Tmp1=Tmp2 Then
                         Eat$=""
                      Else
                         VarQ=0
                      Endif
                   Else
                      VarQ=0
                   Endif
                Endif
                If VarQ Then
                   VarZ=-1
                   Z$=Mid$(Str$(VarN!),2)+"."
                   Z$=Z$+Space$(5-Len(Z$))
                   Q$=Rtrim$(Temp.ArrayS(VarN!))
                   Q$=Q$+Space$(15-Len(Q$))
                   Z$=Z$+Q$+" "
                   Gosub Display.Item
                   If Continuous=False Then
                      P=P+1
                      If P>=User.PageLength-2 Then
                         P=2
                         Call More.Prompt
                         If No Or Quit Then
                            Exit For
                         Endif
                         Gosub Display.Header
                      Endif
                   Endif
                Endif
             Next
             If VarZ=0 Then
                Strng="No items found."
                Call IO.O
             Endif
             If P>2 Then
                Call More.Prompt
             Endif
          Endif
       Endif
    Case "U"
       If RT$(667,"[U]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Strng="Enter record(0-"+Mid$(Str$(Lof(TempFile1)/RecLen!),2)+")? "
          Call IO.I
          Var1!=Int(Val(Out2))
          If Var1!>=0! And Var1!<=Lof(TempFile1)/RecLen! Then
             If Var1!=0! Then
                Strng="Record number removed from user."
             Else
                Strng="Record number added to user."
             Endif
             UserRecord2.NodeList2=Var1!
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.NodeList=Var1!
                MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^3
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Else
             Strng="Record number out of range."
          Endif
          Call IO.O
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
 Exit Sub
Display.Header:
 Strng="Command:Parameters   Status     <Time> (Class) [Level]"
 Call IO.O
 Strng="------------------   ---------"
 Call IO.O
 Return
Display.Item:
 If B$="1" Then
    Z$=Z$+"(enabled)  "
 Else
    Z$=Z$+"(disabled) "
 Endif
 FromHour=Cvi(FH$):FromMin=Cvi(FM$):ToHour=Cvi(TH$):ToMin=Cvi(TM$)
 If FromHour>0 Or FromMin>0 Or ToHour>0 Or ToMin>0 Then
    Z$=Z$+"<"+Right$("00"+Mid$(Str$(FromHour),2),2)+":"
    Z$=Z$+Right$("00"+Mid$(Str$(FromMin),2),2)+"-"
    Z$=Z$+Right$("00"+Mid$(Str$(ToHour),2),2)+":"
    Z$=Z$+Right$("00"+Mid$(Str$(ToMin),2),2)+"> "
 Endif
 C$=""
 ClassRestrict=Cvi(CL$)
 For C=1 To MaxClasses
    If (ClassRestrict And 2^C)=2^C Then
       C$=C$+Left$(Class.Name(C),1)+"/"
    Endif
 Next
 If (ClassRestrict And 2^9)=2^9 Then
    C$=C$+"A/"
 Endif
 If (ClassRestrict And 2^10)=2^10 Then
    C$=C$+"DM/"
 Endif
 If Len(C$) Then
    Z$=Z$+"("+Left$(C$,Len(C$)-1)+") "
 Endif
 LevelRestrict=Cvi(LV$)
 If LevelRestrict>0 Then
    Z$=Z$+"["+Mid$(Str$(LevelRestrict),2)+"]"
 Endif
 Strng=Z$
 Call IO.O
 Return
ErrExit4y:
 Exit Sub
ErrResume4y:
 Print "Error:";Err
 Resume ErrExit4y
End Sub

Sub Edit.User.Inv(VarX,VarY)
 On Local Error Goto ErrResume4z
 Strng="Encumbrance now: "
 Select Case UserRecord2.Encumbrance
 Case -1
    Strng=Strng+"Unlimited"
 Case 0
    Strng=Strng+"None"
 Case Else
    Strng=Strng+Form$(Cdbl(UserRecord2.Encumbrance))
 End Select
 Call IO.O
 Strng="Enter encumbrance(-1=unlimited,0 to 32767)? "
 Call IO.I
 If Len(Out2) Then
    Var3=Val(Out2)
    Select Case Var3
    Case -1,0 to 32767
       UserRecord2.Encumbrance=Var3
       If VarX Then
          Call Read.Message.Record(MessWorkFile7,VarY+1)
          MessWorkRecord7.Encumbrance=Var3
          MessWorkRecord7.Flags4=MessWorkRecord7.Flags4 Or 2^7
          Call Write.Message.Record(MessWorkFile7,VarY+1)
       Endif
    End Select
 Endif
 Do While Lost.Carrier=False
    Graphics.Off=True
    If TempC=False Then
       VarZ1!=SFalse
       VarZ2!=SFalse
       If VarX Then
          For Var4!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
             Call Read.Record(MessWorkFile6,Var4!)
             If MessWorkRecord6.User=Temp5! Then
                If MessWorkRecord6.Index<SFalse Then
                   VarZ1!=VarZ1!+1!
                Endif
                If MessWorkRecord6.Index>SFalse Then
                   VarZ2!=VarZ2!+1!
                Endif
             Endif
          Next
       Else
          Var4!=UserRecord2.First
          If Var4! Then
             Do While Lost.Carrier=False
                Call Read.Record(UserInvFile,Var4!)
                Var6!=MessWorkRecord6.Next
                If MessWorkRecord6.Index<SFalse Then
                   VarZ1!=VarZ1!+1!
                Endif
                If MessWorkRecord6.Index>SFalse Then
                   VarZ2!=VarZ2!+1!
                Endif
                If Var6!=SFalse Then
                   Exit Do
                Endif
                Var4!=Var6!
             Loop
          Endif
       Endif
       Strng=RT$(544,"[T]")+"reasure ("+Mid$(Str$(VarZ2!),2)+")"
       Call IO.O
       Strng=RT$(543,"[O]")+"bjects ("+Mid$(Str$(VarZ1!),2)+")"
       Call IO.O
       VarZ!=SFalse
       Var4!=UserRecord2.First2
       If Var4! Then
          Do While Lost.Carrier=False
             Call Read.Record(ContainerFile,Var4!)
             Var6!=ContainerRecord.Next
             If ContainerRecord.WithinContainer=SFalse Then
                If ContainerRecord.DeletedContainer=False Then
                   VarZ!=VarZ!+1!
                Endif
             Endif
             If Var6!=SFalse Then
                Exit Do
             Endif
             Var4!=Var6!
          Loop
       Endif
       Strng=RT$(545,"[C]")+"ontainers ("+Mid$(Str$(VarZ!),2)+")"
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="Inventory edit option(t/o/c/q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "T"
       If RT$(544,"[T]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Strng=RT$(549,"[A]")+"dd"
                Call IO.O
                Strng=RT$(550,"[D]")+"elete"
                Call IO.O
                Strng=RT$(551,"[L]")+"ist"
                Call IO.O
                Graphics.Off=False
             Endif
             Strng="Inventory treasure edit option(a/d/l/q to quit)? "
             Line.Length=TempD
             No.Input.Out="Q"
             Call IO.I
             Select Case Ucase$(Out2)
             Case "A"
                If RT$(549,"[A]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Call Find.Treasure
                   VarQ=False
                   If TempC! Then
                      If TreasureRecord.Container=False Then
                         Temp6=TreasureRecord.Charges
                         If VarX Then
                            Temp!=Lof(MessWorkFile6)/MessWorkRecLen6+1!
                            MessWorkRecord6.Room=SFalse
                            MessWorkRecord6.User=Temp5!
                            MessWorkRecord6.Index=TempC!
                            MessWorkRecord6.Charges=Temp6
                            MessWorkRecord6.Plus=False
                            Call Write.Record(MessWorkFile6,Temp!)
                            VarQ=True
                         Else
                            Temp!=Lof(UserInvFile)/MessWorkRecLen6+1!
                            MessWorkRecord6.Room=SFalse
                            MessWorkRecord6.User=Temp5!
                            MessWorkRecord6.Index=TempC!
                            MessWorkRecord6.Charges=Temp6
                            MessWorkRecord6.Plus=False
                            Call Add.List.Node3(Temp!)
                            VarQ=True
                         Endif
                      Endif
                   Endif
                   If VarQ=True Then
                      Strng="Treasure added to inventory."
                   Else
                      Strng="Treasure not added to inventory."
                   Endif
                   Call IO.O
                Endif
             Case "D"
                If RT$(550,"[D]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Strng="Number to delete? "
                   No.Input.Out="1"
                   Call IO.I
                   VarQ=False
                   Temp!=Int(Val(Out2))
                   TempX!=SFalse
                   If VarX Then
                      If Temp!>=SFalse And Temp!<=Lof(MessWorkFile6)/MessWorkRecLen6 Then
                         For Temp9!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
                            Call Read.Record(MessWorkFile6,Temp9!)
                            If MessWorkRecord6.User=Temp5! Then
                               If MessWorkRecord6.Index>SFalse Then
                                  TempX!=TempX!+1!
                                  If TempX!=Temp! Then
                                     MessWorkRecord6.User=SFalse
                                     MessWorkRecord6.Room=SFalse
                                     MessWorkRecord6.Index=SFalse
                                     MessWorkRecord6.Charges=False
                                     MessWorkRecord6.Plus=False
                                     MessWorkRecord6.Prev=SFalse
                                     MessWorkRecord6.Next=SFalse
                                     Call Write.Record(MessWorkFile6,Temp9!)
                                     VarQ=True
                                     Exit For
                                  Endif
                               Endif
                            Endif
                         Next
                      Endif
                   Else
                      If Temp!>=SFalse And Temp!<=Lof(UserInvFile)/MessWorkRecLen6 Then
                         Var4!=UserRecord2.First
                         If Var4! Then
                            Do While Lost.Carrier=False
                               Call Read.Record(UserInvFile,Var4!)
                               Var5!=MessWorkRecord6.Next
                               If MessWorkRecord6.Index>Sfalse Then
                                  TempX!=TempX!+1!
                                  If TempX!=Temp! Then
                                     Call Delete.List.Node3(Var4!)
                                     Call Clear.List.Node
                                     Call Write.Record(UserInvFile,Var4!)
                                     VarQ=True
                                     Exit Do
                                  Endif
                               Endif
                               If Var5!=SFalse Then
                                  Exit Do
                               Endif
                               Var4!=Var5!
                            Loop
                         Endif
                      Endif
                   Endif
                   If VarQ=True Then
                      Strng="Treasure deleted from inventory."
                   Else
                      Strng="Treasure not deleted from inventory."
                   Endif
                   Call IO.O
                Endif
             Case "L"
                If RT$(551,"[L]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Graphics.Off=True
                   TempX!=SFalse
                   VarQ=False
                   If VarX Then
                      VarZ=False
                      Allow.Break=True
                      Break=False
                      Continuous=False
                      For Temp4!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
                         Call Read.Record(MessWorkFile6,Temp4!)
                         If MessWorkRecord6.User=Temp5! Then
                            Temp!=MessWorkRecord6.Index
                            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
                               VarQ=True
                               If Break Then
                                  Exit For
                               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 For
                                     Endif
                                  Endif
                               Endif
                            Endif
                         Endif
                      Next
                   Else
                      VarZ=False
                      Allow.Break=True
                      Break=False
                      Continuous=False
                      Temp4!=UserRecord2.First
                      If Temp4! Then
                         Do While Lost.Carrier=False
                            Call Read.Record(UserInvFile,Temp4!)
                            Temp6!=MessWorkRecord6.Next
                            Temp!=MessWorkRecord6.Index
                            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
                               VarQ=True
                               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
                   Endif
                   Allow.Break=False
                   If VarQ=False Then
                      Strng="No treasure found."
                      Call IO.O
                   Endif
                   If VarZ Then
                      Call More.Prompt
                   Endif
                Endif
             Case "Q"
                Exit Do
             End Select
          Loop
       Endif
    Case "O"
       If RT$(543,"[O]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Strng=RT$(546,"[A]")+"dd"
                Call IO.O
                Strng=RT$(547,"[D]")+"elete"
                Call IO.O
                Strng=RT$(548,"[L]")+"ist"
                Call IO.O
                Graphics.Off=False
             Endif
             Strng="Inventory object edit option(a/d/l/q to quit)? "
             Line.Length=TempD
             No.Input.Out="Q"
             Call IO.I
             Select Case Ucase$(Out2)
             Case "A"
                If RT$(546,"[A]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Call Find.Object
                   VarQ=False
                   If TempD! Then
                      If VarX Then
                         Temp6!=Lof(MessWorkFile6)/MessWorkRecLen6+1!
                         MessWorkRecord6.Room=SFalse
                         MessWorkRecord6.User=Temp5!
                         MessWorkRecord6.Index=-TempD!
                         MessWorkRecord6.Charges=False
                         MessWorkRecord6.Plus=False
                         Call Write.Record(MessWorkFile6,Temp6!)
                         VarQ=True
                      Else
                         Temp6!=Lof(UserInvFile)/MessWorkRecLen6+1!
                         MessWorkRecord6.Room=SFalse
                         MessWorkRecord6.User=Temp5!
                         MessWorkRecord6.Index=-TempD!
                         MessWorkRecord6.Charges=False
                         MessWorkRecord6.Plus=False
                         Call Add.List.Node3(Temp6!)
                         VarQ=True
                      Endif
                   Endif
                   If VarQ=True Then
                      Strng="Object added to inventory."
                   Else
                      Strng="Object not added to inventory."
                   Endif
                   Call IO.O
                Endif
             Case "D"
                If RT$(547,"[D]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Strng="Number to delete? "
                   No.Input.Out="1"
                   Call IO.I
                   VarQ=False
                   Temp!=Int(Val(Out2))
                   TempX!=SFalse
                   If VarX Then
                      If Temp!>=SFalse And Temp!<=Lof(MessWorkFile6)/MessWorkRecLen6 Then
                         For Temp9!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
                            Call Read.Record(MessWorkFile6,Temp9!)
                            If MessWorkRecord6.User=Temp5! Then
                               If MessWorkRecord6.Index<SFalse Then
                                  TempX!=TempX!+1!
                                  If TempX!=Temp! Then
                                     MessWorkRecord6.User=SFalse
                                     MessWorkRecord6.Room=SFalse
                                     MessWorkRecord6.Index=SFalse
                                     MessWorkRecord6.Charges=False
                                     MessWorkRecord6.Plus=False
                                     MessWorkRecord6.Prev=SFalse
                                     MessWorkRecord6.Next=SFalse
                                     Call Write.Record(MessWorkFile6,Temp9!)
                                     VarQ=True
                                     Exit For
                                  Endif
                               Endif
                            Endif
                         Next
                      Endif
                   Else
                      If Temp!>=SFalse And Temp!<=Lof(UserInvFile)/MessWorkRecLen6 Then
                         Var4!=UserRecord2.First
                         If Var4! Then
                            Do While Lost.Carrier=False
                               Call Read.Record(UserInvFile,Var4!)
                               Var5!=MessWorkRecord6.Next
                               If MessWorkRecord6.Index<Sfalse Then
                                  TempX!=TempX!+1!
                                  If TempX!=Temp! Then
                                     Call Delete.List.Node3(Var4!)
                                     Call Clear.List.Node
                                     Call Write.Record(UserInvFile,Var4!)
                                     VarQ=True
                                     Exit Do
                                  Endif
                               Endif
                               If Var5!=SFalse Then
                                  Exit Do
                               Endif
                               Var4!=Var5!
                            Loop
                         Endif
                      Endif
                   Endif
                   If VarQ=True Then
                      Strng="Object deleted from inventory."
                   Else
                      Strng="Object not deleted from inventory."
                   Endif
                   Call IO.O
                Endif
             Case "L"
                If RT$(548,"[L]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Graphics.Off=True
                   TempX!=SFalse
                   VarQ=False
                   If VarX Then
                      VarZ=False
                      Allow.Break=True
                      Break=False
                      Continuous=False
                      For Temp4!=1! To Lof(MessWorkFile6)/MessWorkRecLen6
                         Call Read.Record(MessWorkFile6,Temp4!)
                         If MessWorkRecord6.User=Temp5! Then
                            Temp!=MessWorkRecord6.Index
                            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!
                                  VarQ=True
                                  Strng=Mid$(Str$(TempX!),2)+"."+Out3
                                  Call IO.O
                                  If Break Then
                                     Exit For
                                  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 For
                                        Endif
                                     Endif
                                  Endif
                               Endif
                            Endif
                         Endif
                      Next
                   Else
                      VarZ=False
                      Allow.Break=True
                      Break=False
                      Continuous=False
                      Temp4!=UserRecord2.First
                      If Temp4! Then
                         Do While Lost.Carrier=False
                            Call Read.Record(UserInvFile,Temp4!)
                            Temp6!=MessWorkRecord6.Next
                            Temp!=MessWorkRecord6.Index
                            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
                                  VarQ=True
                                  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
                   Endif
                   Allow.Break=False
                   If VarQ=False Then
                      Strng="No objects found."
                      Call IO.O
                   Endif
                   If VarZ Then
                      Call More.Prompt
                   Endif
                Endif
             Case "Q"
                Exit Do
             End Select
          Loop
       Endif
    Case "C"
       If RT$(545,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          Do While Lost.Carrier=False
             Graphics.Off=True
             If TempC=False Then
                Strng=RT$(552,"[A]")+"dd"
                Call IO.O
                Strng=RT$(553,"[D]")+"elete"
                Call IO.O
                Strng=RT$(580,"[L]")+"ist"
                Call IO.O
                Strng=RT$(581,"[Z]")+"ap"
                Call IO.O
                Graphics.Off=False
             Endif
             Strng="Inventory container edit option(a/d/l/z/q to quit)? "
             Line.Length=TempD
             No.Input.Out="Q"
             Call IO.I
             Select Case Ucase$(Out2)
             Case "A"
                If RT$(552,"[A]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   VarQ=False
                   Call Find.Treasure
                   If TempC! Then
                      If TreasureRecord.Container Then
                         Call Add.Container.To.User
                         VarQ=True
                      Endif
                   Endif
                   If VarQ=True Then
                      Strng="Container added to inventory."
                   Else
                      Strng="Container not added to inventory."
                   Endif
                   Call IO.O
                Endif
             Case "D"
                If RT$(553,"[O]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Strng="Number to delete? "
                   No.Input.Out="0"
                   Call IO.I
                   VarQ=False
                   Temp!=Int(Val(Out2))
                   TempX!=SFalse
                   If Temp!>=SFalse And Temp!<=Lof(ContainerFile)/ContainerRecLen Then
                      Var4!=UserRecord2.First2
                      If Var4! Then
                         Do While Lost.Carrier=False
                            Call Read.Record(ContainerFile,Var4!)
                            Var5!=ContainerRecord.Next
                            If ContainerRecord.WithinContainer=SFalse Then
                               If ContainerRecord.DeletedContainer=False Then
                                  TempX!=TempX!+1!
                                  If TempX!=Temp! Then
                                     Call Delete.User.Container(Var4!)
                                     Call Clear.Container.Node
                                     Call Write.Record(ContainerFile,Var4!)
                                     VarQ=True
                                     Exit Do
                                  Endif
                               Endif
                            Endif
                            If Var5!=SFalse Then
                               Exit Do
                            Endif
                            Var4!=Var5!
                         Loop
                      Endif
                   Endif
                   If VarQ=True Then
                      Strng="Container deleted from inventory."
                   Else
                      Strng="Container not deleted from inventory."
                   Endif
                   Call IO.O
                Endif
             Case "L"
                If RT$(580,"[L]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Graphics.Off=True
                   VarZ=False
                   Allow.Break=True
                   Break=False
                   Continuous=False
                   Var4!=UserRecord2.First2
                   TempX!=SFalse
                   VarQ=False
                   If Var4! Then
                      Do While Lost.Carrier=False
                         Call Read.Record(ContainerFile,Var4!)
                         Var6!=ContainerRecord.Next
                         If ContainerRecord.WithinContainer=SFalse Then
                            If ContainerRecord.DeletedContainer=False Then
                               Out3=ContainerRecord.ContainerName
                               Out3=Rtrim$(Out3)
                               Out3=Lcase$(Out3)
                               TempX!=TempX!+1!
                               Strng=Mid$(Str$(TempX!),2)+"."+Out3
                               If ContainerRecord.InvisibleContainer Then
                                  Strng=Strng+"[inv]"
                               Endif
                               Call IO.O
                               VarQ=True
                               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 Var6!=SFalse Then
                            Exit Do
                         Endif
                         Var4!=Var6!
                      Loop
                   Endif
                   Allow.Break=False
                   If VarQ=False Then
                      Strng="No containers found."
                      Call IO.O
                   Endif
                   If VarZ Then
                      Call More.Prompt
                   Endif
                Endif
             Case "Z"
                If RT$(581,"[Z]")="[*]" Then
                   Strng="Command restricted.."
                   Call IO.O
                Else
                   Graphics.Off=True
                   Strng="Delete all user containers(y/n)? "
                   No.Input.Out="N"
                   Call IO.I
                   If Yes Then
                      VarQ=False
                      Var4!=UserRecord2.First2
                      If Var4! Then
                         Do While Lost.Carrier=False
                            Call Read.Record(ContainerFile,Var4!)
                            Var6!=ContainerRecord.Next
                            Call Delete.User.Container(Var4!)
                            Call Clear.Container.Node
                            Call Write.Record(ContainerFile,Var4!)
                            VarQ=True
                            If Var6!=SFalse Then
                               Exit Do
                            Endif
                            Var4!=Var6!
                         Loop
                      Endif
                      UserRecord2.First2=SFalse
                      UserRecord2.Last2=SFalse
                      If VarQ=False Then
                         Strng="No user containers deleted."
                      Else
                         Strng="All user containers deleted."
                      Endif
                      Call IO.O
                   Endif
                Endif
             Case "Q"
                Exit Do
             End Select
          Loop
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
ErrExit4z:
 Exit Sub
ErrResume4z:
 Resume ErrExit4z
End Sub

Sub Edit.User.Stats(VarX,VarY)
 On Local Error Goto ErrResume4z2
 Do While Lost.Carrier=False
    Graphics.Off=True
    If TempC=False Then
       Strng=RT$(601,"[A]")+"Strength:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat1)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(1))
       Endif
       Call IO.O
       Strng=RT$(651,"[B]")+"Intelligence:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat2)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(2))
       Endif
       Call IO.O
       Strng=RT$(652,"[C]")+"Wisdom:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat3)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(3))
       Endif
       Call IO.O
       Strng=RT$(653,"[D]")+"Dexterity:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat4)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(4))
       Endif
       Call IO.O
       Strng=RT$(654,"[E]")+"Constitution:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat5)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(5))
       Endif
       Call IO.O
       Strng=RT$(655,"[F]")+"Piety:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat6)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(6))
       Endif
       Call IO.O
       Strng=RT$(656,"[G]")+"Charisma:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat7)
       Else
          Strng=Strng+Str$(UserRecord2.Stats(7))
       Endif
       Call IO.O
       Strng=RT$(657,"[H]")+"Beauty:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat8)
       Else
          Strng=Strng+Str$(UserRecord2.Beauty)
       Endif
       Call IO.O
       Strng=RT$(658,"[I]")+"Glamour:"
       If VarX Then
          Strng=Strng+Str$(MessWorkRecord7.Stat9)
       Else
          Strng=Strng+Str$(UserRecord2.Glamour)
       Endif
       Call IO.O
       Graphics.Off=False
    Endif
    Strng="Statistic(a-i, q to quit)? "
    Line.Length=TempD
    No.Input.Out="Q"
    Call IO.I
    Temp$=Ucase$(Out2)
    Select Case Temp$
    Case "A"
       If RT$(601,"[A]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Strength(1-32767)? "
          Else
             Strng="Strength(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(1)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat1=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^1
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "B"
       If RT$(651,"[B]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Intelligence(1-32767)? "
          Else
             Strng="Intelligence(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(2)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat2=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^2
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "C"
       If RT$(652,"[C]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Wisdom(1-32767)? "
          Else
             Strng="Wisdom(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(3)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat3=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^3
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "D"
       If RT$(653,"[D]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Dexterity(1-32767)? "
          Else
             Strng="Dexterity(1-250)? "
          Endif
          Call IO.I
          Temp3=int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(4)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat4=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^4
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "E"
       If RT$(654,"[E]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Constitution(1-32767)? "
          Else
             Strng="Constitution(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(5)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat5=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^5
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "F"
       If RT$(655,"[F]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Piety(1-32767)? "
          Else
             Strng="Piety(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(6)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat6=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^6
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "G"
       If RT$(656,"[G]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Charisma(1-32767)? "
          Else
             Strng="Charisma(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Stats(7)=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat7=Temp3
                MessWorkRecord7.Flags2=MessWorkRecord7.Flags2 Or 2^7
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "H"
       If RT$(657,"[H]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Beauty(1-32767)? "
          Else
             Strng="Beauty(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Beauty=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat8=Temp3
                MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^1
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "I"
       If RT$(658,"[I]")="[*]" Then
          Strng="Command restricted.."
          Call IO.O
       Else
          If Local.Mode Then
             Strng="Glamour(1-32767)? "
          Else
             Strng="Glamour(1-250)? "
          Endif
          Call IO.I
          Temp3=Int(Val(Out2))
          Var2=False
          If Local.Mode Then
             If Temp3>0 And Temp3<=32767 Then
                Var2=True
             Endif
          Else
             If Temp3>0 And Temp3<=250 Then
                Var2=True
             Endif
          Endif
          If Var2 Then
             UserRecord2.Glamour=Temp3
             If VarX Then
                Call Read.Message.Record(MessWorkFile7,VarY+1)
                MessWorkRecord7.Stat9=Temp3
                MessWorkRecord7.Flags5=MessWorkRecord7.Flags5 Or 2^2
                Call Write.Message.Record(MessWorkFile7,VarY+1)
             Endif
          Endif
       Endif
    Case "Q"
       Exit Do
    End Select
 Loop
ErrExit4z2:
 Exit Sub
ErrResume4z2:
 Resume ErrExit4z2
End Sub

Sub Display.Line(VarX2)
 On Local Error Goto ErrTrap11
 Strng=String$(VarX2,"-")
 Var=User.LineLength
 If Var>False Then
    If VarX2>Var Then
       Var=Var-2
       If Var>False Then
          Strng=String$(Var,"-")
       Else
          Strng=Nul
       Endif
    Endif
 Endif
 If Len(Strng) Then
    Call IO.O
 Endif
ErrResume11:
 Exit Sub
ErrTrap11:
 Resume ErrResume11
End Sub

Sub Search.Mess.File(Var1!,Var2)
 On Local Error Goto ErrMain41
 Var2=False
 For TempA=False To MaxNodes
    Call Read.Message.Record(MessWorkFile1,TempA+1)
    Var$=MessWorkRecord1.UserName
    Select Case Rtrim$(Lcase$(Var$))
    Case "login", "logoff", "relogin"
       TempB=False
    Case Deleted$, Offline$
       TempB=False
    Case Else
       TempB=True
    End Select
    If TempB Then
       If MessWorkRecord1.UserIndex=Var1! Then
          Var2=True
          Exit For
       Endif
    Endif
 Next
MainExit41:
 Exit Sub
ErrMain41:
 Resume MainExit41
End Sub
