This problem is easily resolved using switches. Switches are saved and loaded with save games. So they have a certain level of permanency. When you no longer want an event to activate make a new page in the event. Set it use a self switch or a game switch. In either case this switch will be turned on to prevent the other event page from occurring. Self switches are saved just the same as game switches. So they can be used in like ways.
If you truly want a script for this and you would need to be a hell of a lot more specific in details. What are you trying to do, in detail?