Difference between revisions of "Version 2 Scripts"
| Line 21: | Line 21: | ||
=== @Battle === | === @Battle === | ||
|- | |- | ||
| .resetvars | |||
| Resets the battle variables to default. | |||
| None | |||
|- | |||
| .setvars(str,bool) | |||
| Changes the given variable to the given bool. | |||
| str - The variable to change.<br />cancatch, canrun, canblackout<br />int - The value to change the variable to. | |||
|- | |||
| .starttrainer(str) | |||
| Starts a trainer battle. | |||
| str - The file path of the file to start. | |||
|- | |||
| trainer(str) | |||
| Starts a trainer battle without displaying intro message or checking the register. | |||
| str - The file path of the file to start. | |||
| .wild(int1,int2) | |||
| Starts a wild battle against the given Pokemon. | |||
| int1 - The dex number of the pokemon to battle.<br />int2 - The level of the Pokemon to battle.<br />The pokemon can also be defined by inserting the [[Party Code]] between the parentheses.|- | |||
| colspan="3" | | | colspan="3" | | ||
=== @Camera === | === @Camera === | ||
|- | |- | ||
Revision as of 17:06, 15 July 2013
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 written as @command.subcommand and are no longer case sensitive. All commands require a subcommand.
Constructs were also expanded to be <construct.subconstruct> and can be used with switches to
Commands
Commands always have a subcommand. All combinations will be listed below.
The table is split into sections by Command.
* Unless otherwise specified a bool can be either 1(on) or 0(off).
** Unless otherwise specified X,Y,Z is a three dimensional position.
| Subcommand | Job | Inputs | ||||||
|---|---|---|---|---|---|---|---|---|
@Battle | ||||||||
| .resetvars | Resets the battle variables to default. | None | ||||||
| .setvars(str,bool) | Changes the given variable to the given bool. | str - The variable to change. cancatch, canrun, canblackout int - The value to change the variable to. | ||||||
| .starttrainer(str) | Starts a trainer battle. | str - The file path of the file to start. | ||||||
| trainer(str) | Starts a trainer battle without displaying intro message or checking the register. | str - The file path of the file to start. | .wild(int1,int2) | Starts a wild battle against the given Pokemon. | int1 - The dex number of the pokemon to battle. int2 - The level of the Pokemon to battle. The pokemon can also be defined by inserting the Party Code between the parentheses.|- |
@Camera | ||
| .activatethirdperson | Turns on third person. | None | ||||||
| .deactivatethirdperson | Turns off third person. | None | ||||||
| .reset | Sets the camera to its default location. | None | ||||||
| .set(X,Y,Z,sng1,sng2) | Changes the position of the camera. | X,Y,Z - The new postion of the camera. sng1 - The new yaw of the camera. sng2 - The new pitch of the camera. | ||||||
| .setpitch(sng) | Change the pitch of the camera. | sng - The value to make the pitch. | ||||||
| .setposition(X,Y,Z) | Changes the position of the camera. | X,Y,Z - The new position for the camera. | ||||||
| .setx(sng) | Change the X-coordinate of the camera. | sng - The value to make the X-coordinate. | ||||||
| .sety(sng) | Change the Y-coordinate of the camera. | sng - The value to make the Y-coordinate. | ||||||
| .setyaw(sng) | Change the yaw of the camera. | sng - The value to make the yaw. | ||||||
| .setz(sng) | Change the Z-coordinate of the camera. | sng - The value to make the Z-coordinate. | ||||||
| .togglethirdperson | Switch the camera mode. | None | ||||||
@Entity | ||||||||
@Environment | ||||||||
| .setcandig(bool) | Changes the candig option for the map to 'bool'. | bool - A bool for candig. | ||||||
| .setcanfly(bool) | Changes the canfly option for the map to 'bool'. | bool - A bool for canfly. | ||||||
| .setcanteleport(bool) | Changes the canteleportoption for the map to 'bool'. | bool - A bool for canteleport. | ||||||
| .setisdark(bool) | Changes the isdark option for the map to 'bool'. | bool - A bool for isdark. | ||||||
| .setregionweather(int) | Changes the random weather for all of the maps to the given weather. | int - Clear=0, Rain=1, Snow=2, Underwater=3, Sunny=4, Fog=5, Sandstorm=6 | ||||||
| .setrenderdistance(int\str) | Sets the render distance to the int or str given.) | int - 0-4 str - tiny, small, normal, far, or extreme. | ||||||
| .setweather(int) | Changes the weather for the map to the given weather. | int - Clear=0, Rain=1, Snow=2, Underwater=3, Sunny=4, Fog=5, Sandstorm=6 | ||||||
| .setwildpokemoneverywhere(bool) | Turns wild encounters on\off. | bool - A bool for wild encounters. | ||||||
| .setwildpokemongrass(bool) | Turns wild encounters on\off for grass. | bool - A bool for wild encounters. | ||||||
| .setwildpokemonwater(bool) | Turns wild encounters on\off for water. | bool - A bool for wild encounters. | ||||||
| .toggledarkness | Changes the darkness to what ever it isn't. | None | ||||||
@Item | ||||||||
| .give(int1,int2) | Gives int2 number of int1 items. | int1 - The ID of the item to give. int2 - The amount of the item to give. If not defined it is 1. | ||||||
| .messagegive(int1,int2) | Displays the message for what @item.give() did. | int1 - The ID of the item to give. int2 - The amount of the item to give. If not defined it is 1. | ||||||
| .remove(int1,int2) | Removes int2 number of int1 items. | int1 - The ID of the item to remove. int2 - The amount of the item to remove. Must be defined. | ||||||
| .repel(int) | Adds repel steps based on the item ID of the repel | int - The item ID of a repel. 20 = 100 steps, 42 = 200 steps, 43 = 250 steps | ||||||
@Level | ||||||||
| .update | Reloads the current map. | None | ||||||
| .wait(int) | Waits at that command for a given amount of time. | int - Time to wait in hundredths of a second. | ||||||
@Music | ||||||||
| .play(str) | Plays song 'str' until the song is changed by another script or a new map. | str - The song file to play. | ||||||
| .setmusicloop(str) | Makes song 'str' the map's song until the player leaves the map or this command is used again. | str - Song file to play. | ||||||
@NPC | ||||||||
@Player | ||||||||
@Pokemon | ||||||||
@Register | ||||||||
| .register(str) | Registers str in the register file of the save. | str - the string to register | ||||||
| .unregister(str) | Unregisters str from the register file of the save. | str - the string to unregister | ||||||
@Screen | ||||||||
@Script | ||||||||
| .run(str) | Does the given commands. | str - Contains the commands to execute. | ||||||
| .start(str) | Starts the given script. | The file name of the script to start. | ||||||
| .text(str) | Displays the given text. | str - The text to display. | ||||||
@Sound | ||||||||
| .play(str) | Play sound str. | str - the sound to play. | ||||||
@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, Pokemon, boolean, item) str2 - The name of the Value. str3 - The Value to be stored. | ||||||
@Text | ||||||||
| .show(str) | Displays str | str - The text to display. | ||||||
@Value | ||||||||
| .add(str,int) | Adds int to valuse str. | str - The value to be added to. int - The amount to add to the value. | ||||||
| .change(str1,str2) | Changes the contents of value str1 to str2. | str1 - The value to be changed. str2 - the content replacing the contents of str1. | ||||||
| .create(str1,str2) | Create value str1 with contents str2. | str1 - Name of value to be created. str2 - Contents of value to be created. | ||||||
| .delete(str) | Delete the named value. | str - The name of the value to delete. | ||||||
Switches
Switches do a comparison between a given paramater and a construct. examples:
:if:<pokemon.level(int)>>3 :if:<register.registered(str)>=true
switches may use multiple paramaters as well by using <and> and <or> Examples:
:if:<pokemon.level(int)><3 <and> <register.registered(str)>=true :if:<pokemon.level(int)>>=3 <or> <register.registered(str)>=false
:if:
:if: switches start with the line containing
:if:
the next line that follows must be
:then
to switch to the opposite of the condition use, the else statement is not necessary.
:else
to end an if statement use:
:endif
here is an example of the basic layout:
:if:conditions :then scripts to execute if conditions are met. :else scripts to execute if conditions are not met. :endif
:select:
:select: switches begin with a select statement and a condition
:select:<player.position>
- when: is used to switch the script, if the value(s) after the :when: matches that returned by the construct it will execute the scripts after it
:when:0,0,0
to end a select statement use
:endwhen
here is an example:
:select:condition :when:value1 Scripts to execute if value1=condition. :when:value2 Scripts to execute if value2=condition. :endwhen
@options.show()
@options.show(str,str,...) displays at most ten options at a time to the player to choose from. :when:, and :endwhen are used here similarly to the way they are used in select Exmple:
@options.show(Yes,No) :when:Yes Scripts to execte when the layer chooses Yes. :when:No Scripts to execte when the layer chooses No. :endwhen
if a choice is not given a coinciding :when: then it will simply skip to the :endwhen
:end
:end is used to end the script.
As a script is executing if it comes to :end through the normal following of the scripts(including switches) the script will cease to execute and control will return to the player. Example:
version=2 :if:register.registered(str1)>=true :then :end :endif @text.show(str2) @register.register(str1) :end
In the example the player will activate the script and not have registered str1, so it will skip to after the :endif, display str2, register str1, and then end. The next time the player activates the script they will have registered str1 and thus begin executing the :if: statement. This will end the script without displaying str2 or registering str1.
If a script does not reach an :end, it will continue looping the script til it does.
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 mathmatical functions including:
- +: Addition
- -: Subtraction
- /: Division
- *: Multiplication
- ^: Exponent
- %: Percent
- =: Equals
- >: Greater Than
- <: Less 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 |
|---|---|---|
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 | ||
| .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 |
| .season | None | winter, spring, summer, or fall |
| .seasonid | None | The ID for the season. winter=0, spring=1, summer=2, or fall=3 |
| .day | None | Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, or Saturday |
| .dayinformation | None | day,daytime |
| .week | None | The current week in the year. |
| .year | None | The current year(e.g. 2013) |
| .weather | None | Returns the Weather effecting the current map. Clear, Rain, Snow, Underwater, Sunny, Fog , Sandstorm |
| .mapweather | None | Same as .weather. |
| .currentmapweather | None | Same as .weather. |
| .regionweather | None | Returns the random weather effecting the whole area. Uses the same names as .weather. |
| .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 |
| .mapweatherid | None | Same as .weatherid. |
| .currentmapweatherid | None | Same as .weatherid. |
| .regionweatherid | None | Returns the ID of random weather effecting the whole area. Uses the same IDs as .weatherid. |
| .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. |
| .candig | None | A bool representing if the player can dig from 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. |
| .wildpokemoneverywhere | None | A bool representing if the player can find Pokémon on the map. |
| .isdark | None | A bool representing the darkness of the map. |
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 | ||
| .mapfile | None | Returns the file path of the current map relative to the maps folder. |
| .levelfile | None | Same as .mapfile. |
| .filename | None | Returns the name of the current map file without extension. |
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. |
Phone | ||
| .callflag | None | Returns calling if you are calling or receiving if someone is calling you. |
| .got | None | A bool representing if the player has received the Phone. |
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. |
| .ismoving | None | Returns a bool representing if the player is moving or not. |
| .hasbadge(int) | int - A badge ID. | Returns a bool representing if the player has that badge. |
| .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. |
| .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. |
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. |
| .defense(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. |
| .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. |
| .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. |
| .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. |
| .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. |
| .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. |
| .selected | None | Returns the Party index of the Pokémon selected using @Pokemon.select. |
| .selectedmove | None | Returns the index of the Pokémon's attack selected using @Pokemon.selectmove. |
| .spatk(int) | int - Party index of a Pokémon(0-5) | Returns the spec. attack stat of the given party member. |
| .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. |
| .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. |
Storage | ||
| .count(str) | str1 - The type of values to count(integer, string, Pokemon, 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, Pokemon, 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. |
| .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) |
| .unixtimestamp | None | Returns the Unix time stamp. (See here for more details.) |
| .year | None | Returns the current year. |
Value | ||
| .get(str) | str - The name of the stored value. | Returns the value stored as str. |
| 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 | |||||||||||