pokecrystal/docs/event_commands.md

564 lines
11 KiB
Markdown
Raw Normal View History

# Event Commands
2019-03-11 03:00:01 +00:00
Defined in [macros/scripts/events.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](https://github.com/pret/pokecrystal/blob/master/engine/overworld/scripting.asm).
2017-12-15 00:04:44 +00:00
2018-01-26 19:53:00 +00:00
Until this document is filled out, the [G/S Scripting Compendium](https://hax.iimarckus.org/files/scriptingcodes_eng.htm) has descriptions for most of these commands. It was written for G/S binary hacking and not Crystal assembly hacking, so it's not 100% accurate for pokecrystal.
2017-12-15 00:04:44 +00:00
2018-01-17 18:58:50 +00:00
## `$00`: <code>scall <i>script</i></code>
2018-01-17 18:58:50 +00:00
## `$01`: <code>farscall <i>script</i></code>
## `$02`: <code>memcall <i>script</i></code>
## `$03`: <code>sjump <i>script</i></code>
## `$04`: <code>farsjump <i>script</i></code>
## `$05`: <code>memjump <i>script</i></code>
2018-02-03 02:09:17 +00:00
## `$06`: <code>ifequal <i>byte</i>, <i>script</i></code>
2018-02-03 02:09:17 +00:00
## `$07`: <code>ifnotequal <i>byte</i>, <i>script</i></code>
2018-01-17 18:58:50 +00:00
## `$08`: <code>iffalse <i>script</i></code>
2018-01-17 18:58:50 +00:00
## `$09`: <code>iftrue <i>script</i></code>
2018-02-03 02:09:17 +00:00
## `$0A`: <code>ifgreater <i>byte</i>, <i>script</i></code>
2018-02-03 02:09:17 +00:00
## `$0B`: <code>ifless <i>byte</i>, <i>script</i></code>
2018-01-17 18:58:50 +00:00
## `$0C`: <code>jumpstd <i>std_script</i></code>
2018-01-17 18:58:50 +00:00
## `$0D`: <code>callstd <i>std_script</i></code>
2018-01-17 18:58:50 +00:00
## `$0E`: <code>callasm <i>asm</i></code>
2018-01-17 18:58:50 +00:00
## `$0F`: <code>special <i>special_pointer</i></code>
## `$10`: <code>memcallasm <i>asm</i></code>
2018-01-17 18:58:50 +00:00
## `$11`: <code>checkmapscene <i>map</i></code>
2018-01-17 18:58:50 +00:00
## `$12`: <code>setmapscene <i>map</i>, <i>scene_id</i></code>
2017-12-24 20:09:28 +00:00
## `$13`: `checkscene`
2018-01-17 18:58:50 +00:00
## `$14`: <code>setscene <i>scene_id</i></code>
## `$15`: <code>setval <i>value</i></code>
<code>[wScriptVar] = <i>value</i></code>
## `$16`: <code>addval <i>value</i></code>
<code>[wScriptVar] += <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$17`: <code>random <i>value</i></code>
2017-12-12 02:40:21 +00:00
## `$18`: `checkver`
## `$19`: <code>readmem <i>address</i></code>
<code>[wScriptVar] = [<i>address</i>]</code>
## `$1A`: <code>writemem <i>address</i></code>
<code>[<i>address</i>] = [wScriptVar]</code>
## `$1B`: <code>loadmem <i>address</i>, <i>value</i></code>
<code>[<i>address</i>] = <i>value</i></code>
## `$1C`: <code>readvar <i>variable</i></code>
<code>[wScriptVar] = GetVarAction(<i>variable</i>)</code>
## `$1D`: <code>writevar <i>variable</i></code>
<code>GetVarAction(<i>variable</i>) = [wScriptVar]</code>
## `$1E`: <code>loadvar <i>variable</i>, <i>value</i></code>
<code>GetVarAction(<i>variable</i>) = <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$1F`: <code>giveitem <i>item_id</i>[, <i>quantity</i>=1]</code>
2018-01-17 18:58:50 +00:00
## `$20`: <code>takeitem <i>item_id</i>[, <i>quantity</i>=1]</code>
2018-01-17 18:58:50 +00:00
## `$21`: <code>checkitem <i>item_id</i></code>
2018-01-17 18:58:50 +00:00
## `$22`: <code>givemoney <i>account</i>, <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$23`: <code>takemoney <i>account</i>, <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$24`: <code>checkmoney <i>account</i>, <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$25`: <code>givecoins <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$26`: <code>takecoins <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$27`: <code>checkcoins <i>value</i></code>
2018-01-17 18:58:50 +00:00
## `$28`: <code>addcellnum <i>contact_id</i></code>
2018-01-17 18:58:50 +00:00
## `$29`: <code>delcellnum <i>contact_id</i></code>
2018-01-17 18:58:50 +00:00
## `$2A`: <code>checkcellnum <i>contact_id</i></code>
2018-01-17 18:58:50 +00:00
## `$2B`: <code>checktime <i>time</i></code>
2018-01-17 18:58:50 +00:00
## `$2C`: <code>checkpoke <i>mon_id</i></code>
2018-01-17 18:58:50 +00:00
## `$2D`: <code>givepoke <i>mon_id</i>, <i>level</i>[, <i>item</i>=0[, <i>trainer</i>=0, <i>ot_name</i>, <i>nickname</i>]]</code>
2018-01-17 18:58:50 +00:00
## `$2E`: <code>giveegg <i>mon_id</i>, <i>level</i></code>
## `$2F`: <code>givepokemail <i>pointer</i></code>
## `$30`: <code>checkpokemail <i>pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$31`: <code>checkevent <i>event_flag</i></code>
2018-01-17 18:58:50 +00:00
## `$32`: <code>clearevent <i>event_flag</i></code>
2018-01-17 18:58:50 +00:00
## `$33`: <code>setevent <i>event_flag</i></code>
2018-01-17 18:58:50 +00:00
## `$34`: <code>checkflag <i>engine_flag</i></code>
2018-01-17 18:58:50 +00:00
## `$35`: <code>clearflag <i>engine_flag</i></code>
2018-01-17 18:58:50 +00:00
## `$36`: <code>setflag <i>engine_flag</i></code>
2017-12-12 02:40:21 +00:00
## `$37`: `wildon`
2017-12-12 02:40:21 +00:00
## `$38`: `wildoff`
2018-01-17 18:58:50 +00:00
## `$39`: <code>xycompare <i>pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$3A`: <code>warpmod <i>warp_id</i>, <i>map</i></code>
2018-01-17 18:58:50 +00:00
## `$3B`: <code>blackoutmod <i>map</i></code>
2018-01-17 18:58:50 +00:00
## `$3C`: <code>warp <i>map</i>, <i>x</i>, <i>y</i></code>
## `$3D`: <code>getmoney <i>string_buffer</i>, <i>account</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = PrintNum(GetMoneyAccount(<i>account</i>))</code>
## `$3E`: <code>getcoins <i>string_buffer</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = PrintNum([wCoins])</code>
## `$3F`: <code>getnum <i>string_buffer</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = PrintNum([wScriptVar])</code>
## `$40`: <code>getmonname <i>string_buffer</i>, <i>mon_id</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetPokemonName(<i>mon_id</i>)</code>
If <code><i>mon_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[wScriptVar]` instead.
## `$41`: <code>getitemname <i>string_buffer</i>, <i>item_id</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetItemName(<i>item_id</i>)</code>
If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[wScriptVar]` instead.
## `$42`: <code>getcurlandmarkname <i>string_buffer</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetLandmarkName(GetWorldMapLocation())</code>
## `$43`: <code>gettrainername <i>string_buffer</i>, <i>trainer_group</i>, <i>trainer_id</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetTrainerName(<i>trainer_group</i>, <i>trainer_id</i>)</code>
## `$44`: <code>getstring <i>string_buffer</i>, <i>text_pointer</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = CopyName1([wScriptBank], <i>text_pointer</i>)</code>
2017-12-12 02:40:21 +00:00
## `$45`: `itemnotify`
2017-12-12 02:40:21 +00:00
## `$46`: `pocketisfull`
2017-12-12 02:40:21 +00:00
## `$47`: `opentext`
2018-01-17 18:58:50 +00:00
## `$48`: <code>refreshscreen [<i>dummy</i>=0]</code>
2017-12-12 02:40:21 +00:00
## `$49`: `closetext`
2019-04-19 15:35:27 +00:00
## `$4A`: <code>writeunusedbytebuffer <i>byte</i></code>
<code>[<i>wUnusedScriptByteBuffer</i>] = <i>byte</i></code>
2018-01-17 18:58:50 +00:00
## `$4B`: <code>farwritetext <i>text_pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$4C`: <code>writetext <i>text_pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$4D`: <code>repeattext <i>byte1</i>, <i>byte2</i></code>
2017-12-12 02:40:21 +00:00
## `$4E`: `yesorno`
## `$4F`: <code>loadmenu <i>menu_header</i></code>
2017-12-12 02:40:21 +00:00
## `$50`: `closewindow`
2018-01-17 18:58:50 +00:00
## `$51`: <code>jumptextfaceplayer <i>text_pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$52`: <code>farjumptext <i>text_pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$53`: <code>jumptext <i>text_pointer</i></code>
2017-12-12 02:40:21 +00:00
## `$54`: `waitbutton`
2017-12-12 02:40:21 +00:00
## `$55`: `buttonsound`
2018-01-17 18:58:50 +00:00
## `$56`: <code>pokepic <i>mon_id</i></code>
2017-12-12 02:40:21 +00:00
## `$57`: `closepokepic`
2017-12-12 02:40:21 +00:00
## `$58`: `_2dmenu`
2017-12-12 02:40:21 +00:00
## `$59`: `verticalmenu`
2017-12-12 02:40:21 +00:00
## `$5A`: `loadpikachudata`
2017-12-12 02:40:21 +00:00
## `$5B`: `randomwildmon`
## `$5C`: `loadtemptrainer`
`[wOtherTrainer] = [wTempTrainer]`
2018-01-17 18:58:50 +00:00
## `$5D`: <code>loadwildmon <i>mon_id</i>, <i>level</i></code>
2018-01-17 18:58:50 +00:00
## `$5E`: <code>loadtrainer <i>trainer_group</i>, <i>trainer_id</i></code>
2017-12-12 02:40:21 +00:00
## `$5F`: `startbattle`
2017-12-12 02:40:21 +00:00
## `$60`: `reloadmapafterbattle`
2018-01-17 18:58:50 +00:00
## `$61`: <code>catchtutorial <i>byte</i></code>
## `$62`: <code>trainertext <i>text_id</i></code>
2018-01-17 18:58:50 +00:00
## `$63`: <code>trainerflagaction <i>action</i></code>
2018-01-17 18:58:50 +00:00
## `$64`: <code>winlosstext <i>win_text_pointer</i>, <i>loss_text_pointer</i></code>
2017-12-12 02:40:21 +00:00
## `$65`: `scripttalkafter`
2018-02-03 02:09:17 +00:00
## `$66`: `endifjustbattled`
2018-02-03 02:09:17 +00:00
## `$67`: `checkjustbattled`
2018-01-17 18:58:50 +00:00
## `$68`: <code>setlasttalked <i>object_id</i></code>
2018-01-17 18:58:50 +00:00
## `$69`: <code>applymovement <i>object_id</i>, <i>data_pointer</i></code>
## `$6A`: <code>applymovementlasttalked <i>data_pointer</i></code>
2017-12-12 02:40:21 +00:00
## `$6B`: `faceplayer`
2018-01-17 18:58:50 +00:00
## `$6C`: <code>faceobject <i>object1</i>, <i>object2</i></code>
2018-01-17 18:58:50 +00:00
## `$6D`: <code>variablesprite <i>variable_sprite_id</i>, <i>sprite_id</i></code>
2018-01-17 18:58:50 +00:00
## `$6E`: <code>disappear <i>object_id</i></code>
2018-01-17 18:58:50 +00:00
## `$6F`: <code>appear <i>object_id</i></code>
2018-01-17 18:58:50 +00:00
## `$70`: <code>follow <i>object2</i>, <i>object1</i></code>
2017-12-12 02:40:21 +00:00
## `$71`: `stopfollow`
2018-01-17 18:58:50 +00:00
## `$72`: <code>moveobject <i>object_id</i>, <i>x</i>, <i>y</i></code>
2018-01-17 18:58:50 +00:00
## `$73`: <code>writeobjectxy <i>object_id</i></code>
2018-01-17 18:58:50 +00:00
## `$74`: <code>loademote <i>emote_id</i></code>
2018-01-17 18:58:50 +00:00
## `$75`: <code>showemote <i>emote_id</i>, <i>object_id</i>, <i>length</i></code>
## `$76`: <code>turnobject <i>object_id</i>, <i>facing</i></code>
2018-01-17 18:58:50 +00:00
## `$77`: <code>follownotexact <i>object2</i>, <i>object1</i></code>
2018-01-17 18:58:50 +00:00
## `$78`: <code>earthquake <i>param</i></code>
## `$79`: <code>changemapblocks <i>blockdata_pointer</i></code>
<code>ChangeMap(<i>blockdata_pointer</i>)</code>
2018-01-17 18:58:50 +00:00
## `$7A`: <code>changeblock <i>x</i>, <i>y</i>, <i>block</i></code>
2017-12-12 02:40:21 +00:00
## `$7B`: `reloadmap`
2017-12-12 02:40:21 +00:00
## `$7C`: `reloadmappart`
2018-01-17 18:58:50 +00:00
## `$7D`: <code>writecmdqueue <i>queue_pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$7E`: <code>delcmdqueue <i>byte</i></code>
2018-01-17 18:58:50 +00:00
## `$7F`: <code>playmusic <i>music_id</i></code>
2017-12-12 02:40:21 +00:00
## `$80`: `encountermusic`
2018-01-17 18:58:50 +00:00
## `$81`: <code>musicfadeout <i>music_id</i>, <i>length</i></code>
2017-12-12 02:40:21 +00:00
## `$82`: `playmapmusic`
2017-12-12 02:40:21 +00:00
## `$83`: `dontrestartmapmusic`
2018-01-17 18:58:50 +00:00
## `$84`: <code>cry <i>mon_id</i></code>
2018-01-17 18:58:50 +00:00
## `$85`: <code>playsound <i>sfx_id</i></code>
2017-12-12 02:40:21 +00:00
## `$86`: `waitsfx`
2017-12-12 02:40:21 +00:00
## `$87`: `warpsound`
2017-12-12 02:40:21 +00:00
## `$88`: `specialsound`
2019-02-16 21:06:11 +00:00
## `$89`: <code>autoinput <i>input_pointer</i></code>
2018-01-17 18:58:50 +00:00
## `$8A`: <code>newloadmap <i>which_method</i></code>
2018-01-17 18:58:50 +00:00
## `$8B`: <code>pause <i>length</i></code>
2018-01-17 18:58:50 +00:00
## `$8C`: <code>deactivatefacing <i>length</i></code>
## `$8D`: <code>prioritysjump <i>script</i></code>
2017-12-12 02:40:21 +00:00
## `$8E`: `warpcheck`
## `$8F`: <code>stopandsjump <i>script</i></code>
2017-12-12 02:40:21 +00:00
## `$90`: `return`
2017-12-12 02:40:21 +00:00
## `$91`: `end`
2018-01-17 18:58:50 +00:00
## `$92`: <code>reloadandreturn <i>which_method</i></code>
2018-02-03 02:09:17 +00:00
## `$93`: `endall`
## `$94`: <code>pokemart <i>mart_type</i>, <i>mart_id</i></code>
2018-01-17 18:58:50 +00:00
## `$95`: <code>elevator <i>floor_list</i></code>
2018-01-17 18:58:50 +00:00
## `$96`: <code>trade <i>trade_id</i></code>
2018-01-17 18:58:50 +00:00
## `$97`: <code>askforphonenumber <i>contact_id</i></code>
2018-01-17 18:58:50 +00:00
## `$98`: <code>phonecall <i>call_id</i></code>
2017-12-12 02:40:21 +00:00
## `$99`: `hangup`
2018-01-17 18:58:50 +00:00
## `$9A`: <code>describedecoration <i>byte</i></code>
2018-01-17 18:58:50 +00:00
## `$9B`: <code>fruittree <i>tree_id</i></code>
2018-01-17 18:58:50 +00:00
## `$9C`: <code>specialphonecall <i>call_id</i></code>
2017-12-12 02:40:21 +00:00
## `$9D`: `checkphonecall`
2018-01-17 18:58:50 +00:00
## `$9E`: <code>verbosegiveitem <i>item_id</i>[, <i>quantity</i>=1]</code>
## `$9F`: <code>verbosegiveitemvar <i>item_id</i>, <i>variable</i></code>
2018-01-17 18:58:50 +00:00
## `$A0`: <code>swarm <i>swarm_id</i>, <i>map</i></code>
2017-12-12 02:40:21 +00:00
## `$A1`: `halloffame`
2017-12-12 02:40:21 +00:00
## `$A2`: `credits`
2018-01-17 18:58:50 +00:00
## `$A3`: <code>warpfacing <i>facing</i>, <i>map</i>, <i>x</i>, <i>y</i></code>
## `$A4`: <code>battletowertext <i>bttext_id</i></code>
## `$A5`: <code>getlandmarkname <i>string_buffer</i>, <i>landmark_id</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetLandmarkName(<i>landmark_id</i>)</code>
## `$A6`: <code>gettrainerclassname <i>string_buffer</i>, <i>trainer_group</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetName(TRAINER_NAME, <i>trainer_group</i>)</code>
## `$A7`: <code>getname <i>string_buffer</i>, <i>type</i>, <i>id</i></code>
<code>GetStringBuffer(<i>string_buffer</i>) = GetName(<i>type</i>, <i>id</i>)</code>
2018-01-17 18:58:50 +00:00
## `$A8`: <code>wait <i>duration</i></code>
2018-02-03 02:09:17 +00:00
## `$A9`: `checksave`