There are times when you are attacked and the script will auto-defend regardless of what it is. There is no logic in the script to ignore something that's attacking you.
The thing that you found is for times when you want to actively attack something (like serpents). So that's something you can change, but the automatic defense isn't something you can easily fix.