 Rem File: Cmd004.bas
 Rem Sub: Appeal
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 004 -- Appeal/Page.Sysop/Enter.Chat."
    Color 7,0
    End
 Endif
 If TempX<=0 Then ' appeal/page
    Call Check.Psi(VarX,TempX)
    If VarX=False Then
       Last.Command="<low psi>"
       Call Update.Mess(4)
       Goto Main.Resume
    Endif
 Endif
 Select Case TempX
 Case False
    Call Appeal
 Case True
    Call Page.Sysop
 Case 1
    Call Enter.Chat
 End Select
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Page.Sysop
 On Local Error Goto ErrorTrp34
 Gosub Get.Config2
 Chat.Annoy=Config2(68)
 If Chat.Annoy Then
    Filename=Data.Path1+"CHAT.TXT"
    If Dir$(Filename)<>Nul Then
       Call Out.File(Filename,"0")
    Else
       Strng="The Sysop does not want to be disturbed now.."
       Call IO.O
    Endif
    Exit Sub
 Endif
 If Config2(69)>False Then
    If UserRecord.Level<Config2(69) Then
       Filename=Data.Path1+"CHAT2.TXT"
       If Dir$(Filename)<>Nul Then
          Call Out.File(Filename,"0")
       Else
          Strng="The Sysop is not answering pages now.."
          Call IO.O
          Strng="You must be at least level "+Form$(Cdbl(Config2(69)))+" to page.."
          Call IO.O
       Endif
       Exit Sub
    Endif
 Endif
 Var$=Rtrim$(GuestRecord.PageTimes)
 If Len(Var$) Then
    Var=Instr(Var$,",")
    If Var=0 Then
       Var1$=Var$
       Var$=Nul
    Else
       Var1$=Left$(Var$,Var-1)
       Var$=Mid$(Var$,Var+1)
    Endif
    If Len(Var$) Then
       Var=Instr(Var$,",")
       If Var=0 Then
          Var2$=Var$
          Var$=Nul
       Else
          Var2$=Left$(Var$,Var-1)
          Var$=Mid$(Var$,Var+1)
       Endif
    Endif
    If Len(Var$) Then
       Var3$=Var$
    Endif
    VarX=False
    If Var1$<>Nul Then
       VarY$=Var1$
       Gosub Check.Time
    Endif
    If Var2$<>Nul Then
       VarY$=Var2$
       Gosub Check.Time
    Endif
    If Var3$<>Nul Then
       VarY$=Var3$
       Gosub Check.Time
    Endif
    If VarX Then
       Strng="Sorry, sysop has bad page time slot config.."
       Call IO.O
       If Sysop And Debug.Mode Then
          Strng="Error in "+Data.Path1+"GUEST"+NodeX+".CFG"
          Call IO.O
          Strng="PageTimes Slots are: 1="+Var1$+", 2="+Var2$+", 3="+Var3$
          Call IO.O
       Endif
       Call More.Prompt
       Goto Next.Time.Loop
       Exit Sub
    Endif      
    If Var1$<>Nul Then
       VarX$=Var1$
       Gosub Make.Time
       If Var1!>SFalse Or Var2!>SFalse Then
          Call Check.Time2(Var2,Var1!,Var2!)
          If Var2 Then
             Goto Start.Page2
          Endif
          VarR1=True
       Endif
    Endif
    If Var2$<>Nul Then
       VarX$=Var2$
       Gosub Make.Time
       If Var1!>SFalse Or Var2!>SFalse Then
          Call Check.Time2(Var2,Var1!,Var2!)
          If Var2 Then
             Goto Start.Page2
          Endif
          VarR2=True
       Endif
    Endif
    If Var3$<>Nul Then
       VarX$=Var3$
       Gosub Make.Time
       If Var1!>SFalse Or Var2!>SFalse Then
          Call Check.Time2(Var2,Var1!,Var2!)
          If Var2 Then
             Goto Start.Page2
          Endif
          VarR3=True
       Endif
    Endif
 Endif
Next.Time.Loop:
 For VarQ=1 To 9
    VarX$=Rtrim$(Temp.ArrayS(VarQ))
    If Len(VarX$) Then
       VarY$=VarX$
       Gosub Check.Time
       If VarX=False Then
          Gosub Make.Time
          If Var1!>SFalse Or Var2!>SFalse Then
             Call Check.Time2(Var2,Var1!,Var2!)
             If Var2 Then
                Goto Start.Page2
             Endif
             VarR4=True
          Endif
       Endif
    Endif
 Next
 If Sysop And Debug.Mode Then
    Strng="Sysop pages self.."
    Call IO.O
    Goto Start.Page2
 Endif
 If VarR1 Or VarR2 Or VarR3 Or VarR4 Then
    Filename=Data.Path1+"CHAT3.TXT"
    If Dir$(Filename)<>Nul Then
       Call Out.File(Filename,"0")
    Else
       Strng="Sysop is not available."
       Call IO.O
       If VarR1 Or VarR2 Or VarR3 Then
          Strng=Var1$
          If Len(Var2$) Then
             If Len(Var3$) Then
                Strng=Strng+", "+Var2$+", and "+Var3$
             Else
                Strng=Strng+", and "+Var2$
             Endif
          Endif
          Strng="Sysop page time slots are: "+Strng+"."
          Call IO.O
       Endif
    Endif
    If VarR4 Then
       Var$=Nul
       For VarX=1 To 9
          Var2$=Rtrim$(Temp.ArrayS(VarX))
          If Len(Var2$) Then
             Var$=Var$+Var2$+","
          Endif
       Next
       If Len(Var$) Then
          Var$=Left$(Var$,Len(Var$)-1)
          Strng="Additional Sysop page time slots are:"
          Call IO.O
          Strng=" "+Var$
          Call IO.O
       Endif
    Endif
    Exit Sub
 Endif
Start.Page2:
 Temp5=False
 Graphics.Off=True
 If Local.Mode Then
    Var$="Press <ctrl-break>/<ctrl-c> to interrupt."
 Else
    Var$="Press <control-c>/<control-k> to interrupt."
 Endif
 Strng="Paging Sysop. "+Var$
 Call IO.O
 Strng="Sysop hit <escape> to enter chat."+Chr$(13)+Chr$(10)
 Call Scrn(Strng)
 Strng="Paging Sysop:"
 Carriage.Return=True
 Call IO.O
 Chat=True
 Allow.Break=True
 Break=False
 Do While Chat
    If Option5 Then
       Call Playwav(2)
    Endif
    If Option6 Then
       Strng=Chr$(7)+Mask$
    Else
       Strng=Mask$
    Endif
    Carriage.Return=True
    Call IO.O
    Call Pause.Second
    Temp5=Temp5+1
    If Lost.Carrier Then
       Temp5=Option3
    Endif
    If Temp5>=Option3 Or Break Then
       If Lost.Carrier=-2 Then
          Call Scrn(Chr$(13)+Chr$(10))
          Call Status.Line(-2)
       Endif
       Allow.Break=False
       Break=False
       Call IO.O
       Exit Do
    Endif
 Loop
 If Chat Then
    Chat=False
    Strng="Sorry, the Sysop is not available.."
    Call IO.O
    Exit Sub
 Endif
 Call IO.O
 Chat=True
 Allow.Break=False
 Break=False
 Call Enter.Chat
 Chat=False
 Exit Sub

' convert time string
Make.Time:
 FromH=Val(Mid$(VarX$,1,2))
 FromM=Val(Mid$(VarX$,4,2))
 ToH=Val(Mid$(VarX$,7,2))
 ToM=Val(Mid$(VarX$,10,2))
 Var1!=Csng(FromH*3600!+FromM*60!)
 Var2!=Csng(ToH*3600!+ToM*60!)
 Return

' check time string
Check.Time:
 ' check 00:00-23:59 format
 VarX=False
 If Len(VarY$)<>11 Then
    VarX=True
    Return
 Endif
 For VarZ=1 To 11
    VarZ$=Mid$(VarY$,VarZ,1)
    Select Case VarZ
    Case 1, 2, 4, 5, 7, 8, 10, 11
       If VarZ$>="0" And VarZ$<="9" Then
          Eat$ = Nul
       Else
          VarX=True
          Return
       Endif
    Case 3, 9
       If VarZ$<>":" Then
          VarX=True
          Return
       Endif
    Case 6
       If VarZ$<>"-" Then
          VarX=True
          Return
       Endif
    End Select
 Next
 ' check hh:mm-hh:mm ranges
 HH=Val(Mid$(VarY$,1,2))
 If HH>=0 And HH<=23 Then
    Eat$=Nul
 Else
    VarX=True
    Return
 Endif
 HH=Val(Mid$(VarY$,7,2))
 If HH>=0 And HH<=23 Then
    Eat$=Nul
 Else
    VarX=True
    Return
 Endif
 MM=Val(Mid$(VarY$,4,2))
 If MM>=0 And MM<=59 Then
    Eat$=Nul
 Else
    VarX=True
    Return
 Endif
 MM=Val(Mid$(VarY$,10,2))
 If MM>=0 And MM<=59 Then
    Eat$=Nul
 Else
    VarX=True
    Return
 Endif
 Return
Get.Config2:
 Redim Temp.ArrayS(1 To 9) As String
 VarX=0
 Option3=10
 Option5=-1
 Option6=-1
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD004]" 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
             Var4$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var5$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             If Left$(Lcase$(Var4$),15)="sysop.page.time" Then
                VarQ=Int(Val(Mid$(Var4$,16)))
                If VarQ>=1 And VarQ<=9 Then
                   Temp.ArrayS(VarQ)=Var5$
                Endif
             Endif
             Select Case Lcase$(Var4$)
             Case "page.count"
                If Int(Val(Var5$))>=1 And Int(Val(Var5$))<=600 Then
                   Option3=Int(Val(Var5$))
                Endif
             Case "wav.sound"
                Select Case Lcase$(Var5$)
                Case "0","false","off"
                   Option5=0
                End Select
             Case "beep.sound"
                Select Case Lcase$(Var5$)
                Case "0","false","off"
                   Option6=0
                End Select
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
ErrorRsm34:
 Exit Sub
ErrorTrp34:
 Resume ErrorRsm34
End Sub

Sub Appeal
 On Local Error Goto ErrorTrap44
 Gosub Get.Config
 If UserRecord.Fatigue<UserRecord.FatigueMax*Config1(20) Then
    If GuestLogin Then
       Next.Room=GuestRecord.GuestRoomResurrect
    Else
       Next.Room=Int(Val(Config3(24)))
    Endif
    If Next.Room<>Room Then
       Strng="Your health is low.."
       Call IO.O
       If Debug.Mode Then
          Strng="You are teleported to room#"+Str$(Next.Room)+"."
       Else
          Strng="You are teleported elsewhere!"
       Endif
       Call IO.O
       Call Teleport
       Action.Recurse=0
       Call Enter.Room
       Exit Sub
    Endif
 Endif
 For Temp5=1 To MaxDirections
    If RoomRecord.Direct(Temp5) Then
       Strng="There are exits in the room!"
       Call IO.O
       Goto Page.Sysop0
       Exit Sub
    Endif
 Next
 Var$=Rtrim$(RoomRecord.Custom1)
 If Var$=String$(12,Chr$(0)) Then
    Var$=Nul
 Else
    If Len(Var$) Then
       If RoomRecord.Direct(13)>SFalse Then
          Strng="There are exits in the room!"
          Call IO.O
          Goto Page.Sysop0
          Exit Sub
       Endif
    Endif
 Endif
 Var$=Rtrim$(RoomRecord.Custom2)
 If Var$=String$(12,Chr$(0)) Then
    Var$=Nul
 Else
    If Len(Var$) Then
       If RoomRecord.Direct(14)>SFalse Then
          Strng="There are exits in the room!"
          Call IO.O
          Goto Page.Sysop0
          Exit Sub
       Endif
    Endif
 Endif
 Call Find.Custom3(VarX)
 If VarX Then
    Strng="There are exits in the room!"
    Call IO.O
    Goto Page.Sysop0
    Exit Sub
 Endif
 Temp5!=RoomRecord.First
 If Temp5! Then
    Do While Lost.Carrier=False
       Call Read.Record(RoomInvFile,Temp5!)
       If MessWorkRecord6.Room=SFalse Then
          Exit Do
       Endif
       Temp6!=MessWorkRecord6.Next
       Temp2!=MessWorkRecord6.Index
       If Temp2!<SFalse Then
          Temp2!=Abs(Temp2!)
          If Temp2!>SFalse And Temp2!<=Lof(ObjectFile)/ObjectRecLen Then
             Call Read.Record(ObjectFile,Temp2!)
             Call Return.Room(Var!)
             If Var!<>SFalse Then
                Var$=ObjectRecord.ShortName
                Var$=Rtrim$(Var$)
                Var$=Lcase$(Var$)
                Var2$=Left$(Var$,1)
                If Instr("aeiou",Var2$) Then
                   Strng="There is an "+Var$+" in the room!"
                Else
                   Strng="There is a "+Var$+" in the room!"
                Endif
                Call IO.O
                Goto Page.Sysop
                Exit Sub
             Endif
          Endif
       Endif
       If Temp6!=SFalse Then
          Exit Do
       Endif
       Temp5!=Temp6!
    Loop
 Endif
 If GuestLogin Then
    Next.Room=GuestRecord.GuestRoomResurrect
 Else
    Next.Room=Int(Val(Config3(24)))
 Endif
 If Next.Room<>Room Then
    Strng="Your right! There doesn't seem to be any way out!"
    Call IO.O
    If Debug.Mode Then
       Strng="You are teleported to room#"+Str$(Next.Room)+"."
    Else
       Strng="You are teleported elsewhere!"
    Endif
    Call IO.O
    Call Teleport
    Action.Recurse=0
    Call Enter.Room
    Exit Sub
 Endif
 Strng="Nothing happens!"
 Call IO.O
 Exit Sub
Page.Sysop0:
 Call Display.Hidden.Room.Exits
Page.Sysop:
 If Option1 Then
    If GuestLogin Then
       Next.Room=GuestRecord.GuestRoomResurrect
    Else
       Next.Room=Int(Val(Config3(24)))
    Endif
    If Next.Room<>Room Then
       Strng="Move to resurrection room anyway(y/n)? "
       Call IO.I
       If Yes Then
          Call Teleport
          Action.Recurse=0
          Call Enter.Room
          Exit Sub
       Endif
    Endif
 Endif
 If Option2=False Then
    Exit Sub
 Endif
 Strng="Do you want to appeal to the Ghods(y/n)? "
 Call IO.I
 If Yes Then
    Temp5=False
    Graphics.Off=True
    Strng="Sending appeal to the Ghods."
    Call IO.O
    Strng="User is appealing to the Ghods."+Chr$(13)+Chr$(10)
    Call Scrn(Strng)
    Gosub Start.Page
    If Temp5=False Then
       Strng="The Ghods are not available right now.."
       Call IO.O
    Endif
 Endif
 Exit Sub
Start.Page:
 Temp5=False
 Graphics.Off=True
 If Local.Mode Then
    Var$="Press <ctrl-break>/<ctrl-c> to interrupt."
 Else
    Var$="Press <control-c>/<control-k> to interrupt."
 Endif
 Strng="Paging Sysop. "+Var$
 Call IO.O
 Strng="Sysop hit <escape> to enter chat."+Chr$(13)+Chr$(10)
 Call Scrn(Strng)
 Strng="Paging Sysop:"
 Carriage.Return=True
 Call IO.O
 Chat=True
 Allow.Break=True
 Break=False
 Do While Chat
    If Option5 Then
       Call Playwav(2)
    Endif
    If Option6 Then
       Strng=Chr$(7)+Mask$
    Else
       Strng=Mask$
    Endif
    Carriage.Return=True
    Call IO.O
    Call Pause.Second
    Temp5=Temp5+1
    If Lost.Carrier Then
       Temp5=Option3
    Endif
    If Temp5>=Option3 Or Break Then
       If Lost.Carrier=-2 Then
          Call Scrn(Chr$(13)+Chr$(10))
          Call Status.Line(-2)
       Endif
       Allow.Break=False
       Break=False
       Call IO.O
       Exit Do
    Endif
 Loop
 If Chat Then
    Chat=False
    Strng="Sorry, the Sysop is not available.."
    Call IO.O
    Exit Sub
 Endif
 Call IO.O
 Chat=True
 Allow.Break=False
 Break=False
 Call Enter.Chat
 Chat=False
 Return
Get.Config:
 VarX=0
 Option1=-1
 Option2=-1
 Option3=10
 Option5=-1
 Option6=-1
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD004]" 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$=Lcase$(Ltrim$(Rtrim$(Left$(Var$,Var-1))))
             Var3$=Lcase$(Ltrim$(Rtrim$(Mid$(Var$,Var+1))))
             Select Case Var2$
             Case "allow.resurrect.room"
                Select Case Var3$
                Case "0", "false", "off"
                   Option1=False
                End Select
             Case "allow.appeal.page"
                Select Case Var3$
                Case "0", "false", "off"
                   Option2=False
                End Select
             Case "page.count"
                If Int(Val(Var3$))>=1 And Int(Val(Var3$))<=600 Then
                   Option3=Int(Val(Var3$))
                Endif
             Case "wav.sound"
                Select Case Lcase$(Var3$)
                Case "0","false","off"
                   Option5=0
                End Select
             Case "beep.sound"
                Select Case Lcase$(Var3$)
                Case "0","false","off"
                   Option6=0
                End Select
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
ErrorResume44:
 Exit Sub
ErrorTrap44:
 Resume ErrorResume44
End Sub

Sub Find.Custom3(Var)
 On Local Error Goto Err.Trp19a
 Var=False
 Filename=DND.Path+"custom.dat"
 If Dir$(Filename)<>"" Then
    Close #TempFile1
    Open Filename For Input Shared As #TempFile1
    Do
       If Eof(TempFile1) Then Exit Do
       Input #TempFile1,Var1$,Var1!,Var2!,X,Y
       Var1$=Ucase$(Left$(Var1$,12))
       If Len(Var1$) Then
          If Var1!=Room Then
             Var=True
             Exit Do
          Endif
       Endif
    Loop
 Endif
Err.Rsm19a:
 Exit Sub
Err.Trp19a:
 Resume Err.Rsm19a
End Sub

Sub Enter.Chat
 On Local Error Goto ErrorTrp35
 Gosub Get.Chat.Strings
 Graphics.Off=True
 Logged.Node=False
 Var1!=Timeon
 Var2!=Timeit!
 Var3!=Time.Left
 Timeon=Timeit!
 Time.Left=60
 Allow.Break=True
 Break=False
 Strng="Chat Mode.."
 Call IO.O
 Strng="Sysop press <escape> to exit, /? for help.."+Chr$(13)+Chr$(10)
 Call Scrn(Strng)
 Strng=Nul
 Call IO.O
 Call Chat.Status.Line
 Call Modem.ANSI(4,37,15)
 Call ScreenANSI(4,37,15)
 Do While Chat
    Timeon=Timeit!
    Time.Left=600!
    Word.Wrap=True
    Call Modem.ANSI(4,37,15)
    Call ScreenANSI(4,37,15)
    Graphics.Off=True
    Call IO.I
    If Out2="/?" Then
       Var=Local.Mode
       Local.Mode=True
       Strng="Chat mode function keys:"
       Call IO.O
       Strng="  Home -- Shell to editor."
       Call IO.O
       Strng="  Insert -- Shell to dndedit."
       Call IO.O
       Strng="  Delete -- Shell to dndcnfg"
       Call IO.O
       Strng="  Ctrl-Insert -- Shell to dndsic"
       Call IO.O
       Var$=Inline.Filename1
       If Len(Var$) Then
          If Dir$(Var$)<>"" Then
             Strng="  Keypad-5 -- Shell to "+Var$
             Call IO.O
          Endif
       Endif
       Var$=Inline.Filename2
       If Len(Var$) Then
          If Dir$(Var$)<>"" Then
             Strng="  Ctrl-Keypad-5 -- Shell to "+Var$
             Call IO.O
          Endif
       Endif
       Local.Mode=Var
    Endif
    Word.Wrap=False
    If Lost.Carrier Or Break Then
       Chat=False
       If Lost.Carrier=-2 Then
          Call Scrn(Chr$(13)+Chr$(10))
          Call Status.Line(-2)
       Endif
    Endif
 Loop
 Elapsed!=Fix(Timeit!-Var2!)
 If Elapsed!<0! Then
    Elapsed!=Elapsed!+86400!
 Endif
 Timeon=Var1!+Elapsed!
 Time.Left=Var3!
 Allow.Break=False
 Break=False
 Strng=Nul
 Out2=Nul
 Graphics.Off=False
 Call IO.O
 Strng="Exit chat.."
 Call IO.O
 Exit Sub
Get.Chat.Strings:
 Redim Temp.ArrayS(1 To 12) As String
 VarX=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CHAT]" 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)))
             If Left$(Lcase$(Var2$),4)="alt-" Then
                Var1$=Mid$(Var2$,5)
                Select Case Var1$
                Case "1" To "9"
                   Temp.ArrayS(Int(Val(Var1$)))=Var3$
                Case "0"
                   Temp.ArrayS(10)=Var3$
                Case "-"
                   Temp.ArrayS(11)=Var3$
                Case "+"
                   Temp.ArrayS(12)=Var3$
                End Select
             Endif
          Endif
       Loop
    Endif
 Loop
 Return
ErrorRsm35:
 Exit Sub
ErrorTrp35:
 Resume ErrorRsm35
End Sub

Sub Check.Psi(VarX, VarY)
 On Local Error Goto Error.Trap32a
 Gosub Get.Config3
 VarX=True
 If Normal.User Then
    If UserRecord.Psionic<Option3 Then
       VarX=False
       Strng="Psi is to low "
       If VarY=0 Then
          Strng=Strng+" to appeal."
       Else
          Strng=Strng+" to page."
       Endif
       Call IO.O
       Exit Sub
    Endif
    If Option4>0 Then
       Strng="Cost to "
       If VarY=0 Then
          Strng=Strng+"appeal is"
       Else
          Strng=Strng+"page is"
       Endif
       Strng=Strng+Str$(Option4)+" psionic points.."
       Call IO.O
       If UserRecord.Psionic-Option4<0 Then
          Strng="You don't have enough psionic points!"
          Call IO.O
          VarX=False
          Exit Sub
       Endif
       Strng="Are you sure you want to "
       If VarY=0 Then
          Strng=Strng+"appeal(y/n)?"
       Else
          Strng=Strng+"page(y/n)?"
       Endif
       No.Input.Out="N"
       Call IO.I
       If Yes Then
          UserRecord.Psionic=UserRecord.Psionic-Option4
          If UserRecord.Psionic<0 Then
             UserRecord.Psionic=0
          Endif
       Else
          VarX=False
       Endif
    Endif
 Endif
 Exit Sub
Get.Config3:
 VarX=0
 Option3=1
 Option4=1
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD004]" 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
             Var4$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var5$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var4$)
             Case "psi.value"
                If Int(Val(Var5$))>=0 And Int(Val(Var5$))<=600 Then
                   Option3=Int(Val(Var5$))
                Endif
             Case "decrease.psi.value"
                If Int(Val(Var5$))>=0 And Int(Val(Var5$))<=100 Then
                   Option4=Int(Val(Var5$))
                Endif
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
Error.Resume32a:
 Exit Sub
Error.Trap32a:
 Resume Error.Resume32a
End Sub

Sub Display.Hidden.Room.Exits
 On Local Error Goto ErrorTrp36e
 Temp=False
 VarQ=False
 Var!=RoomRecord.Action
 If Var!>SFalse And Var!<=Lof(ActionFile)/ActionRecLen Then
    Call Read.Record(ActionFile,Var!)
    VarQ=ActionRecord.Hidden
 Endif
 Strng="Hidden exits are "
 For Temp5=1 To MaxDirections
    If RoomRecord.Direct(Temp5) Then
       If (VarQ And 2^Temp5)=2^Temp5 Then
          Strng=Strng+Rtrim$(Direction(Temp5))+", "
          Temp=True
       Endif
    Endif
 Next
 Var$=Rtrim$(RoomRecord.Custom1)
 If Var$=String$(12,Chr$(0)) Then
    Var$=Nul
 Else
    If Len(Var$) Then
       If RoomRecord.Direct(13)>SFalse Then
          If (VarQ And 2^13)=2^13 Then
             Strng=Strng+Lcase$(Rtrim$(Var$))+", "
             Temp=True
          Endif
       Endif
    Endif
 Endif
 Var$=Rtrim$(RoomRecord.Custom2)
 If Var$=String$(12,Chr$(0)) Then
    Var$=Nul
 Else
    If Len(Var$) Then
       If RoomRecord.Direct(14)>SFalse Then
          If (VarQ And 2^14)=2^14 Then
             Strng=Strng+Lcase$(Rtrim$(Var$))+", "
             Temp=True
          Endif
       Endif
    Endif
 Endif
 Call Find.Custom4(Var, Var$)
 If Var Then
    Temp=True
    Strng=Strng+Var$
 Endif
 If Temp Then
    Strng=Left$(Strng,Len(Strng)-2)+"."
    Call IO.O
 Endif
ErrorRsm36e:
 Exit Sub
ErrorTrp36e:
 Resume ErrorRsm36e
End Sub

Sub Find.Custom4(Var, Var$)
 On Local Error Goto Err.Trp19a2
 Var=False
 Var$=""
 Line1=0
 Filename=DND.Path+"custom.dat"
 If Dir$(Filename)<>"" Then
    Close #TempFile1
    Open Filename For Input Shared As #TempFile1
    Do
       If Eof(TempFile1) Then Exit Do
       Line1=Line1+1
       Input #TempFile1,Var1$,Var1!,Var2!,X,Y
       Var1$=Lcase$(Rtrim$(Var1$))
       If Len(Var1$) Then
          If Var1!=Room Then
             If X Then ' invisible
                Var=True
                If Debug.Mode Then
                   If Y>0 Then ' level
                      Var1$=Var1$+"["+Ltrim$(Str$(Y))+"]"
                   Endif
                Endif
                Var$=Var$+Var1$+", "
             Endif
          Endif
       Endif
    Loop
 Endif
Err.Rsm19a2:
 Exit Sub
Err.Trp19a2:
 If Debug.Mode Then
    Strng="Error in " + Ucase$(Filename) + " in line"+Str$(Line1)+"."
    Call IO.O
 Endif
 Resume Err.Rsm19a2
End Sub

Sub Chat.Status.Line
 On Local Error Goto Error.Trap58
 Temp$=UserRecord.CodeName
 Temp$=Rtrim$(Temp$)
 Temp$=Lcase$(Temp$)
 Mid$(Temp$,1,1)=Ucase$(Mid$(Temp$,1,1))
 Temp$=Temp$+" > Chat Mode > "+Fclock$
 Temp$=Left$(Temp$,79)
 Temp$=Temp$+Space$(79-Len(Temp$))
 Call Display.Status.Line(True)
Error.Resume58:
 Exit Sub
Error.Trap58:
 Resume Error.Resume58
End Sub
