From f6144292c5d29838bb55baf68ac2a0d78a8b7079 Mon Sep 17 00:00:00 2001 From: Samuel Lambert Date: Fri, 20 Oct 2023 12:48:24 -0400 Subject: [PATCH] Add a couple script commands and re-organize sidebar --- rom-hacking/art/_category_.json | 8 -- rom-hacking/audio/_category_.json | 8 -- rom-hacking/exefs/_category_.json | 8 -- rom-hacking/exefs/debugging.md | 4 - rom-hacking/exefs/exlaunch.md | 4 - rom-hacking/exefs/ghidra.md | 4 - rom-hacking/exefs/guide.md | 4 - rom-hacking/exefs/headers.md | 4 - rom-hacking/exefs/hooks.md | 4 - rom-hacking/exefs/logging.md | 4 - rom-hacking/intro.md | 4 - rom-hacking/scripting/_category_.json | 8 -- rom-hacking/scripting/commands/end.md | 25 +++++ rom-hacking/scripting/commands/time-wait.md | 28 ++++++ .../{Installing ev-as.md => setup/ev-as.md} | 13 ++- .../placedatas.md} | 0 .../scripting-guide.md} | 0 sidebarsROMHacking.js | 92 ++++++++++++++++--- 18 files changed, 140 insertions(+), 82 deletions(-) delete mode 100644 rom-hacking/art/_category_.json delete mode 100644 rom-hacking/audio/_category_.json delete mode 100644 rom-hacking/exefs/_category_.json delete mode 100644 rom-hacking/scripting/_category_.json create mode 100644 rom-hacking/scripting/commands/end.md create mode 100644 rom-hacking/scripting/commands/time-wait.md rename rom-hacking/scripting/{Installing ev-as.md => setup/ev-as.md} (97%) rename rom-hacking/scripting/{Scripting Guide 1.md => setup/placedatas.md} (100%) rename rom-hacking/scripting/{Scripting Guide 2.md => setup/scripting-guide.md} (100%) diff --git a/rom-hacking/art/_category_.json b/rom-hacking/art/_category_.json deleted file mode 100644 index f80395a73b..0000000000 --- a/rom-hacking/art/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "Art", - "position": 4, - "link": { - "type": "generated-index", - "description": "Guides for editing textures models and animations." - } -} diff --git a/rom-hacking/audio/_category_.json b/rom-hacking/audio/_category_.json deleted file mode 100644 index 8cc44fc983..0000000000 --- a/rom-hacking/audio/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "Audio", - "position": 5, - "link": { - "type": "generated-index", - "description": "Editing music and sound files." - } -} diff --git a/rom-hacking/exefs/_category_.json b/rom-hacking/exefs/_category_.json deleted file mode 100644 index 4601a1a2ae..0000000000 --- a/rom-hacking/exefs/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "ExeFS Editing", - "position": 3, - "link": { - "type": "generated-index", - "description": "Modifying the underlaying game code, or Executable File System (ExeFS)." - } -} diff --git a/rom-hacking/exefs/debugging.md b/rom-hacking/exefs/debugging.md index fe0df705bd..0484a4920a 100644 --- a/rom-hacking/exefs/debugging.md +++ b/rom-hacking/exefs/debugging.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 7 ---- - # Debugging ## Introduction diff --git a/rom-hacking/exefs/exlaunch.md b/rom-hacking/exefs/exlaunch.md index 0e2e36f0fe..29e4d67800 100644 --- a/rom-hacking/exefs/exlaunch.md +++ b/rom-hacking/exefs/exlaunch.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 3 ---- - # Setting Up ExLaunch ## Introduction diff --git a/rom-hacking/exefs/ghidra.md b/rom-hacking/exefs/ghidra.md index 6e5211385c..6837e5e120 100644 --- a/rom-hacking/exefs/ghidra.md +++ b/rom-hacking/exefs/ghidra.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 2 ---- - # Setting Up Ghidra ## Introduction diff --git a/rom-hacking/exefs/guide.md b/rom-hacking/exefs/guide.md index 918a5d24e9..28ae392b83 100644 --- a/rom-hacking/exefs/guide.md +++ b/rom-hacking/exefs/guide.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 1 ---- - # ExeFS Modding Guide ## Introduction diff --git a/rom-hacking/exefs/headers.md b/rom-hacking/exefs/headers.md index a107c1324e..a564225dcc 100644 --- a/rom-hacking/exefs/headers.md +++ b/rom-hacking/exefs/headers.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 4 ---- - # Headers ## Introduction diff --git a/rom-hacking/exefs/hooks.md b/rom-hacking/exefs/hooks.md index 9713de736d..c691748efd 100644 --- a/rom-hacking/exefs/hooks.md +++ b/rom-hacking/exefs/hooks.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 5 ---- - # Hooks ## Introduction diff --git a/rom-hacking/exefs/logging.md b/rom-hacking/exefs/logging.md index 1d3368deaa..d11742589a 100644 --- a/rom-hacking/exefs/logging.md +++ b/rom-hacking/exefs/logging.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 6 ---- - # Logging ## Introduction diff --git a/rom-hacking/intro.md b/rom-hacking/intro.md index 3ec0e3e96f..8b66488289 100644 --- a/rom-hacking/intro.md +++ b/rom-hacking/intro.md @@ -1,7 +1,3 @@ ---- -sidebar_position: 1 -slug: / ---- # ROM Hacking Learn how to make your own modifications to the Pokemon BDSP ROM. diff --git a/rom-hacking/scripting/_category_.json b/rom-hacking/scripting/_category_.json deleted file mode 100644 index 5ac801182e..0000000000 --- a/rom-hacking/scripting/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "Scripting", - "position": 2, - "link": { - "type": "generated-index", - "description": "Editing in-game EvScripts. This is all done in romfs." - } -} diff --git a/rom-hacking/scripting/commands/end.md b/rom-hacking/scripting/commands/end.md new file mode 100644 index 0000000000..c01a4e5b0e --- /dev/null +++ b/rom-hacking/scripting/commands/end.md @@ -0,0 +1,25 @@ +# (3) _END + +## Synonyms + +- _NOP + +## Effect + +Ends the script. + +## Syntax + +```c +_END() +``` + +## Example + +```c +_LDVAL(@LOCALWORK1, 1) +_END() +_SE_PLAY('S_PINPON') +``` + +The above script will set the work variable @LOCALWORK1 to 1, then end script execution. The command on line 3 will not be executed. diff --git a/rom-hacking/scripting/commands/time-wait.md b/rom-hacking/scripting/commands/time-wait.md new file mode 100644 index 0000000000..864d93fe99 --- /dev/null +++ b/rom-hacking/scripting/commands/time-wait.md @@ -0,0 +1,28 @@ +# (4) _TIME_WAIT + +## Effect + +Blocks script execution for the amount of time given. +The **result** work is set to 0 on every loop until the time has expired. It is then set to 1 and execution resumes. + +## Syntax + +```c +_TIME_WAIT(time, result) +``` + +| Argument | Description | Types | +| - | - | - | +| **time** | The amount of time to wait, in frames (1/30ths of a second) | Work, Float | +| **result** | The work to put the result into | Work | + +## Example + +```c +_TIME_WAIT(120, @LOCALWORK2) +_SE_PLAY('S_PINPON') +``` + +The above script will block script execution for approximately 4 seconds. The work variable @LOCALWORK2 is set to 1 upon execution resuming. + +Finally, the sound effect 'S_PINPON' plays. diff --git a/rom-hacking/scripting/Installing ev-as.md b/rom-hacking/scripting/setup/ev-as.md similarity index 97% rename from rom-hacking/scripting/Installing ev-as.md rename to rom-hacking/scripting/setup/ev-as.md index 64a6ca59c0..016fa7d874 100644 --- a/rom-hacking/scripting/Installing ev-as.md +++ b/rom-hacking/scripting/setup/ev-as.md @@ -1,11 +1,10 @@ - # EV-AS Guide This guide is for the setup of z80Rotom's [ev-as scripting tool](https://github.com/z80rotom/ev-as) and expects a few bare minimum skills. You should know how to download GitHub repositories, whether by downloading the zip or cloning the repo. You should also be comfortable with running commands such as `python` and `cd` from the terminal/command prompt/PowerShell. For Pokémon Luminescent, as of 8th June 2023, I will be recommending the usage of the [`custom_commands` branch](https://github.com/z80rotom/ev-as/tree/custom_commands). This is required to ensure the functionality of Eterna's gym, as well as other events in the future. -# Setup +## Setup In this tutorial, we will be working with the source code and will therefore need to download some large dependencies. This is so we can work with the latest release at all times and most Unity modding tools will require these dependencies anyway. @@ -19,23 +18,23 @@ Once you have your dependencies, Python and ev-as ready to go, create a folder i Finally, create a folder called `scripts`. We will use this later. -# Additional Setup +## Additional Setup For the purpose of macro commands, you will need to install the [BDSP Repacker](https://github.com/Ai0796/BDSP-Repacker) and unpack your `romfs\Data\StreamingAssets\AssetAssistant\Message\english` file. Once unpacked, you will have the various JSONs that ev-as requires. No further setup is necessary at this point. The `AssetFolder` must be copied into ev-as' main folder after unpacking. -## Usages +### Usages When editing scripts, you **must** copy your .ev file of choice from the `parsed` folder and paste it in your `scripts` folder. **Changes made to files in `parsed` will not be reflected**. ev-as has a few different commands that can be run. This tutorial will assume you have opened a terminal in the main ev-as folder. -## ev_as.py +### ev_as.py Run via: `python .\src\ev_as.py` Takes all the .ev files from the `scripts` folder, assembles it and repacks it into the Unity ev_script bundle. It will also check your scripts for improper label usage, as well as pack any macro messages into your dialogue file. -## ev_parse.py +### ev_parse.py Run via: `python .\src\ev_parse.py` -Takes the provided `Dpr/ev_script` file, extracts and parses all of the individual script files to the generated `parsed` folder. \ No newline at end of file +Takes the provided `Dpr/ev_script` file, extracts and parses all of the individual script files to the generated `parsed` folder. diff --git a/rom-hacking/scripting/Scripting Guide 1.md b/rom-hacking/scripting/setup/placedatas.md similarity index 100% rename from rom-hacking/scripting/Scripting Guide 1.md rename to rom-hacking/scripting/setup/placedatas.md diff --git a/rom-hacking/scripting/Scripting Guide 2.md b/rom-hacking/scripting/setup/scripting-guide.md similarity index 100% rename from rom-hacking/scripting/Scripting Guide 2.md rename to rom-hacking/scripting/setup/scripting-guide.md diff --git a/sidebarsROMHacking.js b/sidebarsROMHacking.js index 5359eebf42..7a14dacfc7 100644 --- a/sidebarsROMHacking.js +++ b/sidebarsROMHacking.js @@ -13,21 +13,91 @@ /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { - // By default, Docusaurus generates a sidebar from the docs folder structure - ROMHackingSidebar: [{type: 'autogenerated', dirName: '.'}], - - // But you can create a sidebar manually - /* - tutorialSidebar: [ + docs: [ 'intro', - 'hello', { type: 'category', - label: 'Tutorial', - items: ['tutorial-basics/create-a-document'], + label: 'Scripting', + link: { + type: 'generated-index', + slug: 'category/scripting', + description: 'Everything about ev_scripts.', + }, + collapsed: true, + items: [ + { + type: 'category', + label: 'Setting up', + link: { + type: 'generated-index', + slug: 'category/scripting/setup', + description: 'Setup instructions and guides on editing in-game ev_scripts. This is all done in RomFS.', + }, + collapsed: true, + items: [ + 'scripting/setup/ev-as', + 'scripting/setup/placedatas', + 'scripting/setup/scripting-guide', + ], + }, + { + type: 'category', + label: 'Commands', + collapsed: true, + items: [ + 'scripting/commands/end', + 'scripting/commands/time-wait', + ], + }, + ], + }, + { + type: 'category', + label: 'ExeFS Editing', + link: { + type: 'generated-index', + slug: 'category/exefs', + description: 'Modifying the underlaying game code, or Executable File System (ExeFS).', + }, + collapsed: true, + items: [ + 'exefs/guide', + 'exefs/ghidra', + 'exefs/exlaunch', + 'exefs/headers', + 'exefs/hooks', + 'exefs/logging', + 'exefs/debugging', + ], + }, + { + type: 'category', + label: 'Art', + link: { + type: 'generated-index', + slug: 'category/art', + description: 'Guides for editing textures models and animations.', + }, + collapsed: true, + items: [ + 'art/animations', + 'art/mesh_and_texture_replacement', + ], + }, + { + type: 'category', + label: 'Editing music and sound files.', + link: { + type: 'generated-index', + slug: 'category/audio', + description: 'Editing music and sound files.', + }, + collapsed: true, + items: [ + 'audio/labels', + ], }, - ], - */ + ] }; module.exports = sidebars;