Opcodes

From Spiral Framework
Jump to navigation Jump to search

Opcodes are the commands used in LIN scripts to make things happen in the game. In the native LIN format of the game, opcodes are hexadecimal bytes. SPIRAL converts these to a more human readable format.

Change UI

See: UI Elements

Restart Script

LIN Hex Opcode: 0x1C

This opcode will restart the current script file from the beginning.

Notes

  • SPIRAL currently does not support this opcode and it must be used via its hexadecimal.

Screen Flash

LIN Hex Opcode: 0x1F

This opcode is used to make the screen flash with a certain colour. It takes seven arguments.

Argument Purpose
1 Red Component (0-255)
2 Green Component (0-255)
3 Blue Component (0-255)
4 Fade in duration
5 Hold duration
6 Fade out duration
7 Opacity

Examples

0x1F|255, 0, 0, 4, 60, 10, 255

This code would make the screen completely fade to red over a period of 4 frames, stay that way for 60 frames, and then fade back to normal over a period of 10 frames.

0x1F|255, 255, 255, 4, 0, 30, 255

This code would cause the screen to very quickly flash white.

SFX A|0, 26, 100
0x1F|255, 255, 255, 4, 0, 30, 255

This code would cause a "realisation" screen flash with a sound effect.

Notes

  • SPIRAL currently does not support this opcode and it must be used via its hexadecimal.

Set Flag

Used to enable or disable flags.

See: Flag IDs

Set Game State

Used to change the value of game state variables.

See: Set Game State

Set Title

LIN Hex Opcode: 0x0F

This opcode is used in scripts to change the Special Ability entry in the report card of a given character.

Argument Purpose
1 Character ID
2 Seemingly unused
3 Special Ability Variation

The used arguments are then placed into the equation arg1 + (arg3 * 15), and the code finds the file in 10_Special.pak with the corresponding number.

Examples

Set Title|10, 0, 1

When this line is read, Toko's special ability would be changed to "Ultimate Writing Prodigy and Murderous Fiend," from file 25 in 10_Special.pak.

Notes

  • This opcode should be called for every character at trial preparation screens in order to ensure that all the characters have the correct ability set at the start of trials.
  • Near the end of Trial 6 in Danganronpa 1, Makoto (Character 0) is supposed to have their special set to "Ultimate Hope". The game reads from file 15, which mistakenly contains "Ultimate Despair" instead. So, be warned that in DR1 character 15 DOES NOT use the 10_Special PAK as they do not have a report card page and thus their Special should not be included.

SFX A

Hmmm...
To do:
Make a list of useful common SFX for DR1 and DR2

LIN Hex Opcode: 0x0A

This opcode is used in scripts to play sound effects. Sound effect IDs correspond to the sound effect filenames found in /data/all/se/. It takes three arguments.

Argument Purpose
1 Short
2 Sound ID
3 Volume Percentage

As this opcode uses a short, the final ID is calculated by finding (argument1 * 256) + argument2

Examples

SFX A|0, 109, 100

This code would play sound effect number 109 at max volume.

SFX A|1, 109, 50

This code would play sound effect number 365 ((1 * 256) + 109) at half volume.

Notes

  • Any sound effect with a corresponding loop file will loop.