[scipt plugin] comments and refactoring
[script plugin] optimized event binding and handling
[script plugin] added lots of events global variable