 Rem File: Dndsub8 for Dndbbs Version v5.0a Release r2.0 Tweak t5.0a
 Rem $Include: 'dndbbs.inc'
Sub Command.Response(VarX,VarZ$)
 On Local Error Goto Err.Trap3a
 VarQ$=VarZ$
 VarQ$=Ltrim$(VarQ$)
 VarQ$=Rtrim$(VarQ$)
 VarQ$=Lcase$(VarQ$)
 While Instr(VarQ$,"  ")
    TempP=Instr(VarQ$,"  ")
    VarQ$=Left$(VarQ$,TempP-1)+" "+Mid$(VarQ$,TempP+2)
 Wend
 VarX=False
 VarY=False
 For Temp2!=1! To Lof(MonTalkFile)/MonTalkRecLen
    Call Read.Record(MonTalkFile,Temp2!)
    Strng=Rtrim$(BufferRecord.Buffer)
    If Left$(Strng,1)=Chr$(34) Then
       Var=Instr(2,Strng,Chr$(34))
       If Var>1 Then
          Var$=Mid$(Strng,2)
          Var1$=Left$(Var$,Instr(Var$,Chr$(34))-1)
          Var2$=Mid$(Var$,Instr(Var$,Chr$(34))+1)
          If Len(Var1$)>False And Len(Var2$)>False Then
             Var1$=Lcase$(Var1$)
             If Var1$=VarQ$ Then
                VarY=VarY+1
             Endif
          Endif
       Endif
    Endif
 Next
 If VarY=False Then
    Exit Sub
 Endif
 VarX=True
 VarZ1=False
 VarZ2=Int(Rnd*VarY+1)
 For Temp2!=1! To Lof(MonTalkFile)/MonTalkRecLen
    Call Read.Record(MonTalkFile,Temp2!)
    Strng=Rtrim$(BufferRecord.Buffer)
    If Left$(Strng,1)=Chr$(34) Then
       Var=Instr(2,Strng,Chr$(34))
       If Var>1 Then
          Var$=Mid$(Strng,2)
          Var1$=Left$(Var$,Instr(Var$,Chr$(34))-1)
          Var2$=Mid$(Var$,Instr(Var$,Chr$(34))+1)
          If Len(Var1$)>False And Len(Var2$)>False Then
             Var1$=Lcase$(Var1$)
             If Var1$=VarQ$ Then
                VarZ1=VarZ1+1
                If VarZ1=VarZ2 Then
                   Strng=Var2$
                   Call IO.O
                   Exit Sub
                Endif
             Endif
          Endif
       Endif
    Endif
 Next
Err.Resume3a:
 Exit Sub
Err.Trap3a:
 Resume Err.Resume3a
End Sub

' called after enter.room cleanup when new.room=true,
'   and room variable is reset.
Sub Enter.New.Room
 On Local Error Goto Err.Trap10
 Call Check.Room.Number(Room)
 Monster.Rate1=False
 If Node>False Then
    If New.Room=True Then
       Out2=UserRecord.CodeName
       Out2=Rtrim$(Out2)
       Out2=Lcase$(Out2)
       Out2=Out2+" just entered the room."
       Call Send.Mess(8,SFalse,Room,Out2)
    Endif
 Endif
 New.Room=False
 Call Reset.Room.Rates
 Remote=-1
 If Room.Toggle Then
    TempX=2
    Last.Command.Number=85
    Call Chain.Command(150) ' Call Display.Sorted.Room
 Else
    Last.Command.Number=85
    Call Chain.Command(103) ' Call Display.Room
 Endif
 Strng="Room description command not available."
 Call IO.O
Err.Resume10:
 Exit Sub
Err.Trap10:
 Resume Err.Resume10
End Sub

' prepares new room for entry.
Sub Enter.Room
 On Local Error Goto Err.Trap11
 Call Check.Room.Number(Next.Room)
 Call Store.Perm.Monsters
 Call Monsters.Teleport
 Call Clean.Room.Node(Next.Room)
 If Ignore.Vehicle=False Then
    Call Remove.Vehicle2
 Endif
 Call New.Rates
 Call More.Room.Actions
 Call Enter.Room.Actions
 Call Clear.Container.Swap
 Call Update.Mess(4)
 Room.Rust.Rate=False
 Room.Steal.Rate=False
Err.Resume11:
 Exit Sub
Err.Trap11:
 Resume Err.Resume11
End Sub

' verifies next room number exists.
Sub Check.Room.Number(Temp.Room!)
 On Local Error Goto ErrorTrp35
 ' store last room number in room file.
 Last.Room!=Lof(RoomFile)/RoomRecLen
 Do While Security.Guard
    If Lost.Carrier Then
       Exit Do
    Endif
    ' check next room is within existing range.
    If Temp.Room!>SFalse And Temp.Room!<=Last.Room! Then
       Exit Do
    Endif
    ' if not, check to see if DM can create one.
    If Normal.User=False Then
       ' get DM create room.
       Call Add.Room(VarX)
       ' check room created.
       If VarX Then
          Exit Do
       Endif
    Endif
    ' if not, check default nondescrip room number to move to within range.
    Var!=Csng(Config2(15))
    If Var!>SFalse And Var!<=Last.Room! Then
       Temp.Room!=Var!
       Graphics.Off=False
       Strng="Nondescriptive room number!"
       Call IO.O
       Strng="Moving you to room"+Str$(Temp.Room!)+"."
       Call IO.O
       Exit Do
    Endif
    ' if not, check if room #1 within range.
    If Last.Room!>SFalse Then
       Temp.Room!=1!
       Graphics.Off=False
       Strng="Nondescriptive room number!"
       Call IO.O
       Strng="Moving you to room one."
       Call IO.O
       Exit Do
    Endif
    ' otherwise move to no existing room number.
    Temp.Room!=SFalse
    ' check for hangup due to nondescrip & nonexisting room.
    If Config2(16) Then
       Call Hang.Up(10)
    Endif
    ' return anyway!?
    Strng="Nondescriptive room file!"
    Call IO.O
    Exit Do
 Loop
ErrorRsm35:
 Exit Sub
ErrorTrp35:
 Resume ErrorRsm35
End Sub

' sets new.room=true to enter.new.room,
'   sets room variable to new room number.
Sub New.Rates
 On Local Error Goto Err.Trap14
 Room=Next.Room
 Call Read.Record(RoomFile,Room)
 Call Status.Line(False)
 Monster.Rate1=False
 New.Room=True
 Room.Rate=False
 Rust.Rate=False
 Steal.Rate=False
Err.Resume14:
 Exit Sub
Err.Trap14:
 Resume Err.Resume14
End Sub

' removes vehicle w/ message.
Sub Remove.Vehicle2
 On Local Error Goto Err.Trap15
 If Vehicle1 Then
    Call Pack.Vehicles
    Call Read.Record(TreasureFile,Vehicle3)
    Out3=TreasureRecord.ShortName
    Out3=Rtrim$(Out3)
    Out3=Lcase$(Out3)
    Strng="You exit the "+Out3+"."
    Call IO.O
    Var2$=UserRecord.CodeName
    Var2$=Rtrim$(Var2$)
    Var2$=Lcase$(Var2$)
    Mid$(Var2$,1,1)=UCase$(Mid$(Var2$,1,1))
    Var2$=Var2$+" exits the "+Var$+"!"
    Call Send.Vehicle(Var2$)
    Vehicle1=SFalse
    Vehicle2=False
    Vehicle3=SFalse
 Endif
Err.Resume15:
 Exit Sub
Err.Trap15:
 Resume Err.Resume15
End Sub

' removes vehicle w/o message.
Sub Remove.Vehicle
 On Local Error Goto Err.Trap15a
 If Vehicle1 Then
    Call Pack.Vehicles
    Vehicle1=SFalse
    Vehicle2=False
    Vehicle3=SFalse
 Endif
Err.Resume15a:
 Exit Sub
Err.Trap15a:
 Resume Err.Resume15a
End Sub

' send message to all vehicle passengers except user.index
Sub Send.Vehicle(Var$)
 On Local Error Goto ErrorTrap13x2
 Call Read.Record(RoomInvFile,Vehicle1)
 Call Read.Record(TreasureFile,Vehicle3)
 Var2!=MessWorkRecord6.User
 If Var2!<>User.Index Then
    Call Send.Mess(8,Var2!,Room,Var$)
 Endif
 If TreasureRecord.Occupants>False Then
    For Var2=1 To 4
       Var2!=MessWorkRecord6.Temp(Var2)
       If Var2!>SFalse And Var2!<=Lof(UserFile)/UserRecLen Then
          If Var2!<>User.Index Then
             Call Send.Mess(8,Var2!,Room,Var$)
          Endif
       Endif
    Next
 Endif
ErrorResume13x2:
 Exit Sub
ErrorTrap13x2:
 Resume ErrorResume13x2
End Sub

' remove user.index vehicle1 from vehicle array.
Sub Pack.Vehicles
 On Local Error Goto ErrorTrap13z2
 Call Read.Record(RoomInvFile,Vehicle1)
 Call Read.Record(TreasureFile,Vehicle3)
 If MessWorkRecord6.User=User.Index Then
    MessWorkRecord6.User=SFalse
    If TreasureRecord.Occupants>False Then
       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
    Endif
 Else
    For Var=1 To 4
       If MessWorkRecord6.Temp(Var)=User.Index Then
          For Var2=Var To 3
             MessWorkRecord6.Temp(Var2)=MessWorkRecord6.Temp(Var2+1)
          Next
          MessWorkRecord6.Temp(4)=SFalse
          Exit For
       Endif
    Next
 Endif
 Call Write.Record(RoomInvFile,Vehicle1)
ErrorResume13z2:
 Exit Sub
ErrorTrap13z2:
 Resume ErrorResume13z2
End Sub

Sub Reset.Room.Rates
 On Local Error Goto ErrorTrp36z
 Room.Monster.Rate=Config2(11)
 Room.Health.Rate=Config2(10)
 Call Read.Record(RoomFile,Room)
 Var!=RoomRecord.Action
 If Var!>SFalse And Var!<=Lof(ActionFile)/ActionRecLen Then
    Call Read.Record(ActionFile,Var!)
    If ActionRecord.RustRate>False Then
       Room.Rust.Rate=ActionRecord.RustRate
    Endif
    If ActionRecord.StealRate>False Then
       Room.Steal.Rate=ActionRecord.StealRate
    Endif
    If ActionRecord.EncounterRate Then
       Room.Monster.Rate=ActionRecord.EncounterRate
    Endif
    If ActionRecord.HealthRate Then
       Room.Health.Rate=ActionRecord.HealthRate
    Endif
 Endif
ErrorRsm36z:
 Exit Sub
ErrorTrp36z:
 Resume ErrorRsm36z
End Sub

Sub Store.Perm.Monsters
 On Local Error Goto Err.Trap12
 For Temp5!=1! To Lof(MessWorkFile3)/MessWorkRecLen3
    Call Read.Record(MessWorkFile3,Temp5!)
    If MessWorkRecord3.Room=Room Then
       If MessWorkRecord3.Monster.Permanent=True Then
          Temp2!=MessWorkRecord3.Index
          Call Read.Record(MonsterFile,Temp2!)
          MonsterRecord.Level=MessWorkRecord3.Monster.Level
          MonsterRecord.Hits=MessWorkRecord3.Monster.Hits
          Call Write.Record(MonsterFile,Temp2!)
       Endif
    Endif
 Next
Err.Resume12:
 Exit Sub
Err.Trap12:
 Resume Err.Resume12
End Sub

Sub Monsters.Teleport
 On Local Error Goto Err.Trap13
 Gosub Get.Config1
 If Option1=0 Then
    If UserRecord.ClassType>=Lady Then
       Exit Sub
    Endif
 Endif
 If Option2=0 Then
    Call Safe.Room2
    If TempA Then
       Exit Sub
    Endif
 Endif
 If Teleported Then
    Out3=" teleports with you!"
 Else
    Out3=" follows you!"
 Endif
 VarQ1=False
 VarQ2=False
 VarZ1=False
 VarZ2=False
 For Var1!=1! To Lof(MessWorkFile3)/MessWorkRecLen3
    Call Read.Record(MessWorkFile3,Var1!)
    If MessWorkRecord3.Room=Room Then
       TempA=False
       If MessWorkRecord3.Monster.Follow Then
          If Teleported Then
             If Rnd<(MessWorkRecord3.Monster.TeleportPercent/100) Then
                TempA=True
             Endif
          Else
             If Rnd<(MessWorkRecord3.Monster.FollowPercent/100) Then
                TempA=True
             Endif
          Endif
          If MessWorkRecord3.Monster.Permanent Then
             TempA=False
          Endif
          If MessWorkRecord3.Monster.RemainsInRoom=False Then
             TempA=False
          Endif
          If MessWorkRecord3.IsAutomaton Then
             TempA=False
          Endif
          If TempA Then
             VarY=False
             If Teleported Or Option3 Then
                Var2!=UserRecord.Weapon(4).Index ' left ring
                If Var2! Then
                   Call Read.Record(TreasureFile,Var2!)
                   If TreasureRecord.RingType=9 Then ' anti-teleport
                      Var3=UserRecord.Weapon(4).Charges
                      If Var3>False Then
                         VarQ1=VarQ1+1
                         VarY=True
                         Var3=Var3-1
                         UserRecord.Weapon(4).Charges=Var3
                         If Var3<=False Then
                            VarZ1=True
                            UserRecord.Weapon(4).Index=SFalse
                            UserRecord.Weapon(4).Charges=False
                            UserRecord.Weapon(4).Plus=False
                         Endif
                      Endif
                   Endif
                Endif
                If VarY=False Then
                   Var2!=UserRecord.Weapon(9).Index ' right ring
                   If Var2! Then
                      Call Read.Record(TreasureFile,Var2!)
                      If TreasureRecord.RingType=9 Then ' anti-teleport
                         Var3=UserRecord.Weapon(9).Charges
                         If Var3>False Then
                            VarQ2=VarQ2+1
                            VarY=True
                            Var3=Var3-1
                            UserRecord.Weapon(9).Charges=Var3
                            If Var3<=False Then
                               VarZ2=True
                               UserRecord.Weapon(9).Index=SFalse
                               UserRecord.Weapon(9).Charges=False
                               UserRecord.Weapon(9).Plus=False
                            Endif
                         Endif
                      Endif
                   Endif
                Endif
             Endif
             ' monster moves with player
             If VarY=False Then
                MessWorkRecord3.Room=Next.Room
                Call Write.Record(MessWorkFile3,Var1!)
                If MessWorkRecord3.Monster.Invisible=False Then
                   Out2=MessWorkRecord3.Monster.MonsterName
                   Out2=Lcase$(Rtrim$(Out2))
                   Strng="The "+Out2+Out3
                   Call IO.O
                Endif
             Endif
          Endif
       Endif
    Endif
 Next
 Teleported=False
 If VarQ1 Then
    If VarQ1=1 Then
       Strng="Your left ring absorbs a hit"
    Else
       Strng="Your left ring absorbs "+Form$(Cdbl(VarQ1))+" hits"
    Endif
    If VarZ1 Then
       Strng=Strng+" and disintegrated"
    Endif
    Strng=Strng+"!"
    Call IO.O
 Endif
 If VarQ2 Then
    If VarQ2=1 Then
       Strng="Your right ring absorbs a hit"
    Else
       Strng="Your right ring absorbs "+Form$(Cdbl(VarQ2))+" hits"
    Endif
    If VarZ2 Then
       Strng=Strng+" and disintegrated"
    Endif
    Strng=Strng+"!"
    Call IO.O
 Endif
 Exit Sub
Get.Config1:
 Option1=0
 Option2=0
 Option3=0
 VarX=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[TRAIN]" Then
       Do
          VarX=VarX+1
          If VarX>Options.Lines Then
             Return
          Endif
          Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
          If Ucase$(Var$)="[END]" Then
             Return
          Endif
          Var=Instr(Var$,"=")
          If Var Then
             Var2$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var3$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var2$)
             Case "override.classtype"
                Select Case Lcase$(Var3$)
                Case "-1", "true", "on"
                   Option1=-1
                End Select
             Case "override.saferoom"
                Select Case Lcase$(Var3$)
                Case "-1", "true", "on"
                   Option2=-1
                End Select
             Case "also.follow"
                Select Case Lcase$(Var3$)
                Case "-1", "true", "on"
                   Option3=-1
                End Select
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
Err.Resume13:
 Exit Sub
Err.Trap13:
 Resume Err.Resume13
End Sub

Sub Enter.Room.Actions
 On Local Error Goto Err.Trap16
 Var!=RoomRecord.Action
 If Var!>SFalse And Var!<=Lof(ActionFile)/ActionRecLen Then
    Call Read.Record(ActionFile,Var!)
    VarQ=ActionRecord.PoisonPercent
    If VarQ<0 Then
       VarQ=Abs(VarQ)
       If Int(Rnd*100+1)<=VarQ Then
          If UserRecord.Poison Then
             UserRecord.Poison=0
             Strng="As you enter the room you are curepoisoned!"
             Call IO.O
          Endif
       Endif
    Endif
 Endif
 Call Safe.Room
 If TempA Then
    Exit Sub
 Endif
 Var!=RoomRecord.Action
 If Var!>SFalse And Var!<=Lof(ActionFile)/ActionRecLen Then
    Call Read.Record(ActionFile,Var!)
    VarQ=ActionRecord.PoisonPercent
    If VarQ>0 Then
       If Int(Rnd*100+1)<=VarQ Then
          If UserRecord.Poison=0 Then
             UserRecord.Poison=-1
             Strng="As you enter the room you are poisoned!"
             Call IO.O
          Endif
       Endif
    Endif
    VarQ=ActionRecord.WishPercent
    If VarQ<0 Then
       VarQ=Abs(VarQ)
       If Int(Rnd*100+1)<=VarQ Then
          If UserRecord.WishsLeft>0 Then
             UserRecord.WishsLeft=UserRecord.WishsLeft-1
             Strng="As you enter the room you lose a wish!"
             Call IO.O
          Endif
       Endif
    Else
       If VarQ>0 Then
          If Int(Rnd*100+1)<=VarQ Then
             If UserRecord.WishsLeft>=0 And UserRecord.WishsLeft<MaxInt Then
                UserRecord.WishsLeft=UserRecord.WishsLeft+1
                Strng="As you enter the room you are granted a wish!"
                Call IO.O
             Endif
          Endif
       Endif
    Endif
    If ActionRecord.SpellTrigger=SFalse Then
       Var2=False
       For Var3=1 To 3
          If ActionRecord.AttackMonster(Var3)<>SFalse Then
             Var2=True
             Exit For
          Endif
          If ActionRecord.MonsterTalk(Var3)<>SFalse Then
             Var2=True
             Exit For
          Endif
          If ActionRecord.MonsterTrigger(Var3)<>SFalse Then
             Var2=True
             Exit For
          Endif
       Next
       If Var2=False Then
          If Normal.User=False Then
             Out3="As you enter room"+Str$(Next.Room)+","
          Else
             Out3="As you enter the room,"
          Endif
          Out4="You are hit for"
          Call Actions(Var!)
       Endif
    Endif
 Endif
Err.Resume16:
 Exit Sub
Err.Trap16:
 Resume Err.Resume16
End Sub

Sub More.Room.Actions
 On Local Error Goto Err.Trap17x
 Call Safe.Room
 If TempA Then
    Exit Sub
 Endif
 If Vehicle1 Then
    Exit Sub
 Endif
 Var5!=RoomRecord.First
 If Var5! Then
    Do While Lost.Carrier=False
       Call Read.Record(RoomInvFile,Var5!)
       If MessWorkRecord6.Room=SFalse Then
          Exit Do
       Endif
       Var6!=MessWorkRecord6.Next
       Var2!=MessWorkRecord6.Index
       If Var2!>SFalse And Var2!<=Lof(TreasureFile)/TreasureRecLen Then
          Call Read.Record(TreasureFile,Var2!)
          If (TreasureRecord.Edible And 1)=1 Then ' edible
             If (TreasureRecord.Edible And 2)=2 Then ' slippery
                Out3=TreasureRecord.TreasureName
                Out3=Rtrim$(Out3)
                Out3=Lcase$(Out3)
                Strng="As you enter the room,"
                Call IO.O
                Strng="You slip on "+Out3+"!"
                Call IO.O
                If Rnd>.5 Then
                   Var$=" left "
                Else
                   Var$=" right "
                Endif
                Select Case Rnd
                Case Is>.75
                   Strng="You broke your"+var$+"ankle!"
                Case Is>.5
                   Strng="You sprained your"+var$+"ankle!"
                Case Else
                   Strng="You hurt your"+var$+"ankle!"
                End Select
                Call IO.O
                Var=TreasureRecord.Plus
                If Var>False Then
                   Strng="You are hit for"
                   Out3="a slippery item"
                   Call Hit.Player(Var)
                Endif
                Exit Do
             Endif
          Endif
       Endif
       If Var6!=SFalse Then
          Exit Do
       Endif
       Var5!=Var6!
    Loop
 Endif
Err.Resume17x:
 Exit Sub
Err.Trap17x:
 Resume Err.Resume17x
End Sub

Sub Invisibility
 On Local Error Goto Err.Trap17
 Invisible=False
 UserRecord.Invisible=Not UserRecord.Invisible
 If UserRecord.Invisible Then
    Strng="You are invisible!"
 Else
    Strng="You are no longer invisible!"
 Endif
 Call IO.O
Err.Resume17:
 Exit Sub
Err.Trap17:
 Resume Err.Resume17
End Sub

Sub Brief.Mode
 On Local Error Goto Err.Trap18
 If UserRecord.Level<Config2(12) Then
    Strng="Brief mode not allowed until level"+Str$(Config2(12))+"."
    Call IO.O
    Exit Sub
 Endif
 UserRecord.Brief=Not UserRecord.Brief
 If UserRecord.Brief Then
    Action.Prompt=Config3(8)
    Strng="Brief mode on."
 Else
    Action.Prompt=Config3(7)
    Strng="Brief mode off."
 Endif
 If Rtrim$(Action.Prompt)=Nul Then
    If UserRecord.Brief Then
       Action.Prompt="Next:"
    Else
       Action.Prompt="Command>"
    Endif
    Strng="Default prompt."
 Endif
 If Right$(Action.Prompt,1)=Chr$(1) Then
    Action.Prompt=Left$(Action.Prompt,Len(Var$)-1)
 Endif
 Call IO.O
 UserRecord.ActionLineString=Action.Prompt
Err.Resume18:
 Exit Sub
Err.Trap18:
 Resume Err.Resume18
End Sub

Sub Relogin
 On Local Error Goto Err.Trap27
 Gosub Get.Config3
 If Bypass.Login Then
    Strng="You can't relogin during bypass login!"
    Call IO.O
    Exit Sub
 Endif
 If Option0 Then
    If Config2(67)=False Then
       Strng="You can't! Relogin is disabled!"
       Call IO.O
       Exit Sub
    Endif
 Endif
 If Option1 And Normal.User=False Then Goto Relog.Next
 If UserRecord.Level<Config2(67) Then
    Strng="You can't relogin until level "+Form$(Cdbl(Config2(67)))+"!"
    Call IO.O
    Exit Sub
 Endif
Relog.Next:
 If Config2(74) Then
    Strng="Are you sure you want to relogin(y/n)? "
    No.Input.Out="N"
    Call IO.I
 Endif
 If Yes Or Config2(74)=False Then
    Call Update.Mess(2)
    OutZ="relogged in"
    Relogging=True
    Security.Guard=False
    Bypass.Login=False
 Endif
 Exit Sub
Get.Config3:
 Option0=-1
 Option1=-1
 VarX=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[LOGIN]" Then
       Do
          VarX=VarX+1
          If VarX>Options.Lines Then
             Return
          Endif
          Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
          If Ucase$(Var$)="[END]" Then
             Return
          Endif
          Var=Instr(Var$,"=")
          If Var Then
             Var2$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var3$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var2$)
             Case "bypass.relogin.disabled"
                Select Case Lcase$(Var3$)
                Case "0","off","false"
                   Option0=False
                End Select
             Case "always.allow.dm.relogin"
                Select Case Lcase$(Var3$)
                Case "0","off","false"
                   Option1=False
                End Select
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
Err.Resume27:
 Exit Sub
Err.Trap27:
 Resume Err.Resume27
End Sub

Sub Suicide
 On Local Error Goto Err.Trap28
 Gosub Get.Config2
 If Normal.User=False Then
    Goto NextSuicide
 Endif
 If UserRecord.Stats(6)<=1 Then
    Strng="Your piety is low! You may commit suicide!"
    Call IO.O
    Goto NextSuicide
 Endif
 If UserRecord.Level=0 Then
    Strng="Your level is low! You may commit suicide!"
    Call IO.O
    Goto NextSuicide
 Endif
 If UserRecord.Stats(2)<Option1 Then
    Strng="Your intelligence is too low! "
    Strng=Strng+"Must be at least"+Str$(Option1)+"."
    Call IO.O
    Exit Sub
 Endif
 If UserRecord.Level<Option2 Then
    Strng="Your level is too low! "
    Strng=Strng+"Must be at least"+Str$(Option2)+"."
    Call IO.O
    Exit Sub
 Endif
NextSuicide:
 Strng="Are you sure you want to commit suicide(y/n)? "
 No.Input.Out="N"
 Call IO.I
 If Yes Then
    Graphics.Off=True
    Strng="Your character falls into a deep sleep.."
    Call IO.O
    Strng="   The Ghods take your player to another world.."
    Call IO.O
    Graphics.Off=False
    OutZ="committed suicide"
    If Node>False Then
       Call Send.Mess(4,SFalse,SFalse,OutZ)
    Endif
    If Rtrim$(NodeX)=Nul Then
       OutZ=OutZ+" (Node -)"
    Else
       OutZ=OutZ+" (Node "+NodeX+")"
    Endif
    Call Update.DayFile(OutZ,True,1)
    OutZ=Nul
    Call Clear.LogFile
    Call Clear.UserInv
    Call Clear.TeamFile
    Call Clear.ScrollFile
    Call Clear.Containers
    Call Clear.User.Inventory
    UserRecord.MaxCalls=False
    UserRecord.FromHour=False
    UserRecord.FromMin=False
    UserRecord.ToHour=False
    UserRecord.ToMin=False
    UserRecord.ClassType=False
    Strng=Deleted$
    Call Cryptograph(Strng)
    UserRecord.PassWord=Strng
    Strng=Deleted$
    Call Crypto(Strng)
    UserRecord.PassWord3=Strng
    UserRecord.PassWord2=Nul
    UserRecord.ClassName=Deleted$
    UserRecord.Flags=False
    UserRecord.Flags2=False
    UserRecord.WishsLeft=False
    Codename.Temp=Deleted$
    Password.Temp=Deleted$
    Call Init.NewUser
    UserRecord.First=SFalse
    UserRecord.Last=SFalse
    UserRecord.First2=SFalse
    UserRecord.Last2=SFalse
    Call Write.Record(UserFile,User.Index)
    Call Hang.Up(20)
 Endif
 Exit Sub
Get.Config2:
 Option1=3
 Option2=3
 VarX=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[LOGIN]" Then
       Do
          VarX=VarX+1
          If VarX>Options.Lines Then
             Return
          Endif
          Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
          If Ucase$(Var$)="[END]" Then
             Return
          Endif
          Var=Instr(Var$,"=")
          If Var Then
             Var2$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var3$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var2$)
             Case "required.intelligence"
                If Val(Var3$)>=1 And Val(Var3$)<=250 Then
                   Option1=Int(Val(Var3$)+.5)
                Endif
             Case "required.level"
                If Val(Var3$)>=1 And Val(Var3$)<=250 Then
                   Option2=Int(Val(Var3$)+.5)
                Endif
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
Err.Resume28:
 Exit Sub
Err.Trap28:
 Resume Err.Resume28
End Sub
