This will chagne looting to "After Melee Kill" if you are currently killing a DL, but after it does, it will wait 5 seconds, then change it back to After all dead... this should give you enough time to actually loot it after it dies, before the looting settings changes back, but also change TO "After melee kill" as soon as you target a DL.
if target.name == "Dragon Lord" then
setsettings("Settings\\Looting\\Style", "After melee kill")
setsettings("Settings\\Looting\\Style", "After all dead")
I didnt test it.