 Rem File: Cmd204.bas
 Rem Sub: Reduce.Monsters
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 204 -- Reduce.Monsters."
    Color 7,0
    End
 Endif
 Call Reduce.Monsters
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Reduce.Monsters
 On Local Error Goto Error.Trap27
 Out2=Rtrim$(Parsed.Command1)
 Temp2!=Int(Val(Out2))
 If Temp2!<SFalse Then
    Temp2!=SFalse
 Endif
 Temp3!=SFalse
 For Temp5!=1! To Lof(MessWorkFile3)/MessWorkRecLen3
    Call Read.Record(MessWorkFile3,Temp5!)
    If MessWorkRecord3.Room=Room Then
       If MessWorkRecord3.AutoMode=False Then
          MessWorkRecord3.Room=SFalse
          Call Write.Record(MessWorkFile3,Temp5!)
          If Temp2!>SFalse Then
             Temp3!=Temp3!+1!
             If Temp3!>=Temp2! Then
                Exit For
             Endif
          Endif
       Endif
    Endif
 Next
 If Temp2!=SFalse Then
    Strng="All monsters removed.."
 Else
    Strng="Number of Monsters reduced by:"+Str$(Temp3!)+".."
 Endif
 Call IO.O
Error.Resume27:
 Exit Sub
Error.Trap27:
 Resume Error.Resume27
End Sub
