pokecrystal/docs/event_commands.md

11 KiB

Event Commands

Defined in macros/scripts/events.asm and engine/overworld/scripting.asm:ScriptCommandTable.

Until this document is filled out, the G/S Scripting Compendium 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.

$00: scall script

$01: farscall script

$02: memcall script

$03: sjump script

$04: farsjump script

$05: memjump script

$06: ifequal byte, script

$07: ifnotequal byte, script

$08: iffalse script

$09: iftrue script

$0A: ifgreater byte, script

$0B: ifless byte, script

$0C: jumpstd std_script

$0D: callstd std_script

$0E: callasm asm

$0F: special special_pointer

$10: memcallasm asm

$11: checkmapscene map

$12: setmapscene map, scene_id

$13: checkscene

$14: setscene scene_id

$15: setval value

[wScriptVar] = value

$16: addval value

[wScriptVar] += value

$17: random value

$18: checkver

$19: readmem address

[wScriptVar] = [address]

$1A: writemem address

[address] = [wScriptVar]

$1B: loadmem address, value

[address] = value

$1C: readvar variable

[wScriptVar] = GetVarAction(variable)

$1D: writevar variable

GetVarAction(variable) = [wScriptVar]

$1E: loadvar variable, value

GetVarAction(variable) = value

$1F: giveitem item_id[, quantity=1]

$20: takeitem item_id[, quantity=1]

$21: checkitem item_id

$22: givemoney account, value

$23: takemoney account, value

$24: checkmoney account, value

$25: givecoins value

$26: takecoins value

$27: checkcoins value

$28: addcellnum contact_id

$29: delcellnum contact_id

$2A: checkcellnum contact_id

$2B: checktime time

$2C: checkpoke mon_id

$2D: givepoke mon_id, level[, item=0[, ot_name, nickname]]

$2E: giveegg mon_id, level

$2F: givepokemail pointer

$30: checkpokemail pointer

$31: checkevent event_flag

$32: clearevent event_flag

$33: setevent event_flag

$34: checkflag engine_flag

$35: clearflag engine_flag

$36: setflag engine_flag

$37: wildon

$38: wildoff

$39: xycompare pointer

$3A: warpmod warp_id, map

$3B: blackoutmod map

$3C: warp map, x, y

$3D: getmoney string_buffer, account

GetStringBuffer(string_buffer) = PrintNum(GetMoneyAccount(account))

$3E: getcoins string_buffer

GetStringBuffer(string_buffer) = PrintNum([wCoins])

$3F: getnum string_buffer

GetStringBuffer(string_buffer) = PrintNum([wScriptVar])

$40: getmonname string_buffer, mon_id

GetStringBuffer(string_buffer) = GetPokemonName(mon_id)

If mon_id = USE_SCRIPT_VAR, then it uses [wScriptVar] instead.

$41: getitemname string_buffer, item_id

GetStringBuffer(string_buffer) = GetItemName(item_id)

If item_id = USE_SCRIPT_VAR, then it uses [wScriptVar] instead.

$42: getcurlandmarkname string_buffer

GetStringBuffer(string_buffer) = GetLandmarkName(GetWorldMapLocation())

$43: gettrainername string_buffer, trainer_group, trainer_id

GetStringBuffer(string_buffer) = GetTrainerName(trainer_group, trainer_id)

$44: getstring string_buffer, text_pointer

GetStringBuffer(string_buffer) = CopyName1([wScriptBank], text_pointer)

$45: itemnotify

$46: pocketisfull

$47: opentext

$48: reanchormap [dummy=0]

$49: closetext

$4A: writeunusedbyte byte

[wUnusedScriptByte] = byte

$4B: farwritetext text_pointer

$4C: writetext text_pointer

$4D: repeattext byte1, byte2

$4E: yesorno

$4F: loadmenu menu_header

$50: closewindow

$51: jumptextfaceplayer text_pointer

$52: farjumptext text_pointer

$53: jumptext text_pointer

$54: waitbutton

$55: promptbutton

$56: pokepic mon_id

$57: closepokepic

$58: _2dmenu

$59: verticalmenu

$5A: loadpikachudata

$5B: randomwildmon

$5C: loadtemptrainer

[wOtherTrainer] = [wTempTrainer]

$5D: loadwildmon mon_id, level

$5E: loadtrainer trainer_group, trainer_id

$5F: startbattle

$60: reloadmapafterbattle

$61: catchtutorial byte

$62: trainertext text_id

$63: trainerflagaction action

$64: winlosstext win_text_pointer, loss_text_pointer

$65: scripttalkafter

$66: endifjustbattled

$67: checkjustbattled

$68: setlasttalked object_id

$69: applymovement object_id, data_pointer

$6A: applymovementlasttalked data_pointer

$6B: faceplayer

$6C: faceobject object1, object2

$6D: variablesprite variable_sprite_id, sprite_id

$6E: disappear object_id

$6F: appear object_id

$70: follow object2, object1

$71: stopfollow

$72: moveobject object_id, x, y

$73: writeobjectxy object_id

$74: loademote emote_id

$75: showemote emote_id, object_id, length

$76: turnobject object_id, facing

$77: follownotexact object2, object1

$78: earthquake param

$79: changemapblocks blockdata_pointer

ChangeMap(blockdata_pointer)

$7A: changeblock x, y, block

$7B: reloadmap

$7C: refreshmap

$7D: writecmdqueue queue_pointer

$7E: delcmdqueue byte

$7F: playmusic music_id

$80: encountermusic

$81: musicfadeout music_id, length

$82: playmapmusic

$83: dontrestartmapmusic

$84: cry mon_id

$85: playsound sfx_id

$86: waitsfx

$87: warpsound

$88: specialsound

$89: autoinput input_pointer

$8A: newloadmap which_method

$8B: pause length

$8C: deactivatefacing length

$8D: sdefer script

$8E: warpcheck

$8F: stopandsjump script

$90: endcallback

$91: end

$92: reloadend which_method

$93: endall

$94: pokemart mart_type, mart_id

$95: elevator floor_list

$96: trade trade_id

$97: askforphonenumber contact_id

$98: phonecall call_id

$99: hangup

$9A: describedecoration byte

$9B: fruittree tree_id

$9C: specialphonecall call_id

$9D: checkphonecall

$9E: verbosegiveitem item_id[, quantity=1]

$9F: verbosegiveitemvar item_id, variable

$A0: swarm swarm_id, map

$A1: halloffame

$A2: credits

$A3: warpfacing facing, map, x, y

$A4: battletowertext bttext_id

$A5: getlandmarkname string_buffer, landmark_id

GetStringBuffer(string_buffer) = GetLandmarkName(landmark_id)

$A6: gettrainerclassname string_buffer, trainer_group

GetStringBuffer(string_buffer) = GetName(TRAINER_NAME, trainer_group)

$A7: getname string_buffer, type, id

GetStringBuffer(string_buffer) = GetName(type, id)

$A8: wait duration

$A9: checksave