What's New in Director 8.5 > Multiuser Server-Side Scripting > Adding server-side scripts > Standard server events |  |

Standard server events

Each script file you add should contain a handler for each type of server event (user log-ons, group creation, etc.) you want your script to react to. When standard events such as users entering or leaving groups occur, the server calls the `on serverEvent` handler in the Dispatcher.ls file. This handler determines the type of event and the movie it came from and forwards it to that movie's server-side script.

For example, if the event forwarded by the server is a user log-on, the script's `on userLogOn` handler is called. If the event is a group creation, the script's `on groupCreate` handler is called.

Each of the handlers in a movie's script must include arguments that inform the handler about where the event came from. For example, a `userLogOn` handler might look like this:

    on userLogOn (me, movie, group, user)
    	put "User Log On occurred"
    end

The arguments are passed by the server to the handler and indicate exactly which movie, group, and user generated the event. The `me` argument is required and refers to the script object containing the handler. In the preceding example, the `put` statement displays text in the server's console window.