Difference between revisions of "Script Format"

From Terranigma Wiki
Jump to navigation Jump to search
m (cleaned up naming format)
m (command 31, 32, 04, 38)
Line 50: Line 50:
|-
|-
|04
|04
|
| LoopDoAsync
| 1
| 1
|
|
Line 358: Line 358:
|-
|-
|30
|30
| PlayMusic
| MusicPlay
| 2
| 2
|
|
Line 365: Line 365:
|-
|-
|31
|31
|
| MusicPlayFadeOver
| 2
| 2
|
|
Line 372: Line 372:
|-
|-
|32
|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.


|-
|-
Line 400: Line 401:
|-
|-
|36
|36
| PlaySoundEffectOnce
| SoundEffectPlayOnce
| 2
| 2
|
|
Line 407: Line 408:
|-
|-
|37
|37
| PlaySoundEffect
| SoundEffectPlay
| 2
| 2
|
|
Line 414: Line 415:
|-
|-
|38
|38
|
| SoundEffect?
|
| 3
|
|
|
|

Revision as of 16: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 JumpSetOffset 4
01 JumpOffset 1
02 LoopSetup 3
03 LoopDo 1
04 LoopDoAsync 1
05 EventFlag? 3
06 4
07 EventFlagModify 3
08 EventFlagCheckJump 5
09 EventFlagCheckJump2 7
0A EventFlagCheckJump3 5
0B
0C TriggerOnAreaAbsolute 8
0D TriggerOnAreaRelative 8
0E
0F
10
11
12 TriggerObjectOnAreaRelative 8
13 SpriteSetPosition 4
14 PlayerPort 9
15
16
17
18
19 RespawnSetLocation 15
1A DialogChoice x
1B PrintRelative 3
1C PrintAbsolute 4
1D
1E
1F MessageWait 1
20
21 Trigger 3
22
23 3
24 4
25 Rand 1
26
27
28 2 Set 0x7F2018 to value
29 3
2A PadDisableButtons 3
2B
2C
2D
2E CallCodeOnMovementMaskSet 5
2F CallCodeOnMovementMaskUnSet 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
47 EventFlagCheck 5
48 EventFlagCheckSkipNext 3
49 3
4A
4B
4C
4D
4E
4F
50
51
52
53
54 ItemGive 4
55
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
77
78 BackgroundUpdateFade
79 STA S,2

RTI

7A Calls asm BRK instruction
7B Calls asm BRK instruction
7C
7D
7E Calls asm BRK instruction
7F Calls asm BRK instruction
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 6
9A
9B
9C
9D
9E
9F
A0
A1 4
A2 6
A3
A4 10 Same handler as 0xE8
A5
A6
A7
A8
A9
AA 4
AB
AC
AD
AE
AF 2
B0 2 or 4
B1 3
B2 5
B3 5
B4 SpriteSetUpsideDown 1
B5 SpriteSetDownsideUp 1
B6 SpriteSetFacingRight 1
B7 SpriteSetFacingLeft 1
B8 SpriteFlipVertical 1
B9 SpriteFlipHorizontal 1
BA 2
BB 2
BC 1
BD 1
BE 6
BF 4
C0 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