 Rem File: Cmd150.bas
 Rem Sub: Multiple.Chain
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 150 -- Multi.Chain."
    Color 7,0
    End
 Endif
 Var=TempX
 Select Case Var
 Case 1 ' Call Display.Sorted.Inv
    Call Display.Sorted.Inv
 Case 2 ' Call Display.Sorted.Room
    Call Encounter.Permanent
    If Config2(55) Then
       Call Encounter.Offline.User
    Endif
    Call Display.Sorted.Room
 Case 3 ' Call Display.Inventory
    Call Display.Inventory
 Case 4 ' Call Display.Stats
    Call Display.Stats
 Case 5 ' Call Search.Room
    Call Search.Room ' 0 parameters
 Case 6 ' Call Search.Container/Call Search.User.Container
    If Instr(Parsed.command2," ") Then
       ' search box user
       Call Search.Container2 ' 2 parameters
    Else
       ' search box
       Call Search.Container ' 1 parameter
    Endif
 Case 7 ' search.exits
    Call Display.Hidden.Room.Exits
 End Select
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

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
 Else
    Strng="Nothing found."
    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

