Difference between revisions of "Script Format"
Jump to navigation
Jump to search
m (more precise description of variable length for 09 and 47) |
(commands: B3, BC-C0 (more jumps)) |
||
Line 1,284: | Line 1,284: | ||
|- | |- | ||
|B3 | |B3 | ||
| | | SpriteMove | ||
| 5 | | 5 | ||
| | | | ||
Line 1,347: | Line 1,347: | ||
|- | |- | ||
|BC | |BC | ||
| | | MarkOrigin | ||
| 1 | | 1 | ||
| | | | ||
Line 1,354: | Line 1,354: | ||
|- | |- | ||
|BD | |BD | ||
| | | MarkOriginAsync | ||
| 1 | | 1 | ||
| | | | ||
Line 1,361: | Line 1,361: | ||
|- | |- | ||
|BE | |BE | ||
| | | JumpAndSetOriginWithDelay | ||
| 6 | | 6 | ||
| | | | ||
Line 1,368: | Line 1,368: | ||
|- | |- | ||
|BF | |BF | ||
| | | JumpAndSetOriginAsync | ||
| 4 | | 4 | ||
| | | | ||
Line 1,375: | Line 1,375: | ||
|- | |- | ||
|C0 | |C0 | ||
| | | SetOriginAndEraseDelay | ||
| 4 | | 4 | ||
| | | |
Revision as of 22:16, 12 February 2016
Scripts are parsed bytewise.
A note about event flags
Event flags are calculated from an u16 value like this:
u16 EventFlag; Flag = (EventFlag & 0xFFF) >> 3; Value = 1 << (EventFlag & 7); IsSet = EventFlag & 0x8000
Commands
Opcode | Function | Length | Arguments | Comments |
---|---|---|---|---|
00 | Call | 4 | This command has no stack for return addresses. Nested calls simply overwrite any previous return address, so return is only possible to the most recent call site.
If a simple jump is desired, use command 06 for an async jump, or ASM BRA or JMP for an instantaneous jump. | |
01 | ReturnFrom00 | 1 | If not inside 00-Call, this command is ignored. | |
02 | LoopSetup | 3 | ||
03 | LoopDoAsync | 1 | ||
04 | LoopDo | 1 | ||
05 | WaitOnEventFlag | 3 | ||
06 | JumpAndSetOrigin | 4 | ||
07 | EventFlagModify | 3 | ||
08 | EventFlagCheckJump | 5 | ||
09 | EventFlagCheckMultiple | 3+2*x | ||
0A | CheckMapId | 5 | ||
0B | CheckDeathwarpMapId | 5 | ||
0C | TriggerOnAreaAbsolute | 8 | ||
0D | TriggerOnAreaRelative | 8 | ||
0E | TriggerOnAreaAbsolutePixel | 12 | ||
0F | TriggerOnBlockAbsolute | 6 | ||
10 | TriggerOnBlockRelative | 6 | ||
11 | TriggerObjectOnAreaAbsolute | 9 | First parameter is object index, which is multiplied by 40 and added to 1000 to get the object handle, for which the trigger is checked.
Remaining parameters are same as command 0C. | |
12 | TriggerObjectOnAreaRelative | 9 | Broken command.
Supposed to be 0D-counterpart of 11: it should compare the position of the object that is given as first parameter to the position of the object that executes the command, but it uses for both purposes only the object that is given as parameter, which makes it useless. | |
13 | SpriteSetPosition | 4 | ||
14 | PlayerPort | 9 | ||
15 | ||||
16 | ||||
17 | ||||
18 | ||||
19 | RespawnSetLocation | 15 | ||
1A | DialogSwitchChoice | 4 | ||
1B | PrintRelative | 3 | ||
1C | PrintAbsolute | 4 | ||
1D | ||||
1E | ||||
1F | MessageWait | 1 | ||
20 | ||||
21 | Trigger | 3 | ||
22 | ||||
23 | 3 | |||
24 | 4 | |||
25 | Rand | 1 | ||
26 | RandomMoveInArea | 5 | ||
27 | ||||
28 | 2 | Set 0x7F2018 to value | ||
29 | 3 | |||
2A | PadDisableButtons | 3 | ||
2B | PadCheckAllButtonsPressed2 | 5 | ||
2C | PadCheckNoButtonPressed2 | 5 | ||
2D | ||||
2E | PadCheckAnyButtonPressed | 5 | ||
2F | PadCheckNoButtonPressed | 5 | ||
30 | MusicPlay | 2 | ||
31 | MusicPlayFadeOver | 2 | ||
32 | MusicPlay2 | 2 | This saves the last track played via this command.
When calling it with the value set to 0xFF it plays the last played track again. | |
33 | 1 | |||
34 | ||||
35 | ||||
36 | SoundEffectPlayOnce | 2 | ||
37 | SoundEffectPlay | 2 | ||
38 | SoundEffect? | 3 | ||
39 | SpriteGotoPosition | 4 | ||
3A | 4 | |||
3B | ObjectSetSolid | 1 | ||
3C | 1 | |||
3D | 4 | |||
3E | ||||
3F | ||||
40 | ||||
41 | ||||
42 | ||||
43 | ||||
44 | ||||
45 | ||||
46 | MapCopyRect | 8 | ||
47 | ObjectDeleteIfEventFlags | 1+2*x | ||
48 | ObjectDeleteIfEventFlag | 3 | ||
49 | ObjectDeleteIfMapId | 3 | ||
4A | ||||
4B | ||||
4C | ||||
4D | ||||
4E | ||||
4F | ||||
50 | ||||
51 | ||||
52 | ||||
53 | ||||
54 | ItemGive | 4 | ||
55 | ItemTake | 2 | ||
56 | ||||
57 | ||||
58 | ||||
59 | 2 | |||
5A | 6 | |||
5B | ||||
5C | ||||
5D | ||||
5E | ||||
5F | ||||
60 | ||||
61 | ||||
62 | ||||
63 | ||||
64 | ||||
65 | 6 | |||
66 | ||||
67 | ||||
68 | ||||
69 | ||||
6A | ||||
6B | ||||
6C | PrintAbsolute2 | 4 | ||
6D | ||||
6E | UpdateScene | 3 | ||
6F | ||||
70 | ||||
71 | ||||
72 | ||||
73 | 3 | |||
74 | ||||
75 | ||||
76 | WriteSystemRegister | 3 | ||
77 | ||||
78 | BackgroundUpdateFade | |||
79 | Unused command | |||
7A | Unused command | |||
7B | Unused command | |||
7C | Unknown Command, Only implemented in JP version, FFFF in German and English | |||
7D | Unused command | |||
7E | Unused command | |||
7F | Unused command | |||
80 | AnimationSetA | 2 | ||
81 | AnimationSetB | 2 | ||
82 | ||||
83 | ||||
84 | ||||
85 | AnimationSetC | 3 | ||
86 | AnimationSetD | 3 | ||
87 | ObjectMove | 4 | ||
88 | ||||
89 | ||||
8A | ||||
8B | ||||
8C | ||||
8D | ||||
8E | AnimationWait | 1 | ||
8F | 1 | |||
90 | ||||
91 | ||||
92 | ||||
93 | ||||
94 | ||||
95 | 1 | |||
96 | 1 | |||
97 | 9 | |||
98 | 11 | |||
99 | ObjectCloneInsertAtBeginSF | 6 | Insert at begin of list, set script pointer and flags | |
9A | ObjectCloneInsertBeforeSP | 4 | Insert before current object, set script pointer and parent (implied) | |
9B | ObjectCloneInsertBeforeSFP | 6 | Insert before current object, set script pointer, flags and parent (implied) | |
9C | ObjectCloneInsertBeforeSRP | 8 | Insert before current object, set script pointer, relative placement and parent (implied) | |
9D | ObjectCloneInsertBeforeSRFP | 10 | Insert before current object, set script pointer, relative placement, flags and parent (implied) | |
9E | ObjectCloneInsertBeforeSAP | 8 | Insert before current object, set script pointer, absolute placement and parent (implied) | |
9F | ObjectCloneInsertBeforeSAFP | 10 | Insert before current object, set script pointer, absolute placement, flags and parent (implied) | |
A0 | ObjectCloneInsertAtEndSFP | 6 | Insert at end of list, set script pointer, flags and parent (implied) | |
A1 | ObjectCloneInsertAfterSP | 4 | Insert after current object, set script pointer and parent (implied) | |
A2 | ObjectCloneInsertAfterSFP | 6 | Insert after current object, set script pointer, flags and parent (implied) | |
A3 | ObjectCloneInsertAfterSRP | 8 | Insert after current object, set script pointer, relative placement and parent (implied) | |
A4 | ObjectCloneInsertAfterSRFP | 10 | Insert after current object, set script pointer, relative placement, flags and parent (implied)
Same handler as 0xE8 | |
A5 | ObjectCloneInsertAfterSAP | 8 | Insert after current object, set script pointer, absolute placement and parent (implied) | |
A6 | ObjectCloneInsertAfterSAFP | 10 | Insert after current object, set script pointer, absolute placement, flags and parent (implied) | |
A7 | ObjectDelete | 1 | ||
A8 | ||||
A9 | ||||
AA | 4 | |||
AB | ||||
AC | ||||
AD | ||||
AE | ||||
AF | 2 | |||
B0 | 2 or 4 | |||
B1 | 3 | |||
B2 | 5 | |||
B3 | SpriteMove | 5 | ||
B4 | SpriteSetUpsideDown | 1 | ||
B5 | SpriteSetDownsideUp | 1 | ||
B6 | SpriteSetFacingRight | 1 | ||
B7 | SpriteSetFacingLeft | 1 | ||
B8 | SpriteFlipVertical | 1 | ||
B9 | SpriteFlipHorizontal | 1 | ||
BA | 2 | |||
BB | 2 | |||
BC | MarkOrigin | 1 | ||
BD | MarkOriginAsync | 1 | ||
BE | JumpAndSetOriginWithDelay | 6 | ||
BF | JumpAndSetOriginAsync | 4 | ||
C0 | SetOriginAndEraseDelay | 4 | ||
C1 | Delay | 3 | ||
C2 | ||||
C3 | ||||
C4 | ||||
C5 | ||||
C6 | ||||
C7 | ||||
C8 | ||||
C9 | ||||
CA | ||||
CB | 5 | |||
CC | 6 | |||
CD | ||||
CE | ||||
CF | ||||
D0 | ||||
D1 | ||||
D2 | ||||
D3 | ||||
D4 | 9 | |||
D5 | ||||
D6 | 4 | |||
D7 | 5 | |||
D8 | 4 | |||
D9 | ProjectileSetDamage | 2 | ||
DA | ||||
DB | ||||
DC | 5 | |||
DD | 8 | |||
DE | 2 | |||
DF | 4 | |||
E0 | ||||
E1 | ||||
E2 | ||||
E3 | ||||
E4 | ||||
E5 | ||||
E6 | ||||
E7 | 6 | |||
E8 | 10 | |||
E9 | ||||
EA | ||||
EB | 1 | |||
EC | ||||
ED | 6 | |||
EE | 2 | |||
EF |