JabuJabule, I removed your script, recompiled it, and got this. I think you went wrong somewhere.
Here's what I want you to do:
1. First, go into XSE, and load your Emerald rom. Using #removeall 0x8165EF, remove your script.
2. Recompile your script into your Emerald rom.
3. The offsets should match. If they don't, I'm not really sure how to help you.
Actually, I just thought about this. Advance Map has a nasty habit of assuming that 00 bytes are free space in Emerald. That might be what caused your problem. Go into Advance Map's ini, and go to the BPE section. Where it says SuchBytes=00, change that to FF.