Skip to content

Scripts

Touched edited this page Dec 10, 2017 · 1 revision

Scripts

Scripts are a series of commands that are run in a specific order that allow for custom behaviour. In the context of JiggleMap, scripts refer to event scripts (unless otherwise specified).

Entry Point

Unlike other map editors, JiggleMap does not use offsets to link to a script. Instead, you link directly to the script text file.

Since files can actually contain multiple scripts, it can sometimes be unclear which script to actually run. This is solved by manually specifying the entry point of a script. This is just a label for the first command in a script that tells JiggleMap which script you're actually referring to in a file. No two scripts can share the same label due to restrictions in the underlying data structure, but this is easily remedied by namespacing your labels.

Syntax

Scripts in JiggleMap are stored in ASM (*.s files), so the syntax might be a little different to what you are used to this section contains a quick summary of the differences to the current standard script formats (in programs such as XSE). It is by no means a scripting tutorial.

  @@ This is a comment. It will not be seen by the compiler and is used to explain parts of a script.

  @@ Includes defintions require for scripts to work. This line is required
  @@ unless you include your own command definitions (advanced)
  .include "macros/event.inc"

  @@ Specifies that this script will be placed in the .text section of the
  @@ output binary. This can be safely omitted.
  .text

  @@ Specifies that the symbol 'MyScript' is label is global. This will be our
  @@ entry point for our script and thus must be global.
  .global MyScript

@@ This declares a label called 'MyScript'. This is similar to saying #org @MyScript in XSE.
@@ This label will be our entry point for our script
MyScript:
  @@ This is the start of our script.
  @@ Be careful: Not all commands are the same as in XSE (many commands in XSE
  @@ are poorly named and in some cases completely incorrect). See
  @@ https://github.com/pret/pokeemerald/blob/master/asm/macros/event.inc for
  @@ a full list.
  lock
  faceplayer

  @@ Like XSE, we specify a label for messages. As discussed earlier, all labels
  @@ must be unique. You should namespace all your labels by prefixing them with
  @@ a unique name.
  msgbox MyScript_Message_Hello

  release
  end

MyScript_Message_HelloJiggleMap:
  @@ Messages are prefixed with the '.string' directive.
  .string "Hello from JiggleMap!"

Clone this wiki locally