It's much easier to read the code if you put it inside the code block. See the "#" symbol in the posting template. It also helps if you say what's wrong. At a glance I see that it's expecting to have several files in a subfolder named "save" beneath the folder where mirc.ini is located, however the script nowhere contains the mkdir command to create that folder.

Also, the script uses the custom identifier $EPirate.chan several places, but nowhere contains the custom alias itself.

These, and possibly other issues, makes it seem as if you haven't posted the entire script.