Difference between revisions of "Version 2 Scripts New"

From Pokémon 3D Wiki
Jump to navigation Jump to search
m
m
Line 68: Line 68:
| Argument1 = {{ScriptArgumentV2|pokemonData|PokemonData|1|False||}},{{ScriptArgumentV2|musicloop|Str|1|True||}}
| Argument1 = {{ScriptArgumentV2|pokemonData|PokemonData|1|False||}},{{ScriptArgumentV2|musicloop|Str|1|True||}}
| Description1 = Initializes the battle with a wild Pokémon.
| Description1 = Initializes the battle with a wild Pokémon.
| Input1 = {{ScriptArgumentV2|pokemonData|PokemonData|1|False||Input}},{{ScriptArgumentV2|musicloop|Str|1|True||Input}}
| Input1 = {{ScriptArgumentV2|pokemonData|PokemonData|1|False||Input}}<br />{{ScriptArgumentV2|musicloop|Str|1|True||Input}}
| Argument2 = {{ScriptArgumentV2|pokemonID|Int|1|False||}},{{ScriptArgumentV2|level|Int|2|False||}},{{ScriptArgumentV2|shiny|Int|3|True|-1|}},{{ScriptArgumentV2|musicloop|Str|1|True||}},{{ScriptArgumentV2|introtype|Int|4|True|0-10|}}
| Argument2 = {{ScriptArgumentV2|pokemonID|Int|1|False||}},{{ScriptArgumentV2|level|Int|2|False||}},{{ScriptArgumentV2|shiny|Int|3|True|-1|}},{{ScriptArgumentV2|musicloop|Str|1|True||}},{{ScriptArgumentV2|introtype|Int|4|True|0-10|}}
| Input2 = {{ScriptArgumentV2|pokemonID|Int|1|False||Input}},{{ScriptArgumentV2|level|Int|2|False||Input}},{{ScriptArgumentV2|shiny|Int|3|True|-1|Input}},{{ScriptArgumentV2|musicloop|Str|1|True||Input}},{{ScriptArgumentV2|introtype|Int|4|True|0-10|Input}}
| Input2 = {{ScriptArgumentV2|pokemonID|Int|1|False||Input}}<br />{{ScriptArgumentV2|level|Int|2|False||Input}}<br />{{ScriptArgumentV2|shiny|Int|3|True|-1|Input}}<br />{{ScriptArgumentV2|musicloop|Str|1|True||Input}}<br />{{ScriptArgumentV2|introtype|Int|4|True|0-10|Input}}
}}
}}



Revision as of 20:41, 28 December 2014

There will be a new conversion coming very soon, I am remaking the template to support a better way of adding command. Sorry for the inconvenience caused.

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 are written as <construct.subconstruct> and can be used basically everywhere.


A General Note to all GameMode Scripters ( Must Read )

  1. This list is currently updated as of v0.52.1 Script Library found in game.
  2. This list is the same as what you can see when typing @help(command).
  3. If you are a GameMode Scripter or trying to be one, you are recommended to download Notepad++ with our special syntax highlighter for checking typo mistake.
  4. If you find that any command you found here doesn't work the way you want it to be, it might be a bug. Try report it over here.
    Make sure that your title include the game version and state clearly what you are trying to do.
  5. The line number shown in the crash logs starts counting after version=2. Empty lines are ignored hence only each line contains words are taken into consideration.


Important info / definition of certain things before we get started.

By Default, the Argument Types are:

  • Str ( Str are define as letters or symbols )
  • Int ( Int are define as Integer numbers )
  • Sng ( Sng are define as Real numbers )
  • ItemCollection ( ItemCollection are define as {itemID|amount|price} )
  • Bool ( Bool are define as words such as True, False )
  • IntArr ( IntArr are define as an array of Integer numbers )
  • StrArr ( StrArr are define as an array of letters or symbols )
  • SngArr ( SngArr are define as an array of Real numbers )
  • BoolArr ( BoolArr are define as an array of words such as True, False )
  • PokemonData ( PokemonData are define as Pokemon Code )
  • Arr ( Arr are define as an array of something. )


For any Optional Argument, it will be underlined and in red colour for example "Str1,Str2,Str3,..."
For any Array Argument, it will be surrounded by a grouped square bracket for example "[Str1,Int2,Int3,Int4,Int5],Int6..."


Commands

Commands are scripts that tells the game what to do. It comes with @ and usually used with switches.

The table below is split into sections by Command.
You may use the sort feature to make it list according to alphanumeric order.


@Battle

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]


@Battle.starttrainer(Str1) Initializes a trainer interaction and checks if the player has already beaten that trainer. Str1 = trainerFile
The relative file path of the Trainer File without extension. (Pokemon\Scripts\trainer\xxx)
@Battle.trainer(Str1) Initializes a trainer battle. Str1 = trainerFile
The relative file path of the Trainer File without extension. (Pokemon\Scripts\trainer\xxx)
@Battle.wild(PokemonData1,Str1)
@Battle.wild(Int1,Int2,Int3,Str1,Int4)
Initializes the battle with a wild Pokémon. PokemonData1 = pokemonData
The Pokémon Code.
Str1 = musicloop
The file name of the Music File without extension. (Pokemon\Content\Songs\xxx)

Int1 = pokemonID
The Pokémon national dex number.
Int2 = level
The Pokémon Level.
Int3 = shiny
-1 = Random, 0 = Not shiny, 1 = Always shiny. [Default value: -1]
Str1 = musicloop
The file name of the Music File without extension. (Pokemon\Content\Songs\xxx)
Int4 = introtype
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-10]


@Battle.setvar


@Camera

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Camera.set
@Camera.reset
@Camera.setyaw
@Camera.setpitch
@Camera.setposition
@Camera.setx
@Camera.sety
@Camera.setz
@Camera.togglethirdperson
@Camera.activatethirdperson
@Camera.deactivatethirdperson
@Camera.fix
@Camera.defix
@Camera.togglefix


@Chat

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Chat.clear


@Daycare

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Daycare.takeegg
@Daycare.takepokemon
@Daycare.leavepokemon
@Daycare.removeegg
@Daycare.clean


@Daycare.call
@Daycare.cleardata


@Entity

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Entity.showmessagebulb
@Entity.warp
@Entity.scale
@Entity.remove
@Entity.setid
@Entity.setopacity
@Entity.setvisible
@Entity.setadditionalvalue
@Entity.setcollision
@Entity.settetxure
@Entity.addtoposition


@Environment

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Environment.setweather
@Environment.setregionweather
@Environment.setcanfly
@Environment.setcandig
@Environment.setcanteleport
@Environment.setwildpokemongrass
@Environment.setwildpokemonwater
@Environment.setwildpokemoneverywhere
@Environment.setisdark
@Environment.setrenderdistance
@Environment.toggledarkness


@Item

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Item.give
@Item.remove
@Item.clearitem
@Item.messagegive
@Item.repel


@Level

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Level.wait
@Level.update
@Level.waitforevents
@Level.waitforsave
@Level.reload
@Level.setsafari


@Music

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Music.play
@Music.setmusicloop
@Music.stop
@Music.pause
@Music.resume


@NPC

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@NPC.remove
@NPC.position
@NPC.warp
@NPC.addtoposition
@NPC.register
@NPC.unregister
@NPC.wearskin
@NPC.move
@NPC.setMoveY
@NPC.moveasync
@NPC.turn
@NPC.spawn
@NPC.setspeed


@Options

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Options.show
@Options.setcancelindex


@Player

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Player.receivepokedex
@Player.receivepokegear
@Player.renamerivel
@Player.wearskin
@Player.setonlineskin
@Player.move
@Player.moveasync
@Player.turn
@Player.turnasync
@Player.turnto
@Player.turntoasync
@Player.warp
@Player.stopmovement
@Player.addmoney
@Player.money
@Player.setmovement
@Player.resetmovement
@Player.getbadge
@Player.achieveemblem
@Player.addbp
@Player.showrod
@Player.hiderod
@Player.showpokemonfollow
@Player.hidepokemonfollow
@Player.togglepokemonfollow
@Player.save
@Player.setrivalname


@Pokedex

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Pokedex.setautodetect


@Pokemon

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@pokemon.cry
@pokemon.remove
@pokemon.add
@pokemon.add
@pokemon.setadditionalvalue
@pokemon.setadditionaldata
@pokemon.setnickname
@pokemon.setstat
@pokemon.clear
@pokemon.removeattack
@pokemon.clearattacks
@pokemon.addattack
@pokemon.setshiny
@pokemon.changelevel
@pokemon.gainexp
@pokemon.setnature
@pokemon.npcTrade genderID: 0-2


@Radio

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Radio.allowchannel
@Radio.blockchannel


@Register

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Register.register
@Register.unregister
@Register.registertime


@Screen

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Screen.storagesystem
@Screen.apricornkurt
@Screen.trade
@Screen.townmap
@Screen.donation
@Screen.blackout
@Screen.fadein
@Screen.fadeout
@Screen.credits
@Screen.halloffame
@Screen.teachmoves
@Screen.mailsystem
@Screen.pvp
@Screen.input
@Screen.mysteryevent
@Screen.showPokemon


@Script

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Script.start
@Script.text
@Script.run


@Sound

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Sound.play
@Sound.playadvanced


@Storage

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Storage.set
@Storage.clear
@Storage.update


@Text

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Text.show
@Text.setfont
@Text.debug
@Text.log


@Title

Command [@Command.Subcommand(Argument Types)] Description Inputs [Argument Types = Argument Name]
@Title.add
@Title.clear


Constructs

Constructs are script that return a specific values in game. It is used with commands or switches.

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 mathematical 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.


Battle

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@Battle.defeatmessage
@Battle.intromessage
@Battle.outromessage
@Battle.won


Camera

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@Camera.isfixed
@Camera.x
@Camera.y
@Camera.z


Daycare

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@Daycare.pokemonID
@Daycare.pokemonName
@Daycare.pokemonSprite
@Daycare.shinyIndicator
@Daycare.countpokemon
@Daycare.haspokemon
@Daycare.canswim
@Daycare.hasegg
@Daycare.grownlevels
@Daycare.currentlevel
@Daycare.canbreed


Entity

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@Entity.visible
@Entity.opacity
@Entity.position
@Entity.positionx
@Entity.positiony
@Entity.positionz
@Entity.scale
@Entity.additionalvalue
@Entity.collision


Environment

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@environment.daytime
@environment.daytimeID
@environment.season
@environment.seasonID
@environment.day
@environment.dayofyear
@environment.dayinformation
@environment.week
@environment.year
@environment.weather
@environment.mapweather
@environment.currentmapweather
@environment.weatherid
@environment.mapweatherid
@environment.currentmapweatherid
@environment.regionweather
@environment.regionweatherid
@environment.canfly
@environment.candig
@environment.canteleport
@environment.wildpokemongrass
@environment.wildpokemonwater
@environment.wildpokemoneverywhere
@environment.isdark


Inventory

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@inventory.countitem
@inventory.countitems
@inventory.name
@inventory.ID


Level

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@level.mapfile
@level.levelfile
@level.filename
@level.riding
@level.surfing


Math

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@math.int
@math.sng
@math.abs
@math.ceiling
@math.floor
@math.isint
@math.issng


NPC

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@npc.position
@npc.exists
@npc.ismoving
@npc.moved
@npc.skin
@npc.facing
@npc.ID
@npc.name
@npc.action
@npc.additionalvalue
@npc.movement
@npc.hasmoverectangles
@npc.trainertexture


Phone

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@phone.callflag
@phone.got


Player

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@player.position
@player.hasbadge
@player.skin
@player.velocity
@player.ismoving
@player.facing
@player.compass
@player.money
@player.name
@player.gender
@player.bp
@player.badges
@player.thirdperson
@player.rival
@player.rivalname
@player.ot
@player.gamejoltid


Pokedex

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@pokedex.caught
@pokedex.seen
@pokedex.shiny


Pokemon

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@pokemon.id
@pokemon.number
@pokemon.data
@pokemon.level
@pokemon.hasfullhp
@pokemon.hp
@pokemon.atk
@pokemon.def
@pokemon.spatk
@pokemon.spdef
@pokemon.speed
@pokemon.maxhp
@pokemon.isegg
@pokemon.additionaldata
@pokemon.nickname
@pokemon.name
@pokemon.ot
@pokemon.trainer
@pokemon.itemid
@pokemon.friendship
@pokemon.itemname
@pokemon.catchball
@pokemon.catchmethod
@pokemon.catchlocation
@pokemon.hasattack
@pokemon.countattacks
@pokemon.attackname
@pokemon.isShiny
@pokemon.nature
@pokemon.ownpokemon
@pokemon.islegendary
@pokemon.freeplaceinparty
@pokemon.nopokemon
@pokemon.count
@pokemon.countbattle
@pokemon.has
@pokemon.selected
@pokemon.selectedmove
@pokemon.hasegg
@pokemon.maxpartylevel
@pokemon.evhp
@pokemon.evatk
@pokemon.evdef
@pokemon.evspatk
@pokemon.evspdef
@pokemon.evspeed
@pokemon.ivhp
@pokemon.ivatk
@pokemon.ivdef
@pokemon.ivspatk
@pokemon.ivspdef
@pokemon.spawnwild
@pokemon.itemdata
@pokemon.countHallofFame
@pokemon.learnedTutorMove
@pokemon.totalexp
@pokemon.needexp
@pokemon.currentexp
@pokemon.generateFrontier
@pokemon.spawnwild
@pokemon.spawn
@pokemon.OTmatch
@pokemon.randomOT
@pokemon.status
@pokemon.canevolve
@pokemon.type1
@pokemon.type2
@pokemon.istype


Radio

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@radio.currentchannel


Register

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@register.registered
@register.count
@register.type
@register.value


Rival

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@Rival.name


Storage

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@storage.get
@storage.count


System

Construct [<Construct.SubConstruct(Argument Types)>] Description Inputs [Argument Types = Argument Name]
@system.random
@system.unixtimestamp
@system.dayofyear
@system.year
@system.booltoint
@system.calcint
@system.int
@system.calcsng
@system.sng
@system.sort
@system.isinsightscript
@system.lastinput
@system.return
@system.isint
@system.issng
@system.chrw


Switches

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

:if:


If you want to make the script run by certain condition, :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 condition that you can use.

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

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

The script will run if a value that returns from the constructs does not match the value given.

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

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

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 )
Ans: No. This is because the script does not support it. Also, the script will not understand what condition you are trying to say so I recommend to start a new :if: switches 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 )
Ans: Yes. The script will be able to handle this.


3. Why it didn't work? Why it skip the condition defined?
Ans: This is probably your own typo mistake. If you are sure that it isn't report the bug.



:select:


If you want to make the script run by selecting certain condition, :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 possible value that the construct given so that the script will run when condition is met.

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.


FAQ:


1. Why it didn't work? Why it skip the condition defined?
Ans: This is probably your own typo mistake. If you are sure that it isn't, report the bug.



@options.show()


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

Typical Usage:

@options.show(option1,option2,optioni)
:when:Option1
@Command.Subcommand(Argument Types)
:endwhen


Option


This field is to define the possible option that you define in @options.show() so that the script will run when player choose the options.

Define the possible option that you define in @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() switches.


FAQ:


1. Why it didn't work? Why it skip the condition defined?
Ans: This is probably your own typo mistake. If you are sure that it isn't, report the bug.



:while:


If you want to loop a certain command until it met the condition, this will do the job.

Typical Usage:

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


FAQ:


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

2. How come it didn't loop? How come it stop prematurely despite :exitwhile is not used?
Ans: 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? Ans: No. Nilllzz officially said it is not possible.



:endscript


If you want to stop all script prematurely, this shall do the job.

Typical Usage:

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


FAQ:


1. How come it didn't work?
Ans: Unfortunately, even I myself do not know what is intended for it to work. You might need to ask Nilllzz by creating a new thread in the community support thread.



:return:


More of a script function that return a value.

Typical Usage:

:return:True
:end

Once you use <System.return>, it will return True.


Comments


To add some comments in your script like what programmer does, you can use " # " a hash at the start of the line.

Typical Usage:

# This is a comment that says nothing
@Command.Subcommand(Argument Types) # <= Unfortunately, hash at here do not work.
# @Command.Subcommand(Argument Types) <= It will not run this script at all :D


FAQ:


1. Can it support multiple line without keep using # all the time?
Ans: Unfortunately, no.



:end


To end the current running script, this will do ithe job

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
# Give Player PokéGear
phone_contact_###
# Add Phone Contact ID ###
pokegear_card_minimap
# Give PokéNav MiniMap Card 
pokegear_card_frontier
# Give PokéNav Frontier Emblem Card
Game Folder
Content ContentPacks GameModes Saves Screenshots Game Executable
Pokemon Data ContentPack Folder GameMode folder Savegame folder Version History
Data Maps Moves Items Scripts Control Files Content GameMode.dat Party.dat Player.dat Options.dat
poke battle structures V1 V2 trainer worldmap