newPlayer

Sent to a new player right after it's created.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

newPlayer

# Examples

on newPlayer -- assign a file if the filename of the target is empty then answer file "Please choose a file to play:" set the filename of the target to it end if end newPlayer

# Description

Handle the newPlayer message if you want to create additional objects, switch tools, or do other tasks when a new player is created.

Normally, the newPlayer message is handled at a higher level of the message path, since the newly-created player does not yet have a script unless the templatePlayer contains one.

The actual creation is not triggered by the newPlayer message, so trap the message and not allowing it to pass does not prevent the player from being created.

# Tags

# See

- **keyword:** it, player, templatePlayer - **property:** script - **command:** copy, clone, paste - **glossary:** object, property, variable, message path, message, tool, trap - **control structure:** pass