Fix logic where an entryorguid with, for example, 4 smart_script entries, would output its script 4 times instead of 1 time. Also sped up the exporting greatly.