In the latest code look at unit tests:
ProblemWithGlobalScope, ProblemWithGlobalScopeWithAsyncEvents
in FixedBugs.cs
You will see how events work. Note, that when using RunCode, all event
subscriptions will be cleaned just after script execution.
If you want to use events:
1) Create Script object using Script.Compile
2) Execute Script
3) Keep Script object alive (do not dispose) while it should to
handle events
4) When you dispose Script object, all event subscriptions will be
cleared