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

Sub Learn.Spell
 On Local Error Goto Err.Trap9
 Temp9=False
 For Temp2!=1! To Lof(SpellFile)/SpellRecLen
    If Config1(38)>SFalse Then
       If Temp2!>Config1(38) Then
          Exit For
       Endif
    Endif
    If Temp2!>Len(LearnedSpells) Then
       LearnedSpells=LearnedSpells+String$(Temp2!-Len(LearnedSpells),"0")
    Endif
    Call Read.Record(SpellFile,Temp2!)
    If Rtrim$(SpellRecord.SpellName)=Lcase$(Parsed.Command1) Then
       Temp9=True
       Exit For
    Endif
 Next
 If Temp9=False Then
    Strng="You can't learn that spell!"
    Call IO.O
    Exit Sub
 Endif
 Strng="Enter chant to learn: "
 Call IO.I
 Out2=Ucase$(Out2)
 If Rtrim$(SpellRecord.Chant)<>Out2 Then
    Strng="Wrong spell chant!"
    Call IO.O
    Exit Sub
 Endif
 Mid$(LearnedSpells,Temp2!,1)="1"
 Strng="You now memorize the spell!"
 Call IO.O
Err.Resume9:
 Exit Sub
Err.Trap9:
 Resume Err.Resume9
End Sub
