"event" is undefined in Script

You can’t. Basic UI rules are basic. Pretty much anything that isn’t super straight forward is going to require an inline script.

That’s a great first contribution opportunity. There’s a link at the bottom of the page called “edit this page on GitHub” which will take you straight to where you need to be to create a PR. See Contributing to documentation for some screen shots of what that looks like.