-
Notifications
You must be signed in to change notification settings - Fork 0
/
xse_commands.s
1962 lines (1649 loc) · 43.9 KB
/
xse_commands.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@All scripting macros off of XSE and http://sphericalice.com/romhacking/documents/script/index.html
@Message box types
.equ MSG_OBTAIN, 0x0
.equ MSG_FIND, 0x1
.equ MSG_FACE, 0x2
.equ MSG_SIGN, 0x3
.equ MSG_KEEPOPEN, 0x4
.equ MSG_YESNO, 0x5
.equ MSG_NORMAL, 0x6
.equ MSG_POKENAV, 0xA
@Compare values
.equ lessthan, 0x0 @A is less than B
.equ equal, 0x1 @A is equal to B
.equ greaterthan, 0x2 @A is more than B
.equ lessorequal, 0x3 @A is less than or equal to B
.equ greaterorequal, 0x4 @A is greater than or equal to B
.equ notequal, 0x5 @A is not equal to B
.equ false, 0x0
.equ true, 0x1
@azuril13's if command becuase it's nice
.equ _goto, 0x06
.equ _jump, 0x06
.equ _call, 0x07
.macro if condition:req goto_or_call:req script:req
.byte \goto_or_call, \condition
.word \script
.endm
@Commands
@ Does nothing.
.macro nop
.byte 0x00
.endm
@ Does nothing.
.macro nop1
.byte 0x01
.endm
@ Terminates script execution.
.macro end
.byte 0x02
.endm
@ Jumps back to after the last-executed call statement, and continues script execution from there.
.macro return
.byte 0x03
.endm
@ Jumps to destination and continues script execution from there. The location of the calling script is remembered and can be returned to later.
.macro call destination:req
.byte 0x04
.4byte \destination
.endm
@ Jumps to destination and continues script execution from there.
.macro goto destination:req
.byte 0x05
.4byte \destination
.endm
.macro jump destination:req
.byte 0x05
.4byte \destination
.endm
@ If the result of the last comparison matches condition (see Comparison operators), jumps to destination and continues script execution from there.
.macro goto_if condition:req, destination:req
.byte 0x06
.byte \condition
.4byte \destination
.endm
@ If the result of the last comparison matches condition (see Comparison operators), calls destination.
.macro call_if condition:req, destination:req
.byte 0x07
.byte \condition
.4byte \destination
.endm
@ Jumps to the standard function at index function.
.macro gotostd function:req
.byte 0x08
.byte \function
.endm
@ Calls the standard function at index function.
.macro callstd function:req
.byte 0x09
.byte \function
.endm
@ If the result of the last comparison matches condition (see Comparison operators), jumps to the standard function at index function.
.macro gotostd_if condition:req, function:req
.byte 0x0a
.byte \condition
.byte \function
.endm
@ If the result of the last comparison matches condition (see Comparison operators), calls the standard function at index function.
.macro callstd_if condition:req, function:req
.byte 0x0b
.byte \condition
.byte \function
.endm
@ Executes a script stored in a default RAM location.
.macro gotoram
.byte 0x0c
.endm
@ Terminates script execution and "resets the script RAM".
.macro killscript
.byte 0x0d
.endm
@ Sets mystery event status
.macro setmysteryeventstatus value:req
.byte 0x0e
.byte \value
.endm
@ Sets the specified script bank to immediate value.
.macro loadpointer destination:req, value:req
.byte 0x0f
.byte \destination
.4byte \value
.endm
.macro loadword destination:req, value:req
loadpointer \destination, \value
.endm
@ Sets the specified script bank to immediate value.
.macro loadbyte destination:req, value:req
.byte 0x10
.byte \destination
.byte \value
.endm
@ Sets the byte at offset to value.
.macro writebytetoaddr value:req, offset:req
.byte 0x11
.byte \value
.4byte \offset
.endm
.macro writebytetooffset value:req, offset:req
writebytetoaddr \value, \offset
.endm
@ Copies the byte value at source into the specified script bank.
.macro loadbytefromaddr destination:req, source:req
.byte 0x12
.byte \destination
.4byte \source
.endm
@ Not sure. Judging from XSE's description I think it takes the least-significant byte in bank source and writes it to destination.
.macro setptrbyte source:req, destination:req
.byte 0x13
.byte \source
.4byte \destination
.endm
@ Copies the contents of bank source into bank destination.
.macro copylocal destination:req, source:req
.byte 0x14
.byte \destination
.byte \source
.endm
@ Copies the byte at source to destination, replacing whatever byte was previously there.
.macro copybyte destination:req, source:req
.byte 0x15
.4byte \destination
.4byte \source
.endm
@ Changes the value of destination to value.
.macro setvar destination:req, value:req
.byte 0x16
.2byte \destination
.2byte \value
.endm
@ Changes the value of destination by adding value to it. Overflow is not prevented (0xFFFF + 1 = 0x0000).
.macro addvar destination:req, value:req
.byte 0x17
.2byte \destination
.2byte \value
.endm
@ Changes the value of destination by subtracting value to it. Overflow is not prevented (0x0000 - 1 = 0xFFFF).
.macro subvar destination:req, value:req
.byte 0x18
.2byte \destination
.2byte \value
.endm
@ Copies the value of source into destination.
.macro copyvar destination:req, source:req
.byte 0x19
.2byte \destination
.2byte \source
.endm
@ If source is not a variable, then this function acts like setvar. Otherwise, it acts like copyvar.
.macro setorcopyvar destination:req, source:req
.byte 0x1a
.2byte \destination
.2byte \source
.endm
.macro copyvarifnotzero destination:req, source:req
setorcopyvar \destination, \source
.endm
@ Compares the values of script banks a and b, after forcing the values to bytes.
.macro comparelocaltolocal byte1:req, byte2:req
.byte 0x1b
.byte \byte1
.byte \byte2
.endm
@ Compares the least-significant byte of the value of script bank a to a fixed byte value (b).
.macro comparelocaltovalue a:req, b:req
.byte 0x1c
.byte \a
.byte \b
.endm
@ Compares the least-significant byte of the value of script bank a to the byte located at offset b.
.macro comparelocaltoaddr a:req, b:req
.byte 0x1d
.byte \a
.4byte \b
.endm
@ Compares the byte located at offset a to the least-significant byte of the value of script bank b.
.macro compareaddrtolocal a:req, b:req
.byte 0x1e
.4byte \a
.byte \b
.endm
@ Compares the byte located at offset a to a fixed byte value (b).
.macro compareaddrtovalue a:req, b:req
.byte 0x1f
.4byte \a
.byte \b
.endm
.macro comparefarbytetobyte a:req, b:req
compareaddrtovalue \a, \b
.endm
@ Compares the byte located at offset a to the byte located at offset b.
.macro compareaddrtoaddr a:req, b:req
.byte 0x20
.4byte \a
.4byte \b
.endm
.macro comparefarbytes a:req, b:req
compareaddrtoaddr \a, \b
.endm
@ Compares the value of `var` to a fixed word value (b).
.macro comparevartovalue var:req, value:req
.byte 0x21
.2byte \var
.2byte \value
.endm
.macro compare var:req, value:req
comparevartovalue \var, \value
.endm
@ Compares the value of `var` to the value of `var2`.
.macro comparevartovar var1:req, var2:req
.byte 0x22
.2byte \var1
.2byte \var2
.endm
.macro comparevars var1:req, var2:req
comparevartovar \var1, \var2
.endm
@ Calls the native C function stored at `func`.
.macro callasm func:req
.byte 0x23
.4byte \func
.endm
.macro callnative func:req
callasm \func
.endm
@ Replaces the script with the function stored at `func`. Execution returns to the bytecode script when func returns TRUE.
.macro gotonative func:req
.byte 0x24
.4byte \func
.endm
@ Calls a special function; that is, a piece of ASM code designed for use by scripts and listed in a table of pointers.
.macro special num:req
.byte 0x25
.2byte \num
.endm
@ Calls a special function. That function's output (if any) will be written to the variable you specify.
.macro special2 output:req, num:req
.byte 0x26
.2byte \output
.2byte \num
.endm
.macro specialvar output:req, num:req
special2 \output, \num
.endm
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
.macro waitstate
.byte 0x27
.endm
@ Blocks script execution for time frames.
.macro pause time:req
.byte 0x28
.2byte \time
.endm
@ Sets a to 1.
.macro setflag a:req
.byte 0x29
.2byte \a
.endm
@ Sets a to 0.
.macro clearflag a:req
.byte 0x2a
.2byte \a
.endm
@ Compares a to 1.
.macro checkflag a:req
.byte 0x2b
.2byte \a
.endm
@ In FireRed, this command is a nop.
.macro initclock hour:req minute:req
.byte 0x2c
.endm
@ In FireRed, this command is a nop.
.macro dodailyevents
.byte 0x2d
.endm
@ Resets the values of variables VAR_0x8000, VAR_0x8001, and VAR_0x8002.
.macro gettime
.byte 0x2e
.endm
@ Plays the specified (sound_number) sound. Only one sound may play at a time, with newer ones interrupting older ones.
.macro sound sound_number:req
.byte 0x2f
.2byte \sound_number
.endm
.macro playse sound_number:req
sound \sound_number
.endm
@ Blocks script execution until the currently-playing sound (triggered by sound) finishes playing.
.macro waitse
.byte 0x30
.endm
.macro checksound
.byte 0x30
.endm
@ Plays the specified (fanfare_number) fanfare.
.macro fanfare fanfare_number:req
.byte 0x31
.2byte \fanfare_number
.endm
.macro playfanfare fanfare_number:req
fanfare \fanfare_number
.endm
@ Blocks script execution until all currently-playing fanfares finish.
.macro waitfanfare
.byte 0x32
.endm
@ Plays the specified (song_number) song. The byte is apparently supposed to be 0x00.
.macro playsong song_number:req, permanent=0
.byte 0x33
.2byte \song_number
.byte \permanent
.endm
.macro playbgm songid:req permanent=0
playsong \songid \permanent
.endm
@ Plays the specified (song_number) song.
.macro savebgm song_number:req
.byte 0x34
.2byte \song_number
.endm
.macro playsong2 song_number:req
savebgm \song_number
.endm
@ Crossfades the currently-playing song into the map's default song.
.macro fadedefaultbgm
.byte 0x35
.endm
.macro fadedefault
.byte 0x35
.endm
@ Crossfades the currently-playng song into the specified (song_number) song.
.macro fadesong song_number:req
.byte 0x36
.2byte \song_number
.endm
.macro fadenewbgm song_number:req
fadesong \song_number
.endm
@ Fades out the currently-playing song.
.macro fadeoutbgm speed:req
.byte 0x37
.byte \speed
.endm
@ Fades the currently-playing song back in.
.macro fadeinbgm speed:req
.byte 0x38
.byte \speed
.endm
@ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (x, y) on the map.
.macro warp bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x39
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Clone of warp that does not play a sound effect.
.macro warpmuted bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x3A
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Clone of warp that uses "a walking effect".
.macro warpwalk bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x3B
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Warps the player to another map using a hole animation.
.macro warphole bank:req map:req
.byte 0x3C
.byte \bank
.byte \map
.endm
@ Clone of warp that uses a teleport effect.
.macro warpteleport bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x3D
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Clone of warp. Used by a Safari Zone script to return the player to the gatehouse and end the Safari Game. Also used for warpholes.
.macro setwarp bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x3E
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Sets a default warp place. If a warp tries to send the player to Warp 127 on Map 127.127, they will instead be sent here. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
.macro setdynamicwarp bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x3F
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Clone of warp3, except that this writes data to different offsets...
.macro setdivewarp bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x40
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Clone of warp3, except that this writes data to different offsets...
.macro setholewarp bank:req map:req warp:req x_axis=0 y_axis=0
.byte 0x41
.byte \bank
.byte \map
.byte \warp
.hword \x_axis
.hword \y_axis
.endm
@ Retrieves the player's zero-indexed X- and Y-coordinates in the map, and stores them in the specified variables.
.macro getplayerpos x:req, y:req
.byte 0x42
.2byte \x
.2byte \y
.endm
.macro getplayerxy x:req, y:req
getplayerpos x, y
.endm
@ Retrieves the number of Pokemon in the player's party, and stores that number in VAR_RESULT.
.macro countpokemon
.byte 0x43
.endm
.macro getpartysize
countpokemon
.endm
@ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
.macro additem index:req, quantity=1
.byte 0x44
.2byte \index
.2byte \quantity
.endm
@ Removes quantity of item index from the player's Bag.
.macro removeitem index:req, quantity=1
.byte 0x45
.2byte \index
.2byte \quantity
.endm
@ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room.
.macro checkitemspace index:req, quantity:req
.byte 0x46
.2byte \index
.2byte \quantity
.endm
@ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item.
.macro checkitem index:req, quantity:req
.byte 0x47
.2byte \index
.2byte \quantity
.endm
@ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
.macro checkitemtype index:req
.byte 0x48
.2byte \index
.endm
@ Adds a quantity amount of item index to the player's PC. Both arguments can be variables.
.macro addpcitem index:req, quantity:req
.byte 0x49
.2byte \index
.2byte \quantity
.endm
@ Checks for quantity amount of item index in the player's PC. Both arguments can be variables.
.macro checkpcitem index:req, quantity:req
.byte 0x4a
.2byte \index
.2byte \quantity
.endm
@ In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro adddecor decoration:req
.byte 0x4b
.2byte \decoration
.endm
@ In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro removedecor decoration:req
.byte 0x4c
.2byte \decoration
.endm
@ In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro hasdecor decoration:req
.byte 0x4d
.2byte \decoration
.endm
@ In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro checkdecor decoration:req
.byte 0x4e
.2byte \decoration
.endm
@ Applies the movement data at movements to the specified (index) Object. Also closes any standard message boxes that are still open.
@ If no map is specified, then the current map is used.
.macro applymovement index:req, movements:req, mapGroup, mapNum
.ifb \mapGroup
.byte 0x4f
.2byte \index
.4byte \movements
.else
.byte 0x50
.2byte \index
.4byte \movements
.byte \mapGroup
.byte \mapNum
.endif
.endm
@ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing.
@ If no map is specified, then the current map is used.
.macro waitmovement index:req, mapGroup, mapNum
.ifb \mapGroup
.byte 0x51
.2byte \index
.else
.byte 0x52
.2byte \index
.byte \mapGroup
.byte \mapNum
.endif
.endm
@ Attempts to hide the specified (localId) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro removeobject localId:req, mapGroup, mapNum
.ifb \mapGroup
.byte 0x53
.2byte \localId
.else
.byte 0x54
.2byte \localId
.byte \mapGroup
.byte \mapNum
.endif
.endm
.macro hidesprite localId:req
removeobject \localId
.endm
.macro hidespriteonmap localId:req, mapGroup:req, mapNum:req
removeobject \localId, \mapGroup, \mapNum
.endm
@ Attempts to show the specified (localId) Object on the specified (map_group, map_num) map
.macro addobject localId:req, mapGroup, mapNum
.ifb \mapGroup
.byte 0x55
.2byte \localId
.else
.byte 0x56
.2byte \localId
.byte \mapGroup
.byte \mapNum
.endif
.endm
.macro showsprite localId:req
addobject \localId
.endm
.macro showspriteonmap localId:req, mapGroup:req, mapNum:req
addobject \localId, \mapGroup, \mapNum
.endm
@ Sets the specified (index) Object's position on the current map.
.macro movesprite index:req, x:req, y:req
.byte 0x57
.2byte \index
.2byte \x
.2byte \y
.endm
.macro setobjectxy index:req, x:req, y:req
movesprite \index, \x, \y
.endm
@ unknown
.macro showobject index:req, map:req
.byte 0x58
.2byte \index
map \map
.endm
@ unknown
.macro hideobject index:req, map:req
.byte 0x59
.2byte \index
map \map
.endm
@ If the script was called by an Object, then that Object will turn to face toward the metatile that the player is standing on.
.macro faceplayer
.byte 0x5a
.endm
@ Faces the object in a given direction
.macro spriteface localId:req, direction:req
.byte 0x5b
.2byte \localId
.byte \direction
.endm
.macro turnobject localId:req, direction:req
spriteface \localId, \direction
.endm
@ If the Trainer flag for Trainer index is not set, this command does absolutely nothing.
.macro trainerbattle0 type:req index:req filler:req intro:req loss:req
.byte 0x5C
.byte 0x0
.hword \index
.hword \filler
.word \intro
.word \loss
.endm
.macro trainerbattle1 type:req index:req filler:req intro:req loss:req extra:req
.byte 0x5C
.byte 0x1
.hword \index
.hword \filler
.word \intro
.word \loss
.word \extra
.endm
.macro trainerbattle2 type:req index:req filler:req intro:req loss:req extra:req
.byte 0x5C
.byte 0x2
.hword \index
.hword \filler
.word \intro
.word \loss
.word \extra
.endm
.macro trainerbattle3 type:req index:req filler:req intro:req
.byte 0x5C
.byte 0x3
.hword \index
.hword \filler
.word \intro
.endm
.macro trainerbattle4 type:req index:req filler:req intro:req loss:req cantbattle:req
.byte 0x5C
.byte 0x4
.hword \index
.hword \filler
.word \intro
.word \loss
.word \cantbattle
.endm
.macro trainerbattle5 type:req index:req filler:req intro:req loss:req
.byte 0x5C
.byte 0x5
.hword \index
.hword \filler
.word \intro
.word \loss
.endm
.macro trainerbattle6 type:req index:req filler:req intro:req loss:req extra:req extra2:req
.byte 0x5C
.byte 0x6
.hword \index
.hword \filler
.word \intro
.word \loss
.word \extra
.word \extra2
.endm
.macro trainerbattle7 type:req index:req filler:req intro:req loss:req extra:req
.byte 0x5C
.byte 0x7
.hword \index
.hword \filler
.word \intro
.word \loss
.word \extra
.endm
.macro trainerbattle8 type:req index:req filler:req intro:req loss:req extra:req extra2:req
.byte 0x5C
.byte 0x8
.hword \index
.hword \filler
.word \intro
.word \loss
.word \extra
.word \extra2
.endm
.macro trainerbattle9 type:req index:req filler:req win:req loss:req
.byte 0x5C
.byte 0x9
.hword \index
.hword \filler
.word \win
.word \loss
.endm
@trainerbattle 0xA FOE_1_ID FOE_2_ID PARTNER_ID PARTNER_BACKSPRITE_ID 0x0 DEFEAT_TEXT_A DEFEAT_TEXT_B
.macro trainerbattle10 type:req foeindex1:req foeindex2:req partnerindex:req partnerbackspriteindex:req filler:req loss1:req loss2:req
.byte 0x5C
.byte 10
.hword \foeindex1
.hword \foeindex2
.hword \partnerindex
.hword \partnerbackspriteindex
.hword \filler
.word \loss1
.word \loss2
.endm
@trainerbattle 0xB FOE_1_ID FOE_2_ID FOE_1_NPC_ID FOE_2_NPC_ID 0x0 INTRO_TEXT_A INTRO_TEXT_B DEFEAT_TEXT_A DEFEAT_TEXT_B CANNOT_BATTLE_TEXT_A CANNOT_BATTLE_TEXT_B
.macro trainerbattle11 type:req foeindex1:req foeindex2:req foenpcid1:req foenpcid2:req filler:req intro1:req intro2:req loss1:req loss2:req cannotbattle1:req cannotbattle2:req
.byte 0x5C
.byte 11
.hword \foeindex1
.hword \foeindex2
.byte \foenpcid1
.byte \foenpcid2
.hword \filler
.word \intro1
.word \intro2
.word \loss1
.word \loss2
.word \cannotbattle1
.word \cannotbattle2
.endm
@trainerbattle 0xC FOE_ID PARTNER_ID PARTNER_BACKSPRITE_ID 0x0 DEFEAT_TEXT_A
.macro trainerbattle12 type:req foeindex:req partnerindex:req partnerbackspriteindex:req filler:req loss:req
.byte 0x5C
.byte 12
.hword \foeindex
.hword \partnerindex
.hword \partnerbackspriteindex
.hword \filler
.word \loss
.endm
@same as trainerbattle0
.macro trainerbattle13 type:req index:req filler:req intro:req loss:req
.byte 0x5C
.byte 13
.hword \index
.hword \filler
.word \intro
.word \loss
.endm
@same as trainerbattle4
.macro trainerbattle14 type:req index:req filler:req intro:req loss:req cantbattle:req
.byte 0x5C
.byte 14
.hword \index
.hword \filler
.word \intro
.word \loss
.word \cantbattle
.endm
@same as trainerbattle3
.macro trainerbattle15 type:req index:req filler:req intro:req
.byte 0x5C
.byte 15
.hword \index
.hword \filler
.word \intro
.endm
@same as trainerbattle11
.macro trainerbattle16 type:req foeindex1:req foeindex2:req foenpcid1:req foenpcid2:req filler:req intro1:req intro2:req loss1:req loss2:req cannotbattle1:req cannotbattle2:req
.byte 0x5C
.byte 16
.hword \foeindex1
.hword \foeindex2
.byte \foenpcid1
.byte \foenpcid2
.hword \filler
.word \intro1
.word \intro2
.word \loss1
.word \loss2
.word \cannotbattle1
.word \cannotbattle2
.endm
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
.macro battlebegin
.byte 0x5d
.endm
.macro ontrainerbattleend
.byte 0x5e
.endm
.macro ontrainerbattleendgoto
.byte 0x5f
.endm
@ Compares Flag (trainer + 0x500) to 1. (If the flag is set, then the trainer has been defeated by the player.)
.macro checktrainerflag trainer:req
.byte 0x60
.2byte \trainer
.endm
@ Sets Flag (trainer + 0x500).
.macro settrainerflag trainer:req
.byte 0x61
.2byte \trainer
.endm
@ Clears Flag (trainer + 0x500).
.macro cleartrainerflag trainer:req
.byte 0x62
.2byte \trainer
.endm
@ Sets the specified (Object's saved position on the current map.
.macro movesprite2 localId:req, x:req, y:req
.byte 0x63
.2byte \localId
.2byte \x
.2byte \y
.endm
.macro setobjectxyperm localId:req, x:req, y:req
setobjectxyperm \localId, \x, \y
.endm
@ Sets the specified Object's position to somewhere off the screen
.macro moveoffscreen localId:req
.byte 0x64
.2byte \localId
.endm
.macro moveobjectoffscreen localId:req
moveoffscreen \localId
.endm
@ Sets the specified Object's movement behaviour
.macro spritebehave localId:req, byte:req
.byte 0x65
.2byte \localId
.byte \byte
.endm
.macro setobjectmovementtype localId:req, byte:req
spritebehave \localId, \byte
.endm