@Start:
FightMode(1)
SetVarNum(%Att,0)
SetVarNum(%Fight,0)
GoToIfPlayerInCombat(@Wait)
GoTo(@Run)

@Run:
GoToIfPlayerInCombat(@Wait)
AddVarNum(%att,1)
SetVarsLastAttackedPlayer(%X,%Y,%ID)
MoveToNoWaitVarVar(%X,%Y)
@Back:
Sleep(450)
GoToIfVarAboveNum(@Attack,%Att,5)
GoTo(@Run)

@Attack:
FightMode(1)
GoToIfPlayerInCombat(@Wait)
AddVarNum(%Fight,1)
SetVarsLastAttackedPlayer(%X,%Y,%ID)
AttackPlayer(%ID)
Wait(1)
SetVarsLastAttackedPlayer(%X,%Y,%ID)
ActionVarVar(%X,%Y)
AttackPlayer(%ID)
GoToIfVarAboveNum(@Start,%Fight,10)
GoTo(@Attack)

@Wait:
Wait(1)
GoToIfPlayerInCombat(@Wait)
GoTo(@Start)