Learn: Eventing

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search


//single line comment
/* multiple
   comment */



Constants can be used to specify certain values in code without having to remember the number associated to it. They can be used with the OR bitwise "|" character to achieve other end values.

There are 3 levels of constants that JuraviS uses when compiling events. It will try to match a string that is used as an event instruction parameter with the following lists:

  • The constants defined inside the event file;
  • The constants defined in the current project directory's constants.json;
  • The constants defined in the default project directory' constants.json.

There are also @constants, which are specifically used for the Message IDs used inside {10} DisplayMessage/{51} ChangeDialog instructions.

Constants in the Event file

#Const Start

Enemy_Knight_A: 0x80,
Enemy_Wizard: 0x81,
Excalibur: 0x23

#Const End
  • The constant block must start with "#Const Start" and end with "#Const End" (both on their own line).
  • Any constant must use ":" as the association character and commas to separate each entry
  • Values must be either in hexadecimal (i.e. preceded by "0x") or in decimal format

Constants in constants.json

    UnitID: {
        UID_Temp_A: 0x80,
        UID_Temp_B: 0x81,
        UID_Temp_C: 0x82,
        UID_Temp_D: 0x83,
        UID_Temp_E: 0x84

Each constant is stored inside of another named object. This object represents a class of data used exclusively by the decompiler to determine which flags to convert a number to. Constants themselves can be accessed globally without restrictions. The format used here is JSON5.

Message ID @Constants


You may spend your completion points{br}
in various ways to enhance your{br}
characters or even recruit new ones!{br}
Whenever you are ready, you may start{br}
the game over with {font:08}NG+{font:00} or return to{br}
the world map with {font:08}Continue+{font:00}.{end}

{FB}Spend my points{br}
New Game+{br}
(Ignore) Regular Ending{FC}{close}

At the bottom of the event file where the text of the event is located, you can place a @Constant to automatically generate a callable Message ID for you to use inside of your event instructions, particularly {10} DisplayMessage and {51} ChangeDialog. This allows you to reorder your messages without worry.

  • The Message ID constant must start with, and be defined with an "@";
  • When defined, the constant name must be on its own line, optionally followed by a colon.

Event Instructions

This section must end with an {DB} EventEnd instruction. It marks the end of this section as well as the beginning of the text section.

  • Event Instructions must start with the correct text identifier or with their hexadecimal identifier in brackets (ex: "{10}");
  • Event Instructions must always be followed by a pair of parentheses holding the parameters of the instruction. Even if the instruction has no parameters, the parentheses must be there;
  • Event Instructions must be separated by line breaks or semicolons.
  • Parameters must be separated by commas;
  • +/- signs can be used with decimal numbers. Numbers without a sign are still assumed to be decimal.
  • x/0x/$ can be used to indicate hexadecimal numbers;
  • Arrays of bytes for unknown instruction syntax must start with "r" (ex: "r01AA");


Parameters can be either a Constant, a Message ID @Constant, a hexadecimal number, a decimal number, or a combination of any of those separated by a bitwise OR "|" operand.

A bitwise OR allows to set bit flags in more complex event scripts. If this confuses you, that's alright; you won't be needing it with regular event editing.


Message ID starts with a value of 0x0001 and is increased by 1 every time an {End} or {Close} ({AutoClose}) is encountered. To make things easier, we recommend the use of Message ID @Constants; JuraviS' decompiler will automatically accomplish this for you.

Regular line breaks are ignored and you must use {br}/{Newline} in order for the compiler to create a new line in the script.

Keep the pixel length of your lines in mind as dialog messages that break past a certain length will either display in a buggy manner, or not display at all. In the latter case, the event acts as it the message was correctly displayed then closed, resuming the event as if nothing wrong happened.