Events

*For making an event do different things depending on the time or date, see Time-sensitive events.*
*For doing things with events via scripts rather than event commands, see Controlling events with scripts.*
This page describes **events**, as well as **Game Switches and Variables**. Since these things are fundamental parts of RPG Maker XP, this page won't fully explain them as you should know about them already; this page will only mention the aspects that are specific to Pokémon Essentials.

## Event names

Every event has a name. There are certain pieces of text that can be put into the event's name, which will cause those events to have particular behaviours. Below is a list of those texts and behaviours.

Unless mentioned otherwise, all text is case-insensitive, and the texts can be just part of the event's name (e.g. an event can have the name "Dave Trainer Sight(3) Size(2,2) Reflection").

## Event commands

RPG Maker XP includes a range of default commands for events, which perform various different effects. Most of them work as expected; commands are only listed below if there is anything special to say about them.

### Page 2

 Prepare for Transition
 Execute Transition
 Change Screen Color Tone
 Set Weather Effects
* `$game_screen.weather(:None, 0, 20)`
* `$game_screen.weather(:Rain, 9, 20)`
* `$game_screen.weather(:HeavyRain, 9, 20)`
* `$game_screen.weather(:Storm, 9, 20)`
* `$game_screen.weather(:Snow, 9, 20)`
* `$game_screen.weather(:Blizzard, 9, 20)`
* `$game_screen.weather(:Sandstorm, 9, 20)`
* `$game_screen.weather(:Sun, 9, 20)`
* `$game_screen.weather(:Fog, 9, 20)`

9 is the power of the weather. If the overworld weather corresponds to an in-battle weather, then it will apply regardless of the power of the overworld weather (i.e. even a power 1 Snow weather will cause hail in battle, even though it looks very feeble in the overworld).
The value of the duration (20 here) does not matter. If it is 0, the weather will start immediately. If it is greater than 0, it will fade in over the course of a few seconds.

## Switches and Variables

A number of things in Essentials use Game Switches and Variables. Below are tables that describe what each one is used for.

### Game Switches

The existing Game Switches are listed in the table below. Ones highlighted in blue are Script Switches; see below for more information about those.

Remember that an event's page conditions can check up to 2 different Switches. For example, you can have an event page that depends on both Switch 14 and Switch 19, and that page will only be usable during the daytime of Tuesdays, Thursdays and Saturdays.

### Game Variables

The existing Game Variables are as follows:

### Script Switches

Some predefined Game Switches have a line of code as a name. These Switches will be ON while their code is TRUE, and OFF while it is FALSE. These Switch names begin with "`s:`", followed by the code. Half of the predefined Switches are Script Switches (the ones highlighted in blue above).

As a Switch name is only a single line of text which cannot be very long, you cannot have complicated calculations in them. However, you can work around that by writing a method in a script section, and then simply calling that method in the Switch name (this is what all the predefined Script Switches do). Try to keep it simple.

Script Switches are useful for a number of things, including time-sensitive events and checking certain conditions (e.g. whether the player is in a Safari Zone). The reason they are useful is because they can be ON or OFF depending on various factors and calculations, but you do not have to worry about setting them manually. They are an automatic way of seeing the state of certain parts of the game.

**Technical Note:** It is possible to manually store a boolean value in a Game Switch which is a Script Switch. However, that stored value is ignored because, whenever the value of that Game Switch is checked (i.e. by events when they are checking their pages' conditions upon a map refresh), its code is evaluated and the result of that is what is returned. Since there are plenty of unused Game Switches you can use, there is no point in trying to manually store values in a Script Switch.

## Tips

* The "`Size(x,y)`" event name text can be used for a variety of things to help reduce the number of events used. For example:
	+ A line of bookshelves can use a single wide event for their interactions, rather than a separate event for each bookshelf tile that can be interacted with.
	+ A single event can cover the whole width of a path, which can trigger when the player steps on it to, say, start a cutscene or call `pbBridgeOn` or play/stop ambient audio.
	+ New kinds of event-pushing puzzles (e.g. Strength boulders) can be invented, using events of various sizes.
	+ If you are compelled to use events as a fourth tile layer, you can use one large event rather than a separate event for each tile being placed.