Version 2 Scripts

From Pokémon 3D Wiki
Jump to navigation Jump to search

Version 2 scripts were started in version 0.32. Any script in Version 2 must have "version=2" as the first line of the script.

Commands are procedures that are used to tell the game what to do. Constructs are functions that returns a value in the game.

Commands are written as @Command.SubCommand. Constructs are written as <Construct.SubConstruct>.

Commands and constructs are not case sensitive.

Code Conventions

Header

The Header is used to define the ActionScript engine you want to use for the entire script. For each script file, the header (the first line of a script file) must contain "version=2".

Statement

A Statement is used to make comparisons between constructs and parameters or to make conditions for the script to run.

There are a few Statements available in the game.

  • :if:
  • :else
  • :endif
  • :while:
  • :exitwhile
  • :endwhile
  • :select:
  • :when:
  • :endwhen
  • :end
  • :endscript
  • :return:

For more infomation about Statements and their usage, proceed to here.

Command Declaration

A Command is used to instruct the game with a set of procedures to run. They do not return any value.

You can define a Command with: @Class.Subclass

Construct Declaration

A Construct is used to instruct the game to return a value. They can be used with Commands and Statements.

You can define construct with: <Class.Subclass>

Temporary Global Variable

Global Variables are used when you want to use a variable on another script without having to redefine it again.

Assignments:

@Storage.set(str,Name,Text)
@Storage.set(int,Name,Number)
@Storage.set(sng,Name,Number)
@Storage.set(dbl,Name,Number)
@Storage.set(bool,Name,Boolean)

Basic math:

Addition:
@Storage.update(int,Name,add,Value)
@Storage.update(int,Name,+,Value)
Subtraction:
@Storage.update(int,Name,substract,Value)
@Storage.update(int,Name,-,Value)
Multiplication:
@Storage.update(int,Name,multiply,Value)
@Storage.update(int,Name,*,Value)
Division:
@Storage.update(int,Name,divide,Value)
@Storage.update(int,Name,/,Value)

String concatenation:

@Storage.update(str,Name,add,Message)
@Storage.update(str,Name,+,Message)

Reading:

@Text.show(<Storage.get(str,Name)>)
@Text.show(<Storage.get(int,Name)>)

Commands

Commands always have a subcommand and sometimes one or more arguments. All combinations will be listed below.

Arguments in bold (e.g. Argument) are optional.

The table below is split into sections by Command.

When an example is given for a possible value for an argument (e.g. "argument"), don't include the quotation marks in your actual command.

Unless otherwise specified a bool can be either 1 (true/on) or 0 (false/off). Unless otherwise specified X,Y,Z is a three dimensional position. Unless otherwise specified TradeItem means an array defined as follows:

{ItemID|Amount|Price}
  • ItemID (int) - ID of the item that is being sold. See Items
  • Amount (int) - The amount of the item available for sale. When the value is "-1", there's an infinite amount available.
  • Price = The price of the item. When the value is "-1", the default price of that item is used.


Subcommand Job Inputs

@Battle

.StartTrainer(TrainerFilePath) Initializes a trainer interaction and checks the register if the player has already beaten that trainer. TrainerFilePath (str) - The file path of the TrainerFile (.trainer) without the extension, relative to "Data\Scripts\Trainer\".
.Trainer(TrainerFilePath) Initializes a trainer battle without displaying an intro message or checking the register. TrainerFilePath (str) - The file path of the TrainerFile (.trainer) without the extension, relative to "Data\Scripts\Trainer\".
.Wild(PokémonData,IntroMusic) Initializes a wild battle against the given Pokémon.

PokémonData - The Pokemon Code.

IntroMusic - The path to the music that is played when the battle starts (without the extension) relative to "Songs\".

.Wild(PokémonID,Level,Shiny,IntroMusic,IntroType,Gender) Initializes a wild battle against the given Pokémon.

PokémonID (str) - The national dex number of the Pokémon (can include a Form suffix, like "19_alola" resulting in an Alolan Rattata or "201;1" resulting in an Unown B).

Level - The level of the Pokémon.

Shiny (int) - If the Pokémon is shiny or not.

  • -1 = Random
  • 0 = Not shiny
  • 1 = Always shiny

Default value: -1

IntroMusic - The path to the music that is played when the battle starts (without the extension) relative to "Songs\".

IntroType (int) - The type of intro transition before the battle.

  • 0 = Black checker boxes
  • 1 = Black horizontal lines
  • 2 = Black vertical lines
  • 3 = Black box expand out
  • 4 = Black box expand in
  • 5 = White checker boxes
  • 6 = White horizontal lines
  • 7 = White vertical lines
  • 8 = White box expand out
  • 9 = White box expand in
  • 10-11 = Not useable
  • 12 = Blur Zoom in effect

Default value: 0-9

Gender (int) - The gender of the Pokémon.

  • 0 = Male
  • 1 = Female
  • 2 = Genderless
.SetVar(BattleVariable,Value) Changes the given battle variable to the given boolean.

BattleVariable - The variable to change. Can be: CanRun, CanCatch, CanBlackout, CanReceiveExp, CanUseItems, FrontierTrainer, DiveBattle, InverseBattle, CustomBattleMusic, HiddenAbilityChance

Value - The value to change the variable to.

.ResetVars Resets the battle variables to their default value. None

@Camera

.ActivateThirdPerson Activates the third person camera. None
.DeactivateThirdPerson Deactivates the third person camera. None
.ToggleThirdPerson Sets the camera mode to the opposite of the current mode (first person or third person). None
.Fix Fixes the camera to the current position. None
.Defix Defixes the camera so that it clips behind the player again. None
.ToggleFix Sets the fix state of the camera to the opposite of the current state. None
.Set(X,Y,Z,Yaw,Pitch) Changes the position and rotation of the camera.

X,Y,Z (sng) - The new position of the camera.

Yaw (sng) - The new Yaw (horizontal) rotation of the camera.

Pitch (sng) - The new Pitch (vertical) rotation of the camera.

.SetPitch(Value) Changes the Pitch (vertical) rotation of the camera. Value (sng) - The new value for the Pitch rotation.
.SetYaw(Value) Changes the Yaw (horizontal) rotation of the camera. Value (sng) - The new value for the Yaw rotation.
.SetPosition(X,Y,Z) Changes the position of the camera. X,Y,Z (sng) - The new position for the camera.
.SetX(Value) Changes the X-coordinate of the camera. Value (sng) - The new value for the X-coordinate.
.SetY(Value) Changes the Y-coordinate of the camera. Value (sng) - The new value for the Y-coordinate.
.SetZ(Value) Changes the Z-coordinate of the camera. Value (sng) - The new value for the Z-coordinate.
.SetFocus(FocusType,FocusID) Focuses the camera on an object.

FocusType (str) - Can be "Player", "NPC", or "Entity".

FocusID - The ID of the NPC or Entity to focus on.

.SetFocusType(FocusType) Sets the focus type for the camera. FocusType - Can be "Player", "NPC", or "Entity".
.SetFocusID(FocusID) Sets the ID of the focus target for the camera. FocusID - The ID of the NPC or Entity to focus on
.SetToPlayerFacing Sets the Yaw rotation of the camera to the direction in which the player is facing. None
.Reset Resets the camera to its default location and rotation. None
.Update Updates the camera. This is often used when dealing with things like fading the screen in and out during a script or when a property of the camera is changed. None

@Chat

.Clear Clears the chat. None

@Daycare

.Clean(DaycareID) Cleans all data for the given Daycare. This doesn't remove the data, just rearranges it. DaycareID (int) - The ID of the Daycare (Route 34's is 0).
.ClearData(DaycareID) Clears all the data for the given Daycare. That includes the Pokémon stored there and a potential Egg. DaycareID (int) - The ID of the Daycare (Route 34's is 0).
.LeavePokemon(DaycareID,DaycareSlot,PartyID) Removes a Pokémon from the player's party and fills the given Daycare's slot with that Pokémon.

DaycareID (int) - The ID of the Daycare (Route 34's is 0).

DaycareSlot (int) - Daycare slot for Pokémon to be stored in (0 or 1).

PartyID (int) Party ID of Pokémon to be deposited (0-5).

.RemoveEgg(DaycareID) Removes the egg from the given Daycare permanently. DaycareID (int) - The ID of the Daycare (Route 34's is 0).
.TakeEgg(DaycareID) Removes the Egg from the Day Care (if there is one) and adds it to the player's party. DaycareID (int) - The ID of the Daycare (Route 34's is 0).
.TakePokemon(DaycareID,DaycareSlot) Takes the given Pokémon from the given Daycare.

DaycareID (int) - The ID of the Daycare (Route 34's is 0).

DaycareSlot (int) - Daycare slot for Pokémon to be stored in (0 or 1).

@Entity

.ShowMessageBulb(BulbID|X|Y|Z) Displays the given Message Bulb at the given position

EntityID (int) - The type of Message Bulb to display.

  • 0 = Waiting ( ... )
  • 1 = Exclamation Mark ( ! )
  • 2 = Shouting ( D:< )
  • 3 = Question Mark ( ? )
  • 4 = Music Note
  • 5 = Heart
  • 6 = Unhappy ( :( )
  • 7 = Happy ( :D )
  • 8 = Friendly ( :) )
  • 9 = Poisoned ( Bubbles )
  • 10 = Battle ( Pokéball )
  • 11 = Wink ( ;) )
  • 12 = AFK
  • 13 = Angry ( >:( )
  • 14 = Cat Face
  • 15 = Unsure ( |:/ )

X|Y|Z (sng) - The position of the Message Bulb.

.Warp(EntityID,X,Y,Z) Warps the given entity to the given position on the map.

EntityID (int) - ID of an entity on the map.

X,Y,Z (sng) - The new position.

.AddToPosition(EntityID,X,Y,Z) Adds the given coordinates to the position of the given entity.

EntityID (int) - ID of an entity on the map.

X,Y,Z (sng) - The coordinates to add to the position (can be negative).

.Remove(EntityID) Removes the given entity from the map until the map is loaded again. EntityID (int) - ID of an entity on the map.
.SetID(OldID,NewID) Changes the ID of the given entity.

OldID - ID of an entity on the map.

NewID - The new ID for the entity.

.SetScale(EntityID,xScale,yScale,zScale) Changes the scale (size) property of the selected entity.

EntityID (int) - ID of an entity on the map.

xScale,yScale,zScale (sng) - The new scale.

.SetOpacity(EntityID,Opacity) Changes the opacity (transparency) of the given entity to the given value.

EntityID (int) - ID of an entity on the map.

Opacity (int) - The opacity to set the entity to (in %).

.SetVisible(EntityID,Visible) Changes the whether the entity is visible or not.

EntityID (int) - ID of an entity on the map.

Visible (bool) - The value to change the visibility property to.

.SetAdditionalValue(EntityID,Value) Changes the AdditionalValue of the given entity to the given value.

EntityID (int) - ID of an entity on the map.

Value (str) - The value to change the AdditionalValue property to.

.SetCollision(EntityID,Collision) Changes whether the player can walk through the given entity or not.

EntityID (int) - ID of an entity on the map.

Collision (bool) - The value to change the collision property to.

.SetTexture(EntityID,TextureIndex,TextureName,X,Y,Width,Height) Sets the texture in the selected entity's texture array. Example: @Entity.SetTexture(0,0,Routes,112,64,16,32)

EntityID (int) - ID of an entity on the map.

TextureIndex (int) - The face of the given entity to change.

TextureName (str) - The texture file from which to get the new texture.

X (int) - First pixel of the rectangle on the X-axis (horizontal).

Y (int) - First pixel of the rectangle on the Y-axis (vertical).

Width - How many pixels wide the rectangle is (X-axis).

Height - How many pixels tall the rectangle is (Y-axis).

@Environment

.SetRegionWeather(WeatherID) Changes the random weather for all of the maps to the given weather.

WeatherID (int) - The type of weather to change to.

  • 0 = Clear
  • 1 = Rain
  • 2 = Snow
  • 3 = Underwater
  • 4 = Sunny
  • 5 = Fog
  • 6 = Thunderstorm
  • 7 = Sandstorm
  • 8 = Ash
  • 9 = Blizzard
  • 10 = Mist
.ResetRegionWeather Resets the weather to be based on the current season. None
.SetWeather(WeatherID) Changes the weather for the map to the given weather.

WeatherID (int) - The type of weather to change to.

  • 0 = Random (based on the current season)
  • 1 = Clear
  • 2 = Rain
  • 3 = Snow
  • 4 = Underwater
  • 5 = Sunny
  • 6 = Fog
  • 7 = Thunderstorm
  • 8 = Sandstorm
  • 9 = Ash
  • 10 = Blizzard
  • 11 = Mist
.SetSeason(SeasonID) Changes the season. Use -1 as the argument to change back to the default season.

SeasonID (int) - The season to change to.

  • 0 = Winter
  • 1 = Spring
  • 2 = Summer
  • 3 = Fall
.SetDayTime(DayTimeID) Changes the time of day for all maps with EnvironmentType 0 (Outside).

DayTimeID (int) - The time of day to change to.

  • 0 = Default time of day
  • 1 = Night
  • 2 = Morning
  • 3 = Day
  • 4 = Evening
.SetEnvironmentType(EnvironmentID) Sets the "EnvironmentType" Tag of the current map.

EnvironmentID (int) - The EnvironmentType to change to.

  • 0 = Outside
  • 1 = Inside
  • 2 = Cave
  • 3 = Dark
  • 4 = Underwater
  • 5 = Forest
.SetCanDig(Value) Sets the "CanDig" Tag of the current map. Value (bool) - The new boolean value for the "CanDig" Tag.
.SetCanFly(Value) Sets the "CanFly" Tag of the current map. Value (bool) - The new boolean value for the "CanFly" Tag.
.SetCanTeleport(Value) Sets the "CanTeleport" Tag of the current map. Value (bool) - The new boolean value for the "CanTeleport" Tag.
.SetIsDark(Value) Sets the "IsDark" Tag of the current map. Value (bool) - The new boolean value for the "IsDark" Tag.
.ToggleDarkness Toggles the "IsDark" Tag of the current map between true and false. None
.SetRenderDistance(Distance) Sets the render distance to the given distance setting.

Distance (str) - The distance to set the render distance to.
Possible values are:

  • 0 or tiny
  • 1 or small
  • 2 or normal
  • 3 or far
  • 4 or extreme
.SetWildPokemonEverywhere(Value) Sets the "WildPokemonFloor" Tag of the current map. Value (bool) - The new boolean value for the "WildPokemonFloor" Tag.
.SetWildPokemonGrass(bool) Sets the "WildPokemonGrass" Tag of the current map. Value (bool) - The new boolean value for the "WildPokemonGrass" Tag.
.SetWildPokemonWater(bool) Sets the "WildPokemonWater" Tag of the current map. Value (bool) - The new boolean value for the "WildPokemonWater" Tag.

@Item

.Give(ItemID,Amount) Adds the given amount of items to the player's inventory.

ItemID (str) - The ID of the item to give. See Items.

Amount (int) - The amount of the item to give. (Default value is: 1).

.MessageGive(ItemID,Amount) Displays a message for getting the specified amount of items.

ItemID (str) - The ID of the item to give.

Amount (int) - The amount of the item to give. (Default value is: 1).

.ClearItem(ItemID,Amount) Clears all items with the given ID from the player's inventory. Clears the whole inventory if ItemID is empty.

ItemID (str) - The ID of the item to remove.

Amount - The amount of the item to remove.

.Remove(ItemID,Amount,ShowMessage) Removes the given amount of items from the player's inventory. Displays a message afterwards, if the "ShowMessage" argument is 1 (true).

ItemID (str) - The ID of the item to remove.

Amount (int) - The amount of the item to give. (Default value is: 1).

ShowMessage (bool) - Whether a message should be displayed or not (Default value is: 1)

.Repel(RepelItemID) Adds the steps of the Repel to the Repel steps of the player. RepelItemID (int) - The item ID of a repel. Possible values: "20" (100 steps), "42" (200 steps), "43" (250 steps)
.Use(ItemID) Uses the specified item if the player has it. ItemID (str) - The ID of the item to give. See Items.
.Select(AllowedPages,AllowedItems) Opens an item select screen with only the specified item type pages and the specified items (if the AllowedPages and/or AllowedItems values are set to -1, all pages and/or all items on those pages can be selected).

AllowedPages (str) - Possible Item Pages (separated with ";", e.g. "0;1;2" or "Standard;Medicine;Plants")
Possible values are:

  • 0 or Standard
  • 1 or Medicine
  • 2 or Plants
  • 3 or Balls
  • 4 or Machines
  • 5 or KeyItems
  • 6 or Mail
  • 7 or BattleItems

AllowedItems (str) - Possible item IDs (single items separated with ";", or with a "-" if you want a range, e.g. "2000-2066")

@Level

.Reload Reloads the current map. None
.Update Updates the level and all entities once. None
.Wait(Ticks) Waits for the duration of the given ticks before continuing. Ticks - The time to wait.
.WaitForEvents Waits for all other scripts to finish before continuing (including @NPC.MoveAsync()). None
.SetSafari(Value) Sets if the current map is a Safari Zone (influences battle style). Value (bool) - 1 (the current map is a Safari Zone) or 0 (the current map is not a Safari Zone)
.SetRideType(Value) Sets the "RideType" Tag of the current map which affects if and how the player can use Ride (and/or the Bicycle Item for unofficial GameModes) or not.

Value (int) - The new integer value for the "RideType" Tag.

  • 0 = Can only use Ride (or the Bicycle) if both or either of the "CanDig" and "CanFly" Tags are true.
  • 1 = Can use Ride (or the Bicycle) on this map.
  • 2 = Cannot use Ride (or the Bicycle) on this map.
  • 3 = Can use Ride (or the Bicycle) on this map, but can't dismount/stop once started.

@Music

.Play(Music,LoopSong,FadeIntoSong) Stops the currently playing music and plays a new one until the song is changed by another command or a new map.

Music (str) - The path to the song (without the extension) relative to "Music\".

LoopSong (bool) - Repeat the song after it's done playing (true) or play it once (false) (Default value is: true).

FadeIntoSong (bool) - Fade into the specified song (true) or play the song immediately (false) (Default value is: false).

.ForcePlay(Music,LoopSong,FadeIntoSong) Stops the currently playing music and plays a new one, which can't be changed until the music is unforced again with @Music.Unforce.

Music (str) - The path to the song (without the extension) relative to "Music\".

LoopSong (bool) - Repeat the song after it's done playing (true) or play it once (false) (Default value is: true).

FadeIntoSong (bool) - Fade into the specified song (true) or play the song immediately (false) (Default value is: false).

.Unforce Unforces the music to be what it was set to by @Music.ForcePlay() so it can be changed again by commands or a new map. None
.Pause Pauses the music playback (and keeps track of when it was paused, so it can be resumed later). None
.Resume Resumes the music playback starting from when it was paused. None
.Mute Silences the music playback (but keeps it playing while silent). None
.Unmute Reverts the volume of the music playback back to what it was before. None
.Stop Stops the currently playing song (and plays silence). None
.SetMusicLoop(Music) Sets the "MusicLoop" Tag of the current map to a new one until the song is changed by another command or a new map. This doesn't reset the playback position to the start like @Music.Play does. Music (str) - The path to the song (without the extension) relative to "Music\".

@NPC

.Move(ID,Steps) Moves the given NPC the given amount of steps.

ID (int) - The ID of an NPC on the current map.

Steps (int) - The amount of steps for the NPC to move.

.MoveAsync(ID,Steps) Moves the given NPC the given amount of steps while still executing the scripts after it.

ID (int) - The ID of an NPC on the map.

Steps (int) - The amount of steps for the NPC to move.

.SetMoveY(ID,Distance) Sets the distance the selected NPC should move in the Y direction the next time they do.

ID (int) - The ID of an NPC on the current map.

Distance (sng) - The distance for the NPC to move in the Y direction.

.SetSpeed(ID,Speed) Sets the speed at which the selected NPC should move the next time they do.

ID (int) - The ID of an NPC on the current map.

Speed (sng) - The new speed of the NPC (Default value is: 1).
Player speeds for reference:

  • 1 = Walk
  • 1.5 = Run
  • 2 = Ride/Bike
.AddToPosition(ID,X,Y,Z) Adds the given coordinates to the position of the given NPC. To get the relative coordinates of the NPC, enter a "~".

ID (int) - The ID of an NPC on the map.

X,Y,Z (sng) - The coordinates to add to the position.

.Position(ID,X,Y,Z) Moves the selected NPC to a different place on the map. To get the relative coordinates of the NPC, enter a "~".

ID (int) - The ID of an NPC on the map.

X,Y,Z (sng) - The new position.

.Warp(ID,X,Y,Z) Moves the selected NPC to a different place on the map. To get the relative coordinates of the NPC, enter a "~".

ID (int) - The ID of an NPC on the map.

X,Y,Z (sng) - The new position.

.Register(MapPath|ID|RemoveOrPosition|X,Y,Z) Creates a register in the NPC register file of the save in order to move or remove an NPC on the given map.

Example 1: @NPC.Register(Map.dat|0|remove)
Example 2: @NPC.Register(Map.dat|0|position|2,0,2)

MapPath (str) - The path to the map (including the extension) relative to "Data\Maps\".

ID (int) - The ID of the NPC to move or remove.

RemoveOrPosition (str) - Can be "position" or "remove".

X,Y,Z (sng) - If RemoveOrPosition is "position", this will be the new position for that NPC.

.Unregister(MapPath|ID|RemoveOrPosition|X,Y,Z) Removes a register in the NPC register file of the save that matches the given data.

Example 1: @NPC.Unregister(Map.dat|0|remove)
Example 2: @NPC.Unregister(Map.dat|0|position|2,0,2)

MapPath (str) - The path to the map (including the extension) relative to "Data\Maps\".

ID (int) - The ID of the NPC.

RemoveOrPosition (str) - Can be "position" or "remove".

X,Y,Z (sng) - The position of the NPC if RemoveOrPosition is "position".

.Remove(ID) Removes the given NPC from the current map. ID (int) - The ID of an NPC on the current map.
.Spawn(X,Y,Z,ActionValue,AdditionalValue,TextureID,AnimateIdle,Rotation,Name,ID,Movement,MoveRectangles) Creates a new NPC.

X,Y,Z (sng) - The position of the new NPC.

ActionValue (int) - The value of the "Action" tag of the new NPC.

AdditionalValue (str) - The value of the "AdditionalValue" tag of the new NPC.

TextureID (str) - The value of the "TextureID" tag of the new NPC (without the extension) relative to "Textures\NPC\".

AnimateIdle (bool) - The "AnimateIdle" tag of the new NPC.

Rotation (int) - The value of the "Rotation" tag of the new NPC.

  • 0 = North
  • 1 = West
  • 2 = South
  • 3 = East

Name (str) - The value of the "Name" tag of the new NPC.

ID (int) - The value of the "ID" tag of the new NPC.

Movement (str) - The value of the "Movement" tag of the new NPC.

  • Still - Does not move or turn.
  • Looking - Turns to random directions.
  • Walk - Randomly turns and walks to a place that it can walk to as determined by the "MoveRectangles" tag.
  • Turning - Turns in a circle.
  • Straight - Walks in a straight line along the edges of the space it can walk on as determined by the "MoveRectangles" tag.
  • PokeBall or FacePlayer - Always shows the same face to the Player and rotates with the camera, like a WallBill entity.

MoveRectangles (recArr) - Determines the spaces that the character can walk in when the "Movement" tag is set to Walk or Straight. The format is: [[X_Origin,Z_Origin,Width,Depth]] (all values are integers).

.Turn(ID,Direction) Turns the given NPC in the given direction.

ID (int) - The ID of an NPC on the current map.
Direction (int) - The direction for the NPC to turn to.

  • 0 = North
  • 1 = West
  • 2 = South
  • 3 = East
.WearSkin (ID,TextureID) Changes the skin an NPC is using.

ID (int) - The ID of an NPC on the current map.

TextureID - The name of the skin texture (without the extension) relative to "Textures\NPC\".

@Options

.Show(Options,Flag) Displays a choose box with the given options.

See section below: @Options.Show Explanation.

Options (str) - The options to display,divided by comma's (,)

Flag (str) - If this is set to "TEXT=FALSE", only the options box will be visible (not the text message box).

.SetCancelIndex(Index) Sets the cancel index of the next choose box. This index gets chosen when the player presses a back key (like "E"). Index - The chosen index.

@Player

.achieveemblem(str) Awards the player an emblem. str - Emblem name.
.addbp(int) Give the player Battle Points. int - Amount of Battle Points to give.
.getbadge(int) Given the player the given badge. int - The badge to give(zephyr=9).
.hiderod Removes the fishing rod if activated. None
.hidepokemonfollow Hides the following Pokémon. None
.money(int) Gives player money. int - Money to add.
.move(int) Moves the player the given number of steps int - Steps to move
.receivepokedex Gives the player the pokedex. None
.receivepokegear Gives the player the pokegear. None
.renamerival Allows the player to rename their rival. None
.save Saves the game. None
.setrivalname(str) Changes the rival's name to the given string. str - Rival's new name.
.showrod Shows the fishing rod. None
.showpokemonfollow Shows the following Pokémon. None
.stopmovement Stops the player. None
.togglepokemonfollow Toggles the following Pokémon. None
.turn(int) Turns the player the given number of rotations. int - The number of rotations to turn.
.turnto(int) Turns the player to the given rotation. int - The rotation to turn to.
.Warp(MapPath,X,Y,Z,Rotations) Warps the player to the given map or position. You can leave out either the MapPath argument (to warp the player to a new position on the same map) or the X,Y,Z arguments (to just warp to a different map). MapPath (str) - The path to the destination map file (including the extension) relative to "Data\Maps\". (Default = The current map)

X,Y,Z (sng) - The new position. To get the relative coordinates of the player, enter a "~" (Default = The player's current position).

Rotations (int) - The amount of 90 degree rotations to turn the player when warping to the new map (Default = 0).

.wearskin (str) Changes the player's skin. str - Skin to change to.

@Pokemon

.add(int1,int2,str1,int3,str2,bool,str3) Adds the given Pokémon to your party. Only the first 2 parameters are necessary. int1 - Pokémon dex number.

int2 - Level
str1 - Catch Method (defaults to "random reason")
int3 - Catch Ball(defaults to Master Ball)
str2 - Catch Location (defaults to current location
bool - Isegg (defaults to 0(no))
str3 - Catch Trainer (defaults to <player.name>)

.addattack(int1,int2) Adds the given attack to the given party member. int1 - Party index(0-5).

int2 - Attack ID(1-562)

.addfriendship(int1,int2) Adds the given amount of friendship to the given party member. int1 - Party index(0-5).

int2 - Amount of friendship to add.

.calcstats(int) Recalculates the stats of the given party member. int - Party index(0-5).
.changelevel(int1,int2) Changes the level of the given party member. int1 - Party index(0-5).

int2 - Level to change to.

.clear Resets the party. None
.clearattacks(int) Clears the attacks from the selected party member. int - Party index(0-5).
.cry(int) Plays the cry of the selected Pokémon. int - Pokémon dex number.
.evolve(int) Evolves the given party member. int - Party index(0-5).
.gainexp(int1,int2) Adds exp to the given party member. int - Party index(0-5).
.heal Heals the party None
.hide Hides the overworld Pokémon. None
.learnattack(int1,int2) Allows the player to teach the given attack to the given party member. int1 - Party index(0-5).

int2 - Attack ID

.newroaming(int1|int2|int3|str) Sets a roaming Pokémon into the region. int1 - Pokémon dex number.

int2 - Pokémon level.
int3 - Region number(johto = 0)
str - Start map.

.npctrade(int1|int2|int3|int4|intarr|bool|int5|

str1|int6|int7|str2|str3|str4|str5|str6|str7)

Creates a trade with an npc. int1 - Pokémon wanted by NPC.

int2 - Pokémon given by NPC.
int3(optional) - Level of Pokémon given by NPC. If blank defaults to own Pokémon's level.
int4 - Gender of given Pokémon. -1 = random, 0 = Male, 1 = female, 2 = genderless
intarr(optional) - Attack IDs for the given Pokémon.
bool(optional) - Defines shininess.
int5 - OT ID.
str1 - OT Name.
int6 - CatchBall.
int7(optional) - Held Item.
str2 - Catch Location.
str3 - CatchMethod
str4 - Nickname.
str5 - Accept trade message.
str6 - Reject trade message.
str7 - Register after trade.

.read(int) Determines which stat has more EVs. int - Party index(0-5).
.registerhalloffame Registers the current team in the Hall of Fame. None
.remove(int) Removes the given party member. int - Party index(0-5).
.removeattack(int1,int2) Removes given attack from the given party member. int1 - Party index(0-5).

int2 - Move Order ID(0-3).

.rename(int) Renames the given party member. int - Party index(0-5).

May also be 'last' to choose the last Pokémon in the party.

.select(bool) Opens the party menu to allow the player to choose a Pokémon.

Selection is returned with <Pokémon.selected>.

bool - Allows the player to exit the selection menu.
.selectmove(int,bool1,bool2) Opens the attack menu to allow the player to choose an attack fromthe given party member.

Selection is returned with <Pokémon.selectedmove>.

int - Party index(0-5).
bool1 - allows HMs to be removed.
bool2 - Allows menu to be exited.
.setability(int1,int2) Changes the ability of the given Pokémon. int1 - Party index(0-5).

int2 - New ability's index number.

.setAdditionalValue(int,str) Changes the additional value of the given Pokémon. int - Party index(0-5).

str - New AdditionalValue.

.setfriendship(int1,int2) Changes the friendship value of the given Pokémon. int1 - Party index(0-5).

int2 - New friendship value.

.setgender(int1,int2) Changes the gender of the given Pokémon. int1 - Party index(0-5).

int2 - New gender value.

.setnature(int1,int2) Changes the nature of the given Pokémon. int1 - Party index(0-5).

int2 - New Nature.

.setnickname(int,str) Changes the nickname of the given Pokémon. int - Party index(0-5).

str - New Nickname.

.setshiny(int,bool) Changes the shininess of the given Pokémon. int - Party index(0-5).

bool - Represtens the shininess.

.setstat(int1,str,int2) Changes the given stat of the given Pokémon. int1 - Party index(0-5).

str - The stat to change. Possible inputs:
chp, maxhp, hp, atk, attack, def, defense, spatk, spattack, specialattack, spdef, spdefense, specialdefense, speed
int2 - New value for the stat.

@Register

.Register(Name) Adds a new register with the given name to the "register.dat" file of the current save game. Name (str) - The name of the new register.
.Register(Name,Type,Value) Adds a new register with the given Name, Type and Value to the "register.dat" file of the current save game. Name (str) - The name of the new register.

Type (str) - The type of the Value argument. Possible values: "str", "bool", "int" or "sng".
Value (str) - The value to be stored in the register.

.Change(Name,Value) Changes the specified register's stored value to a new value. Name (str) - The name of the register to change the stored value of.

Value (str) - The value which replaces the old value stored in the register.

.Unregister(Name) Removes the specified register from the "register.dat" file of the current save game. Name (str) - The name of the register to unregister.
.Unregister(Name,Type) Removes the value stored in the specified register from the "register.dat" file of the current save game and unregisters the register itself. Name (str) - The name of the register to unregister the value of.

Type (str) - The type of the value stored in the register to unregister.

.RegisterTime(Name,Amount,Type) Adds a new register with the given name for a specified amount of time to the "register.dat" file of the current save game. Name (str) - The name of the new register.

Amount (str) - The amount of time to wait before unregistering the register. What kind of time is used is determined by the Type argument.
Type - What kind of time to use for this register. Possible values:

  • Day
  • Days
  • Hour
  • Hours
  • Minute
  • Minutes
  • Second
  • Seconds
  • Year
  • Years
  • Month
  • Months
  • Week
  • Weeks
  • DayOfWeek

@Screen

.Input(DefaultInput,InputMode,CurrentInput,MaxChars) Displays the Keyboard Input screen. The input can be retrieved with the construct <System.LastInput>. DefaultInput (str) - The text that appears when the button "Default" is clicked.
InputMode (int) - The input mode; 0 for regular text, 1 for numbers only and 2 for names.

CurrentInput (str) - The text that displays in the input box when the screen is first loaded.
MaxChars (int) - Number of characters allowed.

.ShowPokemon(PokemonID,Shiny,Front) Displays a box and an image of the specified Pokémon. PokemonID (int) - A Pokémon dex number.

Shiny (bool) - Determines if the Pokémon is shiny
Front (bool) - Determines if the front(1) or back(0) is shown.

.ShowImage(Texture,SoundEffect,X,Y,Width,Height) Displays a box and (part of a) texture image. Texture (str) - The path to a texture.

SoundEffect (str) - The path to a sound effect file to play when the image is displayed (can be left empty).
X (int) - First pixel of the texture rectangle on the X-axis (horizontal).
Y (int) - First pixel of the texture rectangle on the Y-axis (vertical).
Width - How many pixels wide the texture rectangle is (X-axis).
Height - How many pixels tall the texture rectangle is (Y-axis).

.ShowMessageBox(Message|BackgroundColor|FontColor|BorderColor) Displays a dynamically sized customizable message box in the center of the screen. Message (str) - The message to display

BackgroundColor (intArr) - A list of integers specifying the RGB values of the background color of the textbox e.g. 255,255,255 for pure white.
FontColor (intArr) - A list of integers specifying the RGB values of the font color e.g. 0,0,0 for pure black.
BorderColor (intArr) - A list of integers specifying the RGB values of the border color of the textbox e.g. 0,0,0 for pure black.

.FadeOutColor(Color) Sets the color of the screen fade. Color (intArr) - A list of integers specifying the RGB values of the screen fade color e.g. 255,255,255 for pure white (Default value is: 0,0,0 which is pure black). Values can range from 0 - 255.
.Fadein (FadeSpeed) Fades the screen in from the FadeOutColor (Which is black by default). FadeSpeed (int) - How fast to fade the screen in (Default value is: 5).
.FadeOut(FadeSpeed) Fades the screen out to the FadeOutColor (Which is black by default). FadeSpeed (int) - How fast to fade the screen out (Default value is: 5).
.SetFade(Alpha) Sets the alpha (transparency) value of the screen fade. Alpha (int) - The transparency of the screen fade. Values can range from 0 - 255.
.ApricornKurt Displays the Apricorn selection screen. None
.Credits(Region) Displays the credits scene. Region (str) - The region to use maps from. Currently this is hardcoded (Default value is: Johto).
.Donation Displays the list of donators. None
.Blackout Displays the blackout message screen and warps the player back to the last restplace. None
.MysteryEvent Displays the Mystery Event screen. None
.HallOfFame(Record) Displays the given Hall of Fame record(s). Record (int) - The Hall of Fame record to display. If not specified, then it will displays all records.
.MailSystem Displays the PC Inbox screen. None
.SkinSelection Displays the Player Skin selection screen. The skin selected in this screen can be retrieved using the construct <Screen.SelectedSkin>. None
.StorageSystem Displays the Pokémon storage system screen. None
.TownMap(RegionList) Displays the map screen with the specified regions. RegionList (str) - Name(s) of region(s) to view separated by comas.
.Trade(TradeItems,AllowBuy,AllowSell,Currency) Opens a new trade screen/shop with the specified items in stock. TradeItems - A list of TradeItems as defined at the top of this page.

AllowBuy (bool) - Allows the player to buy items from this store.
AllowSell (bool) - Allows the player to sell items to this store.
Currency (str) - What currency to use for the trade (Default value is: "P"). Possible values: "P" (for PokéDollars), "BP" (for Battle Points).

.TeachMoves(PartyIndex,MoveIDs) Displays a move learn screen. PartyIndex (int) Index of a Pokémon in the player's party. Values can range from 0 - 5.

MoveIDs (intArr) - If this argument is left empty, it defaults to the Pokémon's tutor moves.

@Script

.Run(ScriptContent) Executes the given commands. ScriptContent (str) - Contains the commands to execute. New lines are represented with "^".
.Start(ScriptFile) Starts the given script. ScriptFile (str) - The file path to the script file to start relative to the script folder ("Content\Data\Scripts\" by default).
.Text(Message) Displays the given text. Message (str) - The text to display.

@Sound

.Play(Sound,StopMusic) Plays a sound. Sound (str) - The path to the sound (without the extension) relative to "Sounds\".

StopMusic (bool) - If the music should be paused until the sound has finished playing (default = 0).

.PlayAdvanced(Sound,StopMusic,Pitch,Pan,Volume) Plays a sound with advanced parameters. Sound (str) - The path to the sound (without the extension) relative to "Sounds\".

StopMusic (bool) - If the music should be paused until the sound has finished playing (default = 0).
Pitch (sng) - The pitch adjustment of the sound, ranging from -1.0 (down an octave) to 0.0 (no change) to 1.0 (up an octave).
Pan (sng) - Panning, ranging from -1.0 (left speaker) to 0.0 (centered), to 1.0 (right speaker).
Volume (sng) - Volume, ranging from 0.0 (silence) to 1.0 (full volume).

@Storage

.clear Clears all stored values. None
.set(str1,str2,str3) Creates a storage with type of str 1, name of str2, and value of str3. str1 - the type of value being stored(integer, string, Pokémon, boolean, item)

str2 - The name of the Value.
str3 - The Value to be stored.

@Text

.Show(Text) Displays a textbox with the given text. Text (str) - The text to display.
.SetFont(FontName) Changes the font of the textbox. All fonts from loaded ContentPacks, GameModes and the standard game can be loaded. FontName (str) - The name of the font file (without the extension)
.Notification(Message, Delay,BackgroundIndex,IconIndex,SoundEffect,ScriptFile,ForceScript,ClearList) Displays a notification popup. Message (str) = Message to be displayed in the notification popup.

Delay = Delay in 100th of a second before the notification popup disappears (default = 500).
BackgroundIndex (int) = Index of background texture in "Textures\Notifications\Backgrounds.png" (default = 0).
IconIndex (int) = Index of icon texture in "Textures\Notifications\Icons.png" (default = 0)
SoundEffect (str) = Sound effect to play when the notification popup appears.
ScriptFile (str) = Path to the script file to execute when interacting with the notification popup relative to "Data\Scripts\Trainer\".
ForceScript (bool) = If the specified script should be executed after the message is dismissed or accepted (default = false).
ClearList (bool) = If set to true, the current list of messages will be cleared before displaying the new one (default = false).

.Log(Text) Logs the given text in log.dat. Text (str) - The text to log.

@Title

.Add(Text,Delay,R,G,B,Scale,IsCentered,X,Y) Adds a new title for the game to display during gameplay. Text (str) - The text to display.

Delay (sng) - How long it takes before the text disappears (default value is: 20.0)
R,G,B (int) - Red, Green & Blue color values for the text (default values are: 255,255,255).
Scale (sng) - How big the text should be rendered (default value is: 10.0)
IsCentered (bool) - If the text is centered or not. (default value is: 1)
X,Y (sng) - Coordinates at which the text is displayed. (default values are: 0.0, 0.0)

.Clear Clears all titles that are currently being displayed. None

Constructs

Constructs can be used in place of any parameter for command and are used with :if: and :select: statements.
They can even be used in trainer files. Constructs always have a subconstruct. All combinations will be listed below.

Constructs that return numbers such as <Pokemon.level(int)> may be used in math mathematical functions including:

  • +: Addition
  • -: Subtraction
  • /: Division
  • *: Multiplication
  • ^: Exponent
  • %: Percent
  • =: Equals
  • <: Less Than
  • >: Greater Than
  • m: Mod (ex. 25m4=1)
  • r: Root(ex. 27r3=3)

The table is split into sections by Construct.

  • Unless otherwise specified X,Y,Z is a three dimensional position.
    • Unless otherwise specified bool is either true or false.
Sub-construct Inputs Output

Battle

.defeatmessage(str) str - A trainer file path. Returns the defeat message of the given trainer.
.intromessage(str) str - A trainer file path. Returns the intro message of the given trainer.
.outromessage(str) str - A trainer file path. Returns the outro message of the given trainer.
.won None Returns true if you won the last battle.
.caught None Returns true if you caught the Pokémon in the last wild battle.

Daycare

.canbreed(int) int - The Daycare ID, the Route 34 Daycare is ID = 0. Returns the returns the percent chance the Pokémon in the given Daycare will have an egg.
.canswim(int1,int2) int1 - The Daycare ID, the Route 34 Daycare is ID = 0.

int2 - The Pokémon's ID in the Daycare(0 or 1)

Returns a bool based on the Pokémon data file entry "canswim".
.countpokemon(int) int - The Daycare ID, the Route 34 Daycare is ID = 0. Returns the number of Pokémon in the given Daycare.
.currentlevel(int1,int2) int1 - The Daycare ID, the Route 34 Daycare is ID = 0.

int2 - The Pokémon's ID in the Daycare(0 or 1)

Returns the current level of the given Pokémon.
.grownlevels(int1,int2) int1 - The Daycare ID, the Route 34 Daycare is ID = 0.

int2 - The Pokémon's ID in the Daycare(0 or 1)

Returns the amount of levels a Pokémon has grown.
.hasegg(int) int - The Daycare ID, the Route 34 Daycare is ID = 0. Returns a bool based on if there is an egg in the given Daycare.
.haspokemon(int) int - The Daycare ID, the Route 34 Daycare is ID = 0. Returns a bool based on if there are Pokémon in the given Daycare.
.PokémonID(int1,int2) int1 - The Daycare ID, the Route 34 Daycare is ID = 0.

int2 - The Pokémon's ID in the Daycare(0 or 1)

Returns the dex number of the selected Pokémon.
.pokemonname(int1,int2) int1 - The Daycare ID, the Route 34 Daycare is ID = 0.

int2 - The Pokémon's ID in the Daycare(0 or 1)

Returns the name of the selected Pokémon.
.shinyindicator(int1,int2) int1 - The Daycare ID, the Route 34 Daycare is ID = 0.

int2 - The Pokémon's ID in the Daycare(0 or 1)

Returns 'S' if shiny and 'N' if not.

Entity

.AdditionalValue(int) int - an Entity ID The contents of the AdditionalValue of the given entity.
.collision(int) int - an Entity ID A bool representing the collision of the given entity.
.opacity(int) int - an Entity ID An int representing the percent see through the given entity is.
.position(int) int - an Entity ID The X,Y,Z position of the given entity.
.scale(int) int - an Entity ID The X,Y,Z scale of the given entity
.visible(int) int - an Entity ID A bool representing the visibility of the given entity.

Environment

.candig None A bool representing if the player can dig from the map.
.canfly None A bool representing if the player can fly from the map.
.canteleport None A bool representing if the player can teleport from the map.
.currentmapweather None Same as .weather.
.currentmapweatherid None Same as .weatherid.
.day None Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, or Saturday
.dayinformation None day,daytime
.daytime None night, morning, day, or evening
.daytimeid None The ID for the time of day.

night=0, morning=1, day=2, or evening=3

.isdark None A bool representing the darkness of the map.
.mapweather None Same as .weather.
.mapweatherid None Same as .weatherid.
.regionweather None Returns the random weather effecting the whole area.

Uses the same names as .weather.

.regionweatherid None Returns the ID of random weather effecting the whole area.

Uses the same IDs as .weatherid.

.season None winter, spring, summer, or fall
.seasonid None The ID for the season.

winter=0, spring=1, summer=2, or fall=3

.weather None Returns the Weather effecting the current map.

Clear, Rain, Snow, Underwater, Sunny, Fog , Sandstorm

.weatherid None Returns the ID of the Weather effecting the current map.

Clear=0, Rain=1, Snow=2, Underwater=3, Sunny=4, Fog=5, Sandstorm=6

.week None The current week in the year.
.wildPokemoneverywhere None A bool representing if the player can find Pokémon on the map.
.wildPokemongrass None A bool representing if the player can find Pokémon in the grass on the map.
.wildPokemonwater None A bool representing if the player can find Pokémon in the water on the map.
.year None The current year(e.g. 2013)

Inventory

.countitem(int) int- Item ID. The amount of the given item in the bag.
.countitems None The number of Items in the bag.
.name(int) int- Item ID. The name of the given item.

Level

.filename None Returns the name of the current map file without extension.
.levelfile None Returns the file path of the current map relative to the maps folder.
.mapfile None Same as .levelfile.
.riding None Returns a bool representing if the player is riding.
.surfing None Returns a bool representing if the player is surfing.
.musicloop None Returns the file path of the music loop that belongs to the current level.

Math

.abs(sng) str - A value to convert Takes the absolute value of the given value.
.ceiling(sng) str - A value to convert Rounds the given value up.
.floor(sng) str - A value to convert Rounds the given value down.
.int(int) str - A value to convert. Converts the given value to an integer.
.sng(sng) str - A value to convert. Converts the given value to an single.

NPC

.action(int) int - ID of an NPC on the map. Returns the action value of the given NPC.
.additionaldata(int) int - ID of an NPC on the map. Returns the additionaldata of the given NPC.
.exists(int) int - ID of an NPC on the map. Checks if there is an NPC on the map with that ID.
.facing(int) None Returns the ID of the direction the player is facing.
.hasmoverectangles(int) int - ID of an NPC on the map. Returns a bool reflecting if the given NPC has moverectangles assigned.
.id(int) int - ID of an NPC on the map. Returns the ID of the given NPC.
.ismoving int - ID of an NPC on the map. Returns a bool representing if the player is moving or not.
.moved(int) int - ID of an NPC on the map. Returns the distance moved by that NPC.
.movement(int) int - ID of an NPC on the map. Returns the type of movement used by the given NPC.
.name(int) int - ID of an NPC on the map. Returns the name of the given NPC.
.position(int) int - ID of an NPC on the map. Returns the position of the given NPC.
.skin (int) int - ID of an NPC on the map. Returns the name of the skin used by the given NPC.
.trainertexture(str) str - A trainer file, file path. Returns the name of the texture used by the given trainer.

Phone

.callflag None (str) Returns if the player is calling or is being called. Possible values: "calling", "receiving"
.got None (bool) Returns if the player got the Pokégear.

Player

.badges None Returns the number of badges obtained.
.bp None Returns the amount of battle points the player has.
.compass None Returns the name of the direction the player is facing.
.facing None Returns the ID of the direction the player is facing.
.gender None Returns 1 if male, 0 if Female.
.hasbadge(int) int - A badge ID. Returns a bool representing if the player has that badge.
.ismoving None Returns a bool representing if the player is moving or not.
.money None Returns the amount of money the player has.
.name None Returns the name of the player.
.position None Returns the player's position.
.rival None Returns the rival's name.
.rivalname None Returns the rival's name.
.skin None Returns the name of the skin used by the player.
.thirdperson None Returns a bool representing if third person mode is on.
.velocity None Returns the velocity of the player.

Pokedex

.caught None Returns the number of Pokémon caught.
.seen None Returns the number of Pokémon seen.
.shiny None Returns the number of shiny Pokémon caught.

Pokemon

.additionaldata(int) int - Party index of a Pokémon(0-5) Returns the additionaldata of the given party member.
.atk(int) int - Party index of a Pokémon(0-5) Returns the attack stat of the given party member.
.attackname(int1,int2) int1 - Party index of a Pokémon(0-5)

int2 - Attack index of a Pokémon's attack(0-3).

Returns the name of the given attack from the given party member.
.catchball(int) int - Party index of a Pokémon(0-5) Returns the catchball of the given party member.
.catchlocation(int) int - Party index of a Pokémon(0-5) Returns the catchlocation of the given party member.
.catchmethod(int) int - Party index of a Pokémon(0-5) Returns the catchmethod of the given party member.
.count None Returns the number of Pokémon in the party.
.countattacks(int) int - Party index of a Pokémon(0-5) Returns the number of attacks on the given party member.
.countbattle None Returns the number of battle-usable Pokémon in the party.
.counthalloffame None. Returns the number of Hall of Fame registers the player has.
.currentexp(int) int - Party index of a Pokémon(0-5) Returns the exp for the current level of the given party member.
.data(int) int - Party index of a Pokémon(0-5) Returns the save data for the given party member.
.def(int) int - Party index of a Pokémon(0-5) Returns the defense stat of the given party member.
.freeplaceinparty None Returns a bool representing if there is an empty slot in the party.
.friendship(int) int - Party index of a Pokémon(0-5) Returns the friendship value of the given party member.
.generatefrontier(int1,int2)
.has(int) int - dex number of a Pokémon Returns a bool representing if the given Pokémon is in the party.
.hasattack(int1,int2) int1 - Party index of a Pokémon(0-5)

int2 - Attack index.

Returns a bool representing if the given party member has the given attack.
.hasegg None Returns a bool representing if there is an egg in the party.
.hasfullhp(int) int - Party index of a Pokémon(0-5) Returns a bool representing if the given party member has full hp.
.hp(int) int - Party index of a Pokémon(0-5) Returns the current HP of the given party member.
.id(int) int - Party index of a Pokémon(0-5) Returns the dex number of the given party member
.isegg(int) int - Party index of a Pokémon(0-5) Returns a bool representing if the given party member is an egg.
.islegendary(int) int - Party index of a Pokémon(0-5) Returns a bool representing if the given party member is a legendary.
.isshiny(int) int - Party index of a Pokémon(0-5) Returns a bool representing if the given party member is shiny.
.item(int) int - Party index of a Pokémon(0-5) Returns the name of the item held by the given party member.
.itemdata(int) int - Party index of a Pokémon(0-5) Returns the stored data for the held item of the given Pokémon(used for mail).
.itemid(int) int - Party index of a Pokémon(0-5) Returns the id of the item held by the given party member.
.itemname(int) int - Party index of a Pokémon(0-5) Returns the name of the item held by the given party member.
.learnedtutormove None. Returns a bool based on if a move was just learned via the Move Relearner.
.level(int) int - Party index of a Pokémon(0-5) Returns the level of the given party member.
.maxhp(int) int - Party index of a Pokémon(0-5) Returns the max HP of the given party member.
.maxpartylevel None Returns the highest level of among the Pokémon in the player's party.
.name(int) int - Party index of a Pokémon(0-5) Returns the name of the given party member.
.nature(int) int - Party index of a Pokémon(0-5) Returns the nature of the given party member.
.needexp(int) int - Party index of a Pokémon(0-5) Returns the exp needed for the next level of the given party member.
.nickname(int) int - Party index of a Pokémon(0-5) Returns the nickname of the given party member.
.noPokemon None Returns a bool representing if there are no Pokémon in the party.
.number(int) int - Party index of a Pokémon(0-5) Returns the dex number of the given party member.
.ot(int) int - Party index of a Pokémon(0-5) Returns the ot of the given party member.
.otmatch(int,str) int - OT to check against.

str - value to return.(has, id, number, name, maxhits)

Returns a different value based on str:
  • has: a bool for if you have a Pokémon with a matching OT.
  • id, number: the number of the matching Pokémon.
  • name: the name of the matching Pokémon.
  • maxhits: the amount of digits that match
.ownPokemon(int) int - Party index of a Pokémon(0-5) Returns a bool representing if the given party member was caught by the current trainer.
.randomot None Produces a random OT number.
.selected None Returns the Party index of the Pokémon selected using @Pokémon.select.
.selectedmove None Returns the index of the Pokémon's attack selected using @Pokémon.selectmove.
.spatk(int) int - Party index of a Pokémon(0-5) Returns the spec. attack stat of the given party member.
.spawn(int1,int2) int1 - Pokémon dex number.

int2 - Level

Produces the save data for the given Pokémon.
.spawnwild(int) int - encounter type Produces the save data for a random wild Pokémon encountered the given way.
.spdef(int) int - Party index of a Pokémon(0-5) Returns the spec. defense stat of the given party member.
.speed(int) int - Party index of a Pokémon(0-5) Returns the speed stat of the given party member.
.totalexp(int) int - Party index of a Pokémon(0-5) Returns the total exp of the given party member.
.trainer(int) int - Party index of a Pokémon(0-5) Returns the catch trainer of the given party member.

Register

.count None Returns the number of registers.
.registered(str) str - A register string. A bool representing if the string has been registered.
.type(str) str - Register value to get the type of. Returns the type of the value stored under the given name.
.value(str) str - Register name. Returns the value stored as the given register.

Rival

.name None Returns the rival's name.

Storage

.count(str) str1 - The type of values to count(integer, string, Pokémon, boolean, item).

Does not need to be defined.

Returns the number of different stored values of that type.

If str is not defined then it returns a count of all types.

.get(str1,str2) str1 - The type of value is stored(integer, string, Pokémon, boolean, item).

str2 - the name of the stored value.

Returns the value stored as str2.

System

.booltoint(str) Either "true", "false", or a construct that returns one of those. Returns 0 for false and 1 for true.
.calcint(str) A str representing an integer, or a Construct that returns one. Returns the str as an integer.
.calcsng(str) A str representing a single, or a Construct that returns one. Returns the str as a single. (A single is a number that is a decimal)
.dayofyear None Returns the day of the year as a number.
.isinsightscript None Returns a bool based on if the script it is in was triggered by the player stepping into the line of sight of an NPC.
.issng(int) int - A value to test. Returns true if the value is a single.
.isint(int) int - A value to test. Returns true if the value is an integer.
.lastinput None Returns the last thing input via @screen.input.
.random(int1,int2) int1 - If it is the only argument then it is the max of the range, otherwise it is the min.

int2 - The max of the range. Does not need to be defined.

Returns a random integer between the int1 and int2 if both are defined.

If int2 is not defined then it chooses from between 1 and int1.(Ranges are inclusive)

.sort(str,int,list) str - either 'Ascending' or 'Descending'

int - position in sorted list to return
list - List of numbers to sort.

Returns a number from a list of numbers after it is sorted.
.unixtimestamp None Returns the Unix time stamp. (http://www.unixtimestamp.com/index.php See here for more details.)
.year None Returns the current year.

Statement

Statements do a comparison between a given parameter and a construct.

:if:


If you want to make the script run if a certain condition is met, :if: will do the job.

Typical Usage:

:if:Conditions
   @Command.Subcommand(Argument Types)
:endif
:if:Conditions
   @Command.Subcommand(Argument Types)
:else
   @Command.Subcommand(Argument Types)
:endif

Conditions


There are some valid conditions that you can use.

The script will run if a value that returns from the constructs matches the value given.

<Construct.SubConstruct(Argument Types)>=value      (if argument is equal to value)
<Construct.SubConstruct(Argument Types)>>value     (if argument is larger than value)
<Construct.SubConstruct(Argument Types)><value     (if argument is smaller than value)

Using <not>, the script will run if a value that returns from the constructs does not match the value given.

<not><Construct.SubConstruct(Argument Types)>=value      (if argument is not equal to value)
<not><Construct.SubConstruct(Argument Types)>>value      (if argument is not larger than value)
<not><Construct.SubConstruct(Argument Types)><value      (if argument is not smaller than value)

Using <and>, the script will run if two or more value that returns from the constructs match the value given.

<Construct.SubConstruct(Argument Types)>=value <and> <Construct.SubConstruct(Argument Types)>>value <and> <Construct.SubConstruct(Argument Types)><value

Using <or>, the script will run if at least one value that returns from the constructs match the value given.

<Construct.SubConstruct(Argument Types)>=value <or> <Construct.SubConstruct(Argument Types)>>value <or> <Construct.SubConstruct(Argument Types)><value

FAQ:


1. Can I use <and> and <or> at the same line? (E.g.: <Construct.SubConstruct(Argument Types)>=value <or> <Construct.SubConstruct(Argument Types)>=value <and> <Construct.SubConstruct(Argument Types)>=value )
Answer: No. This is because the script does not support it. Also, the script will not understand what condition you require so it's recommended to start a new :if: switch so that it will work the way you want it to be.

2. Can I use <not> with <and> or <or> at the same line? (E.g.: <not><Construct.SubConstruct(Argument Types)>=value <or> <Construct.SubConstruct(Argument Types)>=value )
Answer: Yes. The script will be able to handle this.

:select:


If you want to make the script run if one of multiple possible conditions is met, :select: will do the job.

Typical Usage:

:select:<Construct.SubConstruct(Argument Types)>
   :when:Value
       @Command.Subcommand(Argument Types)
:endwhen

Value


This field is to define the value that a construct possibly could return. If it matches the argument after :select:, the script will run.

Define the possible values that the construct will return:

:when:Value1
   ...
:when:Value2
   ...
:when:ValueI
   ...

If you want to have multiple value as you intended to let them do the same thing, you can use ";".

:when:Value1;Value2;Value3...;ValueI
   ...
:when:Value1;Value2;Value3...;ValueI
   ...

After you define the values in each condition, use ":endwhen" to properly close the :select: switches.

@Options.Show()


If you want to let player choose from a certain options in a list, @Options.Show() will do the job.

Typical Usage:

@Options.Show(Option1,Option2,Optioni)
   :when:Option1
       @Command.Subcommand(Argument Types)
   :when:Option2
       @Command.Subcommand(Argument Types)
   :when:OptionI
       @Command.Subcommand(Argument Types)
:endwhen

Option


This field is to define which option to run the scripts from after the player selects one of the options as defined with @Options.Show().

Define the possible option that you've defined with @Options.Show().

:when:Option1
...
:when:Option2
...
:when:OptionI

If you want to have multiple value as you intended to let them do the same thing, you can use ";".

:when:Option1;Option2;OptionI

After you define all the options in each condition, use ":endwhen" to properly close the @Options.Show() switch. If you want to an option to be automatically be selected if the player cancels out, use @Options.SetCancelIndex(OptionIndex) before the @Options.Show() switch. For the argument OptionIndex, remember that 0 is the first option, 1 the second option etc.

:while:


If you want to loop a certain command until it meets the condition, :while: will do the job.

Typical Usage:

:while:Conditions
   @Command.Subcommand(Argument Types)
   ...
:endwhile

FAQ:


1. How to manually stop the loop when you know that the condition will never be met?
Answer: Insert :exitwhile before :endwhile to stop the loop prematurely.

2. How come it didn't loop? How come it stop prematurely despite :exitwhile not being used?
Answer: This is a bug. Unfortunately, if this happens, please ensure that your script is correct before filling a bug report.

3. Can I stack :while: switches? Answer: No.

:endscript


If you want to stop all currently running scripts prematurely, :endscript will do the job.

Typical Usage:

@Command.Subcommand(Argument Types)
...
...
:endscript

:return:


A script function that temporarily stores a single value that can be returned with <System.Return>.

Typical Usage:

:return:True
:end

When you then use <System.return>, it will return True.

Comments


To add some comments in your script to explain how it works, you can add "#" at the start of the line.

Typical Usage:

# This is a comment
@Command.Subcommand(Argument Types) # <= Putting a # there will not work (might even give an error).
# @Command.Subcommand(Argument Types) <= It will not run this script at all

FAQ:


1. Can it support multiple line without having to use # all the time?
Answer: Unfortunately, no.

:end


To end the currently running script, :end will do the job. Unlike when using :endscript, previously running scripts will still continue to run.

Typical Usage:

@Command.Subcommand(Argument Types)
:end

Reserved Registers

Reserved Registers are registers that are reserved in the P3D engine and cannot be replaced by other events.

pokegear_card_radio
# When Registered, will give the Player's PokéGear the Radio option
pokegear_card_GTS
# When Registered, will give the Player's PokéGear the GTS option
pokegear_card_minimap
# When Registered, will give the Player's PokéGear the MiniMap option
pokegear_card_frontier
# When Registered, will give the Player's PokéGear the Frontier option

phone_contact_###
# When Registered, will add the Phone Contact with ID number ### to the Player's contacts list.
Game Folder
Content ContentPacks GameModes Saves Screenshots Game Executable
Pokemon Data ContentPack Folder GameMode folder Savegame folder Version History
Data Maps Moves Scripts Control Files Content GameMode.dat Party.dat Player.dat Options.dat
poke battle structures V1 V2 trainer worldmap