Player Callbacks

callback ### onShipChanged

(playerIndex, craftIndex)

 Executed whenever the player changes the ship he is currently flying

Parameters

```
           playerIndex Index of the player

           craftIndex The index of the new craft he is flying, -1 for none

```

```
       callback

```

 Executed whenever the player leaves his current sector.

Parameters

```
           playerIndex Index of the player

           x The x coordinates of the sector left

           y The y coordinates of the sector left

```

```
       callback

```

 Executed whenever the player enters a new sector.

Parameters

```
           playerIndex Index of the player

           x The x coordinates of the sector entered

           y The y coordinates of the sector entered

```

```
       callback

```

 Executed whenever the money or resources of the player change

Parameters

```
           playerIndex Index of the player

```

```
       callback

```

 Executed whenever the player receives a new mail

Parameters

```
           playerIndex Index of the player

           index Index of the received mail

```

```
       callback

```

 Executed whenever the player deletes a mail

Parameters

```
           playerIndex Index of the player

```

```
       callback

```

 Executed whenever the player takes the contents of a mail

Parameters

```
           playerIndex Index of the player

           mailIndex Index of the cleared mail

```

```
       callback

```

 Executed whenever the player reads a mail

Parameters

```
           playerIndex Index of the player

           mailIndex Index of the read mail

```

```
       callback

```

 Executed whenever the relations of the player to another faction changes.

Parameters

```
           playerIndex Index of the player

           factionIndex Index of the other faction

           relations The new relations of the player to the other faction

```

```
       callback

```

 Executed whenever the relation status of the player to another faction changes.

Parameters

```
           playerIndex Index of the player

           factionIndex Index of the other faction

           status The new relation status of the player to the other faction

```

```
       callback

```

### onItemChanged

(playerIndex, amount, amountBefore)

 Executed whenever the number of items in a particular item slot in the player's inventory changes.

Parameters

```
           playerIndex Index of the player

           amount The new amount of this item

           amountBefore The amount of this item before the change

```

```
       callback

```

### onItemRemoved

(playerIndex, amount, amountBefore)

 Executed whenever the number of items in a particular item slot in the player's inventory decreases or the item was removed.

Parameters

```
           playerIndex Index of the player

           amount The new amount of this item

           amountBefore The amount of this item before the change

```

```
       callback

```

### onItemAdded

(playerIndex, amount, amountBefore)

 Executed whenever the number of items in a particular item slot in the player's inventory increases or a new item was added.

Parameters

```
           playerIndex Index of the player

           amount The new amount of this item

           amountBefore The amount of this item before the change

```

```
       callback

```

### onStartDialog

(objectIndex)

 Executed when a dialog is started.

Parameters

```
           objectIndex The index of the entity the dialog is started with

```