I'm still having trouble understanding what you're pasting where. You shouldn't even be getting that bug if you followed the instructions correctly. Can't really help you with it either since it might be in some other part of the script (eof = end of function).
I'd suggest you read some basic guides on scripting first. None of this is particularly hard if you have the basics under control.
Good guide to start with:
http://forums.xenobot.net/showthread...-Script-Making