 Rem File: DndeditA for Dndbbs Version v5.0a Release r2.0 Tweak t5.0a
 Rem Sub: EditAction
 Rem $Include: 'dndedit.inc'

 On Error Goto Main.Error
 Call Stdin(Var)
 If Chained2=0 Then
    Call Init.Arrays
    Call Read.Rows(Var2)
    Max.Row=Var2
    Call Save.Screen(False)
    Call Clear.Screen2
    Call Init.Mouse
    Call Read.Config(False)
    Call Passwrd5(Var,"a")
    Close #TempFile1
    If Var=False Then
       Call Terminate.Program(True)
       End
    Endif
 Endif
Main.Resume:
 Call EditAction
 If Chained2 Then
    Chain DND.Path+"DNDEDIT.EXE"
 Endif
 Call Terminate.Program(True)
 End
Main.Error:
 Resume Main.Resume

Sub EditAction
 On Local Error Goto Error.Trap198
 Temp0=0 ' statusline
 Room.Action=1!
 If Lof(ActionFile)=SFalse Then
    Call AddAction
 Endif
 Out3="Sysop Action Edit"
 Call DisplayEditScreen(6,29,Out3)
 Call ActionStatusLine
 Call DisplayAction
 Do While Lost.Carrier=False
    TempX$=Nul
    Do While TempX$=Nul
       If Lost.Carrier Then
          Exit Do
       Endif
       Call Read.Keyboard(TempX$)
       Call MouseDriver(3)
       If Mouse.Button2 Then
          TempX$=Chr$(27)
       Endif
       If Mouse.Button Then
          Call MouseButton(29)
          If Len(TempX$) Then
             Exit Do
          Endif
       Endif
       If Mouse.Row Or Mouse.Column Then
          Call MouseSelect(29)
       Endif
    Loop
    TempX=False
    Select Case Len(TempX$)
    Case 2
       TempX=Asc(Mid$(TempX$,2,1))
       If TempX=0 Then
          Call Write.Record(ActionFile,Room.Action)
          Exit Do
       Endif
       Call ActionSelect
    Case 1
       TempX=Asc(TempX$)
       Select Case TempX
       Case 1
          Call AddAction
       Case 8
          Call Help(6)
          Out3="Sysop Action Edit"
          Call DisplayEditScreen(6,29,Out3)
          Call ActionStatusLine
          Call DisplayAction
       Case 9
          Call ActionSelect
       Case 13
          Call ActionEdit
          Call Write.Record(ActionFile,Room.Action)
          Call ActionStatusLine
          TempX=Selection
          Call ShowAction
          Call RedisplayField
       Case 14
          Call NextAction
       Case 17
          Call PreviousAction
       Case 18
          Call SelectNextAction
          Call ActionStatusLine
       Case 22 ' ^V
          ' 2,4,8,16,32,64,128,256,512,1024,2048,4096,8192
          VarX=False
          For Var=1 to 13
             VarX=VarX Or 2^Var
          Next
          ActionRecord.Restrictions=VarX
          Call Write.Record(ActionFile,Room.Action)
          Call DisplayAction
       Case 23 ' ^W
          Call SearchAction
          Call DisplayAction
       Case 24 ' ^X
          Call Clear.Actions
          Call DisplayAction
       Case 25 ' ^Y
          Call Clear.Actions2
          Call DisplayAction
       Case 26 ' ^Z
          ActionRecord.Restrictions=False
          Call Write.Record(ActionFile,Room.Action)
          Call DisplayAction
       Case 27
          Call Write.Record(ActionFile,Room.Action)
          Exit Sub
       Case 63 ' ?
          Temp0 = Not Temp0
          Call ActionStatusLine
       End Select
    End Select
 Loop
Error.Resume198:
 Exit Sub
Error.Trap198:
 Resume Error.Resume198
End Sub

Sub NextAction
 On Local Error Goto Error.Trap199
 If Room.Action>=Lof(ActionFile)/ActionRecLen Then
    Strng="This is the last action in the room file."
    Call ErrorMessage
 Else
    Call Write.Record(ActionFile,Room.Action)
    Room.Action=Room.Action+1!
    Call DisplayAction
 Endif
Error.Resume199:
 Exit Sub
Error.Trap199:
 Resume Error.Resume199
End Sub

Sub PreviousAction
 On Local Error Goto Error.Trap200
 If Room.Action>1! Then
    Call Write.Record(ActionFile,Room.Action)
    Room.Action=Room.Action-1!
    Call DisplayAction
    Exit Sub
 Endif
 Strng="This is the first action in the room file."
 Call ErrorMessage
Error.Resume200:
 Exit Sub
Error.Trap200:
 Resume Error.Resume200
End Sub

Sub SearchAction
 On Local Error Goto Error.Trap195
 Call Write.Record(ActionFile,Room.Action)
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field  "
 Out2=Out2+"Append # sign and number for duplicate spells"
 Call StatusLine
 Call ANSI(4,33,44)
 Call ANSI(2,23,2)
 Strng="Enter Spell Name or Number: "
 Call Scrn(Strng)
 Call ANSI(4,37,40)
 Call ANSI(2,23,30)
 Strng=Space$(30)
 Call Scrn(Strng)
 Restore Data9
 Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
 Edit.Data(1)=Nul
 Call ScreenEdit
 Call ActionStatusLine
 Temp2!=Int(Val(Edit.Data(1))+.5)
 Temp$=Lcase$(Edit.Data(1))
 If Temp2!>SFalse And Temp2!<=Lof(ActionFile)/ActionRecLen Then
    Room.Action=Temp2!
    Call DisplayAction
    Exit Sub
 Endif
 Temp.Index=SFalse
 Temp1=Instr(Temp$,"#")
 If Temp1 Then
    Temp.Index=Csng(Int(Val(Mid$(Temp$,Temp1+1))+.5))
    Temp$=Left$(Temp$,Temp1-1)
 Endif
 Temp4=Len(Temp$)
 Temp!=SFalse
 Temp3!=SFalse
 For Temp2!=1! To Lof(ActionFile)/ActionRecLen
    Call Read.Record(ActionFile,Temp2!)
    VarX!=ActionRecord.SpellTrigger
    If VarX!>0! And VarX!<=Lof(SpellFile)/SpellRecLen Then
       Call Read.Record(SpellFile,VarX!)
       Out3=Rtrim$(SpellRecord.SpellName)
       Out3=Lcase$(Out3)
       Temp$=Lcase$(Temp$)
       Call InstrSUB(TempX,Out3,Temp$)
       If TempX Then
          Temp3!=Temp3!+1!
          If Temp3!=1! Then
             Temp!=Temp2!
          Endif
          If Temp.Index Then
             If Temp3!=Temp.Index Then
                Room.Action=Temp2!
                Call DisplayAction
                Exit Sub
             Endif
          Endif
       Endif
    Endif
 Next
 If Temp.Index>SFalse Then
    Strng="The spell name was not found in the action file."
    Call ErrorMessage
    Call DisplayAction
    Exit Sub
 Endif
 If Temp3!=SFalse Then
    Strng="The spell name was not found in the action file."
    Call ErrorMessage
    Call DisplayAction
    Exit Sub
 Endif
 If Temp3!=1! Then
    Room.Action=Temp!
    Call DisplayAction
    Exit Sub
 Endif
 Strng="There was more than one spell found."
 Call ErrorMessage
 Strng="^ Scroll Spell  "+Chr$(60)+Chr$(217)+" Select Spell"
 Out2=Nul
 Call StatusLine
 Room.Action=Temp!
 Temp2!=Temp!
 Call Read.Record(ActionFile,Room.Action)
 Call DisplayAction
 Do While Lost.Carrier=False
    TempX$=Nul
    Do While TempX$=Nul
       If Lost.Carrier Then
          Exit Do
       Endif
       Call Read.Keyboard(TempX$)
       Call MouseDriver(3)
       If Mouse.Button2 Then
          TempX$=Chr$(27)
       Endif
       If Mouse.Button Then
          Call MouseCheck
          Exit Do
       Endif
    Loop
    TempX=False
    Select Case Len(TempX$)
    Case 1
       If TempX$=Chr$(13) Then
          Room.Action=Temp2!
          Call ActionStatusLine
          Call DisplayAction
          Exit Sub
       Endif
    Case 2
       TempX=Asc(Mid$(TempX$,2,1))
       Select Case TempX
       Case 72, 141, 152
          TempA=False
          For Temp3!=Temp2!-1! To 1! Step -1!
             Call Read.Record(ActionFile,Temp3!)
             VarX!=ActionRecord.SpellTrigger
             If VarX!>0! And VarX!<=Lof(SpellFile)/SpellRecLen Then
                Call Read.Record(SpellFile,VarX!)
                Out3=Rtrim$(SpellRecord.SpellName)
                Out3=Lcase$(Out3):Temp$=Lcase$(Temp$)
                Call InstrSUB(TempX,Out3,Temp$)
                If TempX Then
                   TempA=True
                   Temp2!=Temp3!
                   Room.Action=Temp3!
                   Call DisplayAction
                   Exit For
                Endif
             Endif
          Next
          If TempA=False Then
             Strng="This is the first spell in the search."
             Call ErrorMessage
          Endif
       Case 80, 145, 160
          TempA=False
          For Temp3!=Temp2!+1! To Lof(ActionFile)/ActionRecLen
             Call Read.Record(ActionFile,Temp3!)
             VarX!=ActionRecord.SpellTrigger
             If VarX!>0! And VarX!<=Lof(SpellFile)/SpellRecLen Then
                Call Read.Record(SpellFile,VarX!)
                Out3=Rtrim$(SpellRecord.SpellName)
                Out3=Lcase$(Out3):Temp$=Lcase$(Temp$)
                Call InstrSUB(TempX,Out3,Temp$)
                If TempX Then
                   TempA=True
                   Temp2!=Temp3!
                   Room.Action=Temp3!
                   Call DisplayAction
                   Exit For
                Endif
             Endif
          Next
          If TempA=False Then
             Strng="This is the last spell in the search."
             Call ErrorMessage
          Endif
       End Select
    End Select
 Loop
Error.Resume195:
 Exit Sub
Error.Trap195:
 Resume Error.Resume195
End Sub

Data9:
 Data 23,30,30,30,23,1,1

Sub SelectNextAction
 On Local Error Goto Error.Trap201
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field "
 Call StatusLine
 Call ANSI(4,33,44)
 Call ANSI(2,23,2)
 Strng="Enter Action: "
 Call Scrn(Strng)
 Call ANSI(4,37,40)
 Call ANSI(2,23,16)
 Strng=Space$(6)
 Call Scrn(Strng)
 Call ANSI(4,37,44)
 Call ANSI(2,23,25)
 Strng="(1-"+Mid$(Str$(Lof(ActionFile)/ActionRecLen),2)+")"
 Multiplier=Len(Strng)+25
 Strng=Strng+" (+/-/x)"
 Call Scrn(Strng)
 Restore Data10
 Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
 Edit.Data(1)=Nul
 Call ScreenEdit
 Multiplier=False
 Temp2!=Val(Edit.Data(1))
 If Temp2<=SFalse Or Temp2!>Lof(ActionFile)/ActionRecLen Then
    Strng="The action number is not within the room file range."
    Call ErrorMessage
    Exit Sub
 Endif
 Call Write.Record(ActionFile,Room.Action)
 Room.Action=Temp2!
 Call DisplayAction
Error.Resume201:
 Exit Sub
Error.Trap201:
 Resume Error.Resume201
End Sub

Data10:
 Data 23,16,16,6,23,1,1

Sub ActionStatusLine
 On Local Error Goto Error.Trap202
 If Temp0 Then
    Call ActionStatusLine2
    Exit Sub
 Endif
 Strng="^ Cursor Select "+Chr$(60)+Chr$(217)
 Strng=Strng+" Enter Choice <esc> Exit and Save ^h Help ^a Add Record"
 Out2="^n Next Action ^q Previous Action ^r Select Action ^w Search Spell ^? Toggle"
 Call StatusLine
Error.Resume202:
 Exit Sub
Error.Trap202:
 Resume Error.Resume202
End Sub

Sub ActionStatusLine2
 On Local Error Goto Error.Trap202x
 Strng="^ Cursor Select "+Chr$(60)+Chr$(217)
 Strng=Strng+" Enter Choice <esc> Exit and Save ^v Set All Restrictions"
 Out2="^x Clear Triggers ^y Clear Results ^z Clear Restrictions ^? Toggle"
 Call StatusLine
Error.Resume202x:
 Exit Sub
Error.Trap202x:
 Resume Error.Resume202x
End Sub

Sub DisplayAction
 On Local Error Goto Error.Trap197
 If Room.Action>SFalse And Room.Action<=Lof(ActionFile)/ActionRecLen Then
    Call Read.Record(ActionFile,Room.Action)
    For TempX=False To 29
       Call ShowAction
    Next
    Call RedisplayField
 Endif
Error.Resume197:
 Exit Sub
Error.Trap197:
 Resume Error.Resume197
End Sub

Sub AddAction
 On Local Error Goto Error.Trap117
 Room.Action=Lof(ActionFile)/ActionRecLen+1!
 ActionRecord.Attribute1=False
 ActionRecord.Attribute2=False
 ActionRecord.EncounterRate=False
 ActionRecord.Fumble=False
 ActionRecord.HealthRate=False
 ActionRecord.HitPoints=False
 ActionRecord.Inventory=False
 ActionRecord.InvPercent=False
 ActionRecord.InvNumber=False
 ActionRecord.Level=False
 ActionRecord.Restrictions=False
 ActionRecord.RustRate=False
 ActionRecord.SpellTrigger=SFalse
 ActionRecord.StealRate=False
 ActionRecord.Telepercent=False
 For Var2=1 To 3
    ActionRecord.AttackMonster(Var2)=SFalse
    ActionRecord.MonsterTalk(Var2)=SFalse
    ActionRecord.MonsterTrigger(Var2)=SFalse
 Next
 For Var2=1 To 5
    ActionRecord.Teleport(Var2)=SFalse
 Next
 ActionRecord.Hidden=False
 ActionRecord.ItemForSale=SFalse
 ActionRecord.WishPercent=False
 ActionRecord.PoisonPercent=False
 Call Write.Record(ActionFile,Room.Action)
 Call DisplayAction
 UserRecord.ObjectsCreated(1)=UserRecord.ObjectsCreated(1)+1#
 If User.Index Then
    Call Write.Record(UserFile,User.Index)
 Endif
Error.Resume117:
 Exit Sub
Error.Trap117:
 Resume Error.Resume117
End Sub

Sub Clear.Actions
 For Var2=1 To 3
    ActionRecord.AttackMonster(Var2)=SFalse
    ActionRecord.MonsterTalk(Var2)=SFalse
    ActionRecord.MonsterTrigger(Var2)=SFalse
 Next
 For Var2=1 To 5
    ActionRecord.Teleport(Var2)=SFalse
 Next
 Call Write.Record(ActionFile,Room.Action)
End Sub

Sub Clear.Actions2
 On Local Error Goto Error.Trap117x
 ActionRecord.Attribute1=False
 ActionRecord.Attribute2=False
 ActionRecord.EncounterRate=False
 ActionRecord.Fumble=False
 ActionRecord.HealthRate=False
 ActionRecord.HitPoints=False
 ActionRecord.Inventory=False
 ActionRecord.InvPercent=False
 ActionRecord.InvNumber=False
 ActionRecord.Level=False
 ActionRecord.Restrictions=False
 ActionRecord.RustRate=False
 ActionRecord.SpellTrigger=SFalse
 ActionRecord.StealRate=False
 ActionRecord.Telepercent=False
 ActionRecord.Hidden=False
 ActionRecord.ItemForSale=SFalse
 ActionRecord.WishPercent=False
 ActionRecord.PoisonPercent=False
 Call Write.Record(ActionFile,Room.Action)
Error.Resume117x:
 Exit Sub
Error.Trap117x:
 Resume Error.Resume117x
End Sub

Sub ShowAction
 On Local Error Goto Error.Trap33
 Select Case TempX
 Case 0
    Call ANSI(4,37,44)
    Call ANSI(2,3,2)
    Strng="Triggers"
    Call Scrn(Strng)
    Call ANSI(2,3,50)
    Strng="Results"
    Call Scrn(Strng)
    Call ANSI(2,2,16)
    Strng=Space$(8)
    Call Scrn(Strng)

    Call ANSI(4,33,44)
    Call ANSI(2,2,2)
    Strng="Action"
    Call Scrn(Strng)
    Call ANSI(2,2,18)
    Strng="of"
    Call Scrn(Strng)

    Call ANSI(4,37,40)
    Call ANSI(2,2,9)
    Strng=Space$(8)
    Call Scrn(Strng)
    Call ANSI(2,2,21)
    Strng=Space$(8)
    Call Scrn(Strng)

    Call ANSI(2,2,9)
    Strng=Mid$(Str$(Room.Action),2)
    Call Scrn(Strng)
    Var!=Lof(ActionFile)/ActionRecLen
    Call ANSI(2,2,21)
    Strng=Mid$(Str$(Var!),2)
    Call Scrn(Strng)

    Call ANSI(4,33,44)
    Call ANSI(2,7,2)
    Strng="and/or"
    Call Scrn(Strng)
    Call ANSI(4,37,44)
    Call ANSI(2,10,67)
    Strng="(1-10)"
    Call Scrn(Strng)
    Call ANSI(4,33,44)
    Call ANSI(2,13,50)
    Strng="Fatigue/Vitality"
    Call Scrn(Strng)
    Call ANSI(4,37,44)
    Call ANSI(2,17,2)
    Strng="Direction Restriction"
    Call Scrn(Strng)
    Call ANSI(2,20,2)
    Strng="All results are from entering a room unless indicated by a trigger."
    Call Scrn(Strng)
 Case Else
    Call ANSI(4,37,40)
    Select Case TempX
    Case 1
       Call ANSI(2,4,17)
       Strng=Space$(8)
       Call Scrn(Strng)
       Call ANSI(2,4,17)
       Var1=0
       For Var2=1 To 3
          If ActionRecord.MonsterTrigger(Var2)>0! Then
             Var1=Var1+1
          Endif
       Next
       Strng=Ltrim$(Str$(Var1))+" items"
       Call Scrn(Strng)
    Case 2
       Call ANSI(2,6,18)
       Strng=Space$(8)
       Call Scrn(Strng)
       Call ANSI(2,6,18)
       Var1=0
       For Var2=1 To 3
          If ActionRecord.MonsterTalk(Var2)>0! Then
             Var1=Var1+1
          Endif
       Next
       Strng=Ltrim$(Str$(Var1))+" items"
       Call Scrn(Strng)
    Case 3
       Call ANSI(2,8,14)
       Strng=Space$(8)
       Call Scrn(Strng)
       Call ANSI(2,8,14)
       Var1=0
       For Var2=1 To 5
          If ActionRecord.Teleport(Var2)>0! Then
             Var1=Var1+1
          Endif
       Next
       Strng=Ltrim$(Str$(Var1))+" items"
       Call Scrn(Strng)
       Call ANSI(4,33,44)
       Call ANSI(2,9,2)
       Strng="Monster attack:"
       Var1=0
       For Var2=1 To 3
          If ActionRecord.AttackMonster(Var2)>0! Then
             Var1=Var1+1
          Endif
       Next
       Strng=Strng+Str$(Var1)+" items"
       Call Scrn(Strng)
    Case 4
       Call ANSI(2,11,2)
       If ActionRecord.SpellTrigger<=SFalse Or _
       ActionRecord.SpellTrigger>Lof(SpellFile)/SpellRecLen Then
          Strng="<none>"
          Call Scrn(Strng)
          Strng=Space$(24)
          Call Scrn(Strng)
       Else
          Call Read.Record(SpellFile,ActionRecord.SpellTrigger)
          Strng=Left$(SpellRecord.SpellName,30)
          Call Scrn(Strng)
       Endif
    Case 5
       Call ANSI(2,13,14)
       Strng=Space$(5)
       Call Scrn(Strng)
       Call ANSI(2,13,14)
       Strng=Mid$(Str$(Abs(ActionRecord.Level)),2)
       Call Scrn(Strng)
    Case 6
       Call ANSI(2,15,16)
       Strng=Space$(3)
       Call Scrn(Strng)
       Call ANSI(2,15,16)
       Strng="n/a"
       If ActionRecord.Level<False Then
          Strng="min"
       Endif
       If ActionRecord.Level>False Then
          Strng="max"
       Endif
       Call Scrn(Strng)
    Case 7
       Call ANSI(2,18,4)
       If ActionRecord.Restrictions And 2 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 8
       Call ANSI(2,18,9)
       If ActionRecord.Restrictions And 4 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 9
       Call ANSI(2,18,14)
       If ActionRecord.Restrictions And 8 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 10
       Call ANSI(2,18,19)
       If ActionRecord.Restrictions And 16 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 11
       Call ANSI(2,18,25)
       If ActionRecord.Restrictions And 32 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 12
       Call ANSI(2,18,31)
       If ActionRecord.Restrictions And 64 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 13
       Call ANSI(2,18,37)
       If ActionRecord.Restrictions And 128 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 14
       Call ANSI(2,18,43)
       If ActionRecord.Restrictions And 256 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 15
       Call ANSI(2,18,49)
       If ActionRecord.Restrictions And 512 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 16
       Call ANSI(2,18,57)
       If ActionRecord.Restrictions And 1024 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 17
       Call ANSI(2,18,63)
       If ActionRecord.Restrictions And 2048 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 18
       Call ANSI(2,18,70)
       If ActionRecord.Restrictions And 4096 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 19
       Call ANSI(2,18,76)
       If ActionRecord.Restrictions And 8192 Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 20
       Call ANSI(2,4,62)
       Strng=Space$(5)
       Call Scrn(Strng)
       Call ANSI(2,4,62)
       Strng=Mid$(Str$(ActionRecord.HealthRate),2)
       Call Scrn(Strng)
    Case 21
       Call ANSI(2,6,65)
       Strng=Space$(5)
       Call Scrn(Strng)
       Call ANSI(2,6,65)
       Strng=Mid$(Str$(ActionRecord.EncounterRate),2)
       Call Scrn(Strng)
    Case 22
       Call ANSI(2,8,57)
       If ActionRecord.Fumble Then
          Call Scrn("Y")
       Else
          Call Scrn("N")
       Endif
    Case 23
       Call ANSI(2,10,74)
       Strng="  "
       Call Scrn(Strng)
       Call ANSI(2,10,74)
       Strng="?"
       Select Case ActionRecord.Inventory
       Case 1 To 10
          Strng=Mid$(Str$(ActionRecord.Inventory),2)
       End Select
       Call Scrn(Strng)
    Case 24
       Call ANSI(2,12,64)
       Select Case ActionRecord.HitPoints
       Case Is<False
          Strng="V"
       Case Is>False
          Strng="F"
       Case False
          Strng="?"
       End Select
       Call Scrn(Strng)
    Case 25
       Call ANSI(2,13,67)
       Strng=Space$(5)
       Call Scrn(Strng)
       Call ANSI(2,13,67)
       Strng=Mid$(Str$(Abs(ActionRecord.HitPoints)),2)
       Call Scrn(Strng)
    Case 26
       Call ANSI(2,15,60)
       Strng=Space$(4)
       Call Scrn(Strng)
       Call ANSI(2,15,60)
       Strng=Mid$(Str$(ActionRecord.RustRate),2,4)
       Call Scrn(Strng)
    Case 27
       Call ANSI(2,15,76)
       Strng=Space$(4)
       Call Scrn(Strng)
       Call ANSI(2,15,76)
       Strng=Mid$(Str$(ActionRecord.StealRate),2,4)
       Call Scrn(Strng)
    Case 28
       Call ANSI(2,16,68)
       Strng=Space$(3)
       Call Scrn(Strng)
       Call ANSI(2,16,68)
       Strng=Mid$(Str$(ActionRecord.InvPercent),2,3)
       Call Scrn(Strng)
    Case 29
       Call ANSI(2,17,61)
       Strng=Space$(5)
       Call Scrn(Strng)
       Call ANSI(2,17,61)
       Strng=Mid$(Str$(ActionRecord.InvNumber),2,5)
       Call Scrn(Strng)
    End Select
 End Select
Error.Resume33:
 Exit Sub
Error.Trap33:
 Resume Error.Resume33
End Sub

Sub ActionEdit
 On Local Error Goto Error.Trap41
 Static Hits.Temp
 Restore ActionEditData
 For TempX=1 To Selection
    Read Xcoor, Ycoor, Column, Line.Length, Max.Lines, Row, Line.Number
 Next
 Select Case Selection
 Case 1
    'Edit.Data(1)=Mid$(Str$(ActionRecord.MonsterTrigger(1)),2)
 Case 2
    'Edit.Data(1)=Mid$(Str$(ActionRecord.MonsterTalk(1)),2)
 Case 3
    'Edit.Data(1)=Mid$(Str$(ActionRecord.Teleport(1)),2)
 Case 4
    If ActionRecord.SpellTrigger>SFalse And _
    ActionRecord.SpellTrigger<=Lof(SpellFile)/SpellRecLen Then
       Call Read.Record(SpellFile,ActionRecord.SpellTrigger)
       Edit.Data(1)=Left$(SpellRecord.SpellName,30)
    Else
       Call ANSI(4,37,40)
       Call ANSI(2,11,2)
       Strng=Space$(30)
       Call Scrn(Strng)
       Edit.Data(1)=Space$(30)
    Endif
 Case 5
    VarA=False
    If ActionRecord.Level<False Then
       VarA=True
    Endif
    Edit.Data(1)=Mid$(Str$(Abs(ActionRecord.Level)),2)
 Case 6
    If ActionRecord.Level<False Then
       Edit.Data(1)="min"
    Else
       If ActionRecord.Level>False Then
          Edit.Data(1)="max"
       Else
          Edit.Data(1)="n/a"
       Endif
    Endif
 Case 7 To 19
    If ActionRecord.Restrictions And 2^(Selection-6) Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 20
    Edit.Data(1)=Mid$(Str$(ActionRecord.HealthRate),2)
 Case 21
    Edit.Data(1)=Mid$(Str$(ActionRecord.EncounterRate),2)
 Case 22
    If ActionRecord.Fumble Then
       Edit.Data(1)="Y"
    Else
       Edit.Data(1)="N"
    Endif
 Case 23
    Call MakeBox(3,35,14,47)
    Call ANSI(4,37,40)
    Strng="Inv"
    Call ANSI(2,3,40)
    Call Scrn(Strng)
    For V=1 To 10
       Strng=Mid$(Str$(V),1)+"="
       Strng=Strng+InventoryNames(V)
       Strng=Left$(Strng,11)
       Strng=Strng+Space$(11-Len(Strng))
       Call ANSI(2,V+3,36)
       Call Scrn(Strng)
    Next
    Select Case ActionRecord.Inventory
    Case 1 To 10
       Edit.Data(1)=Mid$(Str$(ActionRecord.Inventory),2)
    Case Else
       Edit.Data(1)="?"
    End Select
 Case 24
    Edit.Data(1)="?"
    If ActionRecord.HitPoints>False Then
       Edit.Data(1)="F"
    Endif
    If ActionRecord.HitPoints<False Then
       Edit.Data(1)="V"
    Endif
 Case 25
    Edit.Data(1)=Mid$(Str$(Abs(ActionRecord.HitPoints)),2)
 Case 26
    Edit.Data(1)=Mid$(Str$(ActionRecord.RustRate),2,4)
 Case 27
    Edit.Data(1)=Mid$(Str$(ActionRecord.StealRate),2,4)
 Case 28
    Edit.Data(1)=Mid$(Str$(ActionRecord.InvPercent),2)
 Case 29
    Edit.Data(1)=Mid$(Str$(ActionRecord.InvNumber),2)
 End Select
 If Selection=1 Then
    Call EditMonster2
    Exit Sub
 Endif
 If Selection=2 Then
    Call EditMonster1
    Exit Sub
 Endif
 If Selection=3 Then
    Call EditTeleport
    Call EditMonster3
    Exit Sub
 Endif
 Strng="^ Cursor Edit   "
 Out2=Chr$(60)+Chr$(217)+" Exit Field"
 Call StatusLine
 Call ScreenEdit
 Edit.Data(1)=Rtrim$(Edit.Data(1))
 Edit.Data(1)=Lcase$(Edit.Data(1))
 Select Case Selection
 Case 1
    'ActionRecord.MonsterTrigger(1)=Int(Val(Edit.Data(1))+.5)
 Case 2
    'ActionRecord.MonsterTalk(1)=Int(Val(Edit.Data(1))+.5)
 Case 3
    'ActionRecord.Teleport(1)=Int(Val(Edit.Data(1))+.5)
 Case 4
    If Edit.Data(1)<>Nul Then
       For Temp2!=1! To Lof(SpellFile)/SpellRecLen
          Call Read.Record(SpellFile,Temp2!)
          If Left$(SpellRecord.SpellName,Len(Edit.Data(1)))=Edit.Data(1) Then
             ActionRecord.SpellTrigger=Temp2!
             Exit Sub
          Endif
       Next
       Strng="The spell was not found in the spell file."
       Call ErrorMessage
       Call ANSI(2,21,2)
       Strng=Space$(60)
       Call Scrn(Strng)
    Endif
    ActionRecord.SpellTrigger=SFalse
 Case 5
    ActionRecord.Level=Int(Val(Edit.Data(1))+.5)
    If VarA Then
       ActionRecord.Level=-Abs(ActionRecord.Level)
    Endif
    TempX=6
    Call ShowAction
 Case 6
    If Edit.Data(1)="min" Then
       ActionRecord.Level=-Abs(ActionRecord.Level)
    Else
       If Edit.Data(1)="max" Then
          ActionRecord.Level=Abs(ActionRecord.Level)
       Else
          ActionRecord.Level=False
       Endif
    Endif
    TempX=5
    Call ShowAction
 Case 7 To 19
    If Ucase$(Edit.Data(1))="Y" Then
       ActionRecord.Restrictions=ActionRecord.Restrictions Or 2^(Selection-6)
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ActionRecord.Restrictions=ActionRecord.Restrictions And Not 2^(Selection-6)
    Endif
 Case 20
    ActionRecord.HealthRate=Int(Val(Edit.Data(1))+.5)
 Case 21
    ActionRecord.EncounterRate=Int(Val(Edit.Data(1))+.5)
 Case 22
    If Ucase$(Edit.Data(1))="Y" Then
       ActionRecord.Fumble=True
    Endif
    If Ucase$(Edit.Data(1))="N" Then
       ActionRecord.Fumble=False
    Endif
 Case 23
    Call ANSI(4,37,44)
    For TempX=3 To 14
       Call ANSI(2,TempX,35)
       Strng=Space$(13)
       Call Scrn(Strng)
    Next
    Select Case Int(Val(Edit.Data(1))+.5)
    Case 1 To 10
       ActionRecord.Inventory=Int(Val(Edit.Data(1))+.5)
    Case Else
       ActionRecord.Inventory=False
    End Select
 Case 24
    Select Case Ucase$(Edit.Data(1))
    Case "F"
       Hits.Temp=1
       TempZ=Abs(ActionRecord.HitPoints)
       ActionRecord.HitPoints=1
       TempX=24
       Call ShowAction
       ActionRecord.HitPoints=TempZ
       Next.Field=25
       Call ShowField
       Call ActionEdit
       Exit Sub
    Case "V"
       Hits.Temp=True
       TempZ=-Abs(ActionRecord.HitPoints)
       ActionRecord.HitPoints=True
       TempX=24
       Call ShowAction
       ActionRecord.HitPoints=TempZ
       Next.Field=25
       Call ShowField
       Call ActionEdit
       Exit Sub
    Case Else
       Hits.Temp=False
       ActionRecord.HitPoints=False
       TempX=24
       Call ShowAction
       TempX=25
       Call ShowAction
    End Select
 Case 25
    If Hits.Temp=False Then
       Hits.Temp=1
    Endif
    ActionRecord.HitPoints=Val(Edit.Data(1))*Hits.Temp
    TempX=25
    Call ShowAction
    Next.Field=24
    Call ShowField
 Case 26
    ActionRecord.RustRate=Int(Val(Edit.Data(1))+.5)
 Case 27
    ActionRecord.StealRate=Int(Val(Edit.Data(1))+.5)
 Case 28
    VarX=Int(Val(Edit.Data(1))+.5)
    If VarX>=False And VarX<=100 Then
       ActionRecord.InvPercent=Int(Val(Edit.Data(1))+.5)
    Endif
 Case 29
    ActionRecord.InvNumber=Int(Val(Edit.Data(1))+.5)
 End Select
Error.Resume41:
 Exit Sub
Error.Trap41:
 Resume Error.Resume41
End Sub

ActionEditData:
 Data 4,17,17,8,1,4,1
 Data 6,18,18,8,1,6,1
 Data 8,14,14,8,1,8,1
 Data 11,2,2,30,1,11,1
 Data 13,14,14,5,1,13,1
 Data 15,16,16,3,1,15,1
 Data 18,4,4,1,1,18,1
 Data 18,9,9,1,1,18,1
 Data 18,14,14,1,1,18,1
 Data 18,19,19,1,1,18,1
 Data 18,25,25,1,1,18,1
 Data 18,31,31,1,1,18,1
 Data 18,37,37,1,1,18,1
 Data 18,43,43,1,1,18,1
 Data 18,49,49,1,1,18,1
 Data 18,57,57,1,1,18,1
 Data 18,63,63,1,1,18,1
 Data 18,70,70,1,1,18,1
 Data 18,76,76,1,1,18,1
 Data 4,62,62,5,1,4,1
 Data 6,65,65,5,1,6,1
 Data 8,57,57,1,1,8,1
 Data 10,74,74,2,1,10,1
 Data 12,64,64,1,1,12,1
 Data 13,67,67,5,1,13,1
 Data 15,60,60,4,1,15,1
 Data 15,76,76,4,1,15,1
 Data 16,68,68,3,1,16,1
 Data 17,61,61,5,1,17,1

Sub ActionSelect
 On Local Error Goto Error.Trap70
 Next.Field=False
 If TempX$=Chr$(9) Then
    TempX=77
 Endif
 Select Case TempX
 Case 77, 157, 116
    Select Case Selection
    Case 1 To 5
       Next.Field=Selection+19
    Case 6
       Next.Field=26
    Case 7 To 18
       Next.Field=Selection+1
    Case 26
       Next.Field=27
    End Select
 Case 15, 75, 155, 115
    Select Case Selection
    Case 8 To 19
       Next.Field=Selection-1
    Case 20 To 23
       Next.Field=Selection-19
    Case 24, 25
       Next.Field=5
    Case 26
       Next.Field=6
    Case 27
       Next.Field=26
    End Select
 Case 72, 141, 152
    Select Case Selection
    Case 2 To 18, 21 To 26, 28, 29
       Next.Field=Selection-1
    Case 19
       Next.Field=29
    Case 27
       Next.Field=25
    End Select
 Case 80, 145, 160
    Select Case Selection
    Case 1 To 18, 20 To 25, 28
       Next.Field=Selection+1
    Case 26, 27
       Next.Field=28
    Case 29
       Next.Field=19
    End Select
 Case 71, 119
    If Selection<>1 Then
       Next.Field=1
    Endif
 Case 79, 117
    If Selection<>19 Then
       Next.Field=19
    Endif
 Case 73, 132
    Select Case Selection
    Case 2 To 7
       Next.Field=1
    Case 8 To 18
       Next.Field=7
    Case 19, 21 To 29
       Next.Field=20
    End Select
 Case 81, 118
    Select Case Selection
    Case 1 To 6
       Next.Field=7
    Case 7 To 18, 20 To 29
       Next.Field=19
    End Select
 End Select
 Call ShowField
Error.Resume70:
 Exit Sub
Error.Trap70:
 Resume Error.Resume70
End Sub

Sub EditTeleport
 On Local Error Goto Error.Trap137
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field  "
 Call StatusLine
 For VarX=1 To 5
    Call ANSI(4,33,44)
    Call ANSI(2,23,2)
    Strng="Enter Room Link Number#"+Ltrim$(Str$(VarX))+":"
    Call Scrn(Strng)

    Call ANSI(4,37,40)
    Call ANSI(2,23,29)
    Strng=Space$(10)
    Call Scrn(Strng)

    Restore Data20
    Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
    Edit.Data(1)=Ltrim$(Str$(ActionRecord.Teleport(VarX)))
    Call ScreenEdit
    Var1!=Int(Val(Edit.Data(1))+.5)
    If Var1>=0! And Var1!<=Lof(RoomFile)/RoomRecLen Then
       ActionRecord.Teleport(VarX)=Var1!
    Endif
 Next
 Exit Sub
Error.Resume137:
 Exit Sub
Error.Trap137:
 Resume Error.Resume137
End Sub

Sub EditMonster1
 On Local Error Goto Error.Trap137x2
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field  "
 Call StatusLine
 For VarX=1 To 3
    If VarX=1 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Monster talk trigger:          "
       Call Scrn(Strng)
    Endif
    If VarX=2 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Permanent monster talk trigger:"
       Call Scrn(Strng)
    Endif
    If VarX=3 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Nonplayer monster talk trigger:"
       Call Scrn(Strng)
    Endif
    Call ANSI(4,33,44)
    Call ANSI(2,23,2)
    Strng="Enter Monster Name/Number#"+Ltrim$(Str$(VarX))+":"
    Call Scrn(Strng)

    Call ANSI(4,37,40)
    Call ANSI(2,23,31)
    Strng=Space$(30)
    Call Scrn(Strng)

    Restore Data21
    Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
    Var1!=ActionRecord.MonsterTalk(VarX)
    If Var1!>0! And Var1!<=Lof(MonsterFile)/MonsterRecLen Then
       Call Read.Record(MonsterFile,Var1!)
       Edit.Data(1)=Lcase$(Rtrim$(MonsterRecord.MonsterName))
    Else
       Edit.Data(1)=Ltrim$(Str$(ActionRecord.MonsterTalk(VarX)))
    Endif
    Call ScreenEdit
    VarZ=0
    Var$=Ucase$(Rtrim$(Edit.Data(1)))
    If Len(Var$) Then
       Temp1=0
       If Instr(Var$,"#") Then
          Temp1=Int(Val(Mid$(Var$,Instr(Var$,"#")+1))+.5)
          Var$=Left$(Var$,Instr(Var$,"#")-1)
       Endif
       If Len(Var$) Then
          Temp2=0
          For VarZ!=1! To Lof(MonsterFile)/MonsterRecLen
             Call Read.Record(MonsterFile,VarZ!)
             Var2$=Ucase$(Rtrim$(MonsterRecord.MonsterName))
             If Left$(Var2$,Len(Var$))=Var$ Then
                Temp2=Temp2+1
                If Temp2=Temp1 Or Temp1=0 Then
                   ActionRecord.MonsterTalk(VarX)=VarZ!
                   VarZ=-1
                   Exit For
                Endif
             Endif
          Next
       Endif
    Endif
    If VarZ=0 Then
       Var1!=Int(Val(Edit.Data(1))+.5)
       If Var1>=0! And Var1!<=Lof(MonsterFile)/MonsterRecLen Then
          ActionRecord.MonsterTalk(VarX)=Var1!
       Endif
    Endif
 Next
 Call ANSI(4,33,44)
 Call ANSI(2,22,2)
 Strng=Space$(30)
 Call Scrn(Strng)
 Exit Sub
Error.Resume137x2:
 Exit Sub
Error.Trap137x2:
 Resume Error.Resume137x2
End Sub

Sub EditMonster2
 On Local Error Goto Error.Trap137x3
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field  "
 Call StatusLine
 For VarX=1 To 3
    If VarX=1 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Encounter Monster trigger:          "
       Call Scrn(Strng)
    Endif
    If VarX=2 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Encounter Permanent monster trigger:"
       Call Scrn(Strng)
    Endif
    If VarX=3 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Encounter Nonplayer monster trigger:"
       Call Scrn(Strng)
    Endif
    Call ANSI(4,33,44)
    Call ANSI(2,23,2)
    Strng="Enter Monster Name/Number#"+Ltrim$(Str$(VarX))+":"
    Call Scrn(Strng)

    Call ANSI(4,37,40)
    Call ANSI(2,23,31)
    Strng=Space$(30)
    Call Scrn(Strng)

    Restore Data21
    Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
    Var1!=ActionRecord.MonsterTrigger(VarX)
    If Var1!>0! And Var1!<=Lof(MonsterFile)/MonsterRecLen Then
       Call Read.Record(MonsterFile,Var1!)
       Edit.Data(1)=Lcase$(Rtrim$(MonsterRecord.MonsterName))
    Else
       Edit.Data(1)=Ltrim$(Str$(ActionRecord.MonsterTrigger(VarX)))
    Endif
    Call ScreenEdit
    VarZ=0
    Var$=Ucase$(Rtrim$(Edit.Data(1)))
    If Len(Var$) Then
       Temp1=0
       If Instr(Var$,"#") Then
          Temp1=Int(Val(Mid$(Var$,Instr(Var$,"#")+1))+.5)
          Var$=Left$(Var$,Instr(Var$,"#")-1)
       Endif
       If Len(Var$) Then
          Temp2=0
          For VarZ!=1! To Lof(MonsterFile)/MonsterRecLen
             Call Read.Record(MonsterFile,VarZ!)
             Var2$=Ucase$(Rtrim$(MonsterRecord.MonsterName))
             If Left$(Var2$,Len(Var$))=Var$ Then
                Temp2=Temp2+1
                If Temp2=Temp1 Or Temp1=0 Then
                   ActionRecord.MonsterTrigger(VarX)=VarZ!
                   VarZ=-1
                   Exit For
                Endif
             Endif
          Next
       Endif
    Endif
    If VarZ=0 Then
       Var1!=Int(Val(Edit.Data(1))+.5)
       If Var1>=0! And Var1!<=Lof(MonsterFile)/MonsterRecLen Then
          ActionRecord.MonsterTrigger(VarX)=Var1!
       Endif
    Endif
 Next
 Call ANSI(4,33,44)
 Call ANSI(2,22,2)
 Strng=Space$(50)
 Call Scrn(Strng)
 Exit Sub
Error.Resume137x3:
 Exit Sub
Error.Trap137x3:
 Resume Error.Resume137x3
End Sub

Sub EditMonster3
 On Local Error Goto Error.Trap137x4
 Strng=Nul
 Out2="^ Cursor Edit "+Chr$(60)+Chr$(217)+" Exit Field  "
 Call StatusLine
 For VarX=1 To 3
    If VarX=1 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Attack Monster trigger:          "
       Call Scrn(Strng)
    Endif
    If VarX=2 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Attack Permanent monster trigger:"
       Call Scrn(Strng)
    Endif
    If VarX=3 Then
       Call ANSI(4,33,44)
       Call ANSI(2,22,2)
       Strng="Attack Nonplayer monster trigger:"
       Call Scrn(Strng)
    Endif
    Call ANSI(4,33,44)
    Call ANSI(2,23,2)
    Strng="Enter Monster Name/Number#"+Ltrim$(Str$(VarX))+":"
    Call Scrn(Strng)
    Call ANSI(4,37,40)
    Call ANSI(2,23,31)
    Strng=Space$(30)
    Call Scrn(Strng)
    Restore Data21
    Read Xcoor, Ycoor, Column, Line.Length, Row, Max.Lines, Line.Number
    Var1!=ActionRecord.AttackMonster(VarX)
    If Var1!>0! And Var1!<=Lof(MonsterFile)/MonsterRecLen Then
       Call Read.Record(MonsterFile,Var1!)
       Edit.Data(1)=Lcase$(Rtrim$(MonsterRecord.MonsterName))
    Else
       Edit.Data(1)=Ltrim$(Str$(ActionRecord.AttackMonster(VarX)))
    Endif
    Call ScreenEdit
    VarZ=0
    Var$=Ucase$(Rtrim$(Edit.Data(1)))
    If Len(Var$) Then
       Temp1=0
       If Instr(Var$,"#") Then
          Temp1=Int(Val(Mid$(Var$,Instr(Var$,"#")+1))+.5)
          Var$=Left$(Var$,Instr(Var$,"#")-1)
       Endif
       If Len(Var$) Then
          Temp2=0
          For VarZ!=1! To Lof(MonsterFile)/MonsterRecLen
             Call Read.Record(MonsterFile,VarZ!)
             Var2$=Ucase$(Rtrim$(MonsterRecord.MonsterName))
             If Left$(Var2$,Len(Var$))=Var$ Then
                Temp2=Temp2+1
                If Temp2=Temp1 Or Temp1=0 Then
                   ActionRecord.AttackMonster(VarX)=VarZ!
                   VarZ=-1
                   Exit For
                Endif
             Endif
          Next
       Endif
    Endif
    If VarZ=0 Then
       Var1!=Int(Val(Edit.Data(1))+.5)
       If Var1>=0! And Var1!<=Lof(MonsterFile)/MonsterRecLen Then
          ActionRecord.AttackMonster(VarX)=Var1!
       Endif
    Endif
 Next
 Call ANSI(4,33,44)
 Call ANSI(2,22,2)
 Strng=Space$(50)
 Call Scrn(Strng)
 Exit Sub
Error.Resume137x4:
 Exit Sub
Error.Trap137x4:
 Resume Error.Resume137x4
End Sub

Data20:
 Data 23,29,29,10,23,1,1
Data21:
 Data 23,31,31,30,23,1,1

