QuizMenuTool Tutorial: Difference between revisions

Happylappy (talk | contribs)
Happylappy (talk | contribs)
Line 4: Line 4:


=== What Is QuizMenuTool? ===
=== What Is QuizMenuTool? ===
QuizMenuTool is a customizable ExplorerScript replica of the Explorers of Sky Personality Quiz and Starter Selection, with minimal hardcoded aspects. The original quiz was designed to consist mostly of message_Menu ASM, to make editing the personality quiz accessible without the need to learn ASM.  
QuizMenuTool is a customizable ExplorerScript replica of the Explorers of Sky Personality Quiz and Starter Selection, with minimal hardcoded aspects. The original quiz was designed to consist mostly of <code>message_Menu()</code> ASM, to make editing the personality quiz accessible without the need to learn ASM.  


=== What can QuizMenuTool do? ===
=== What can QuizMenuTool do? ===
Line 127: Line 127:


=== Fuwarante Blacklist ===
=== Fuwarante Blacklist ===
Finally, on the far end of the table, is the Fuwarante Blacklist inputs. These are perhaps the most complicated portion of this tab of the sheet.[[File:Fuwarante Blacklist.png|alt=Location of the Fuwarante Blacklist|center|thumb|300x300px|Location of the Fuwarante Blacklist]]Each column corresponds to a bit of the script variable $BIT_FUWARANTE_LOCAL. If the matching flag is on, the starter in that row '''cannot''' be chosen. This will be elaborated on further in the "Question Loop Generator", but this is a brief explanation of what the bits represent by default:
Finally, on the far end of the table, is the Fuwarante Blacklist inputs. These are perhaps the most complicated portion of this tab of the sheet.[[File:Fuwarante Blacklist.png|alt=Location of the Fuwarante Blacklist|center|thumb|300x300px|Location of the Fuwarante Blacklist]]Each column corresponds to a bit of the script variable <code>$BIT_FUWARANTE_LOCAL</code>. If the matching flag is on, the starter in that row '''cannot''' be chosen. This will be elaborated on further in the "Question Loop Generator", but this is a brief explanation of what the bits represent by default:
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 134: Line 134:
|-
|-
|0
|0
|If enabled, $PLAY_OLD_GAME will be true, meaning the player answered that they have played Time/Darkness before.
|If enabled, <code>$PLAY_OLD_GAME</code> will be true, meaning the player answered that they have played Time/Darkness before.
|-
|-
|1
|1
Line 164: Line 164:
These are the primary use-cases for the Fuwarante Blacklist described above.  
These are the primary use-cases for the Fuwarante Blacklist described above.  


The "[S:0]" text tag will be explained in further detail below.  
The <code>[S:0]</code> text tag will be explained in further detail below.  


== Question Generator: Multiple Choice Monotony ==
== Question Generator: Multiple Choice Monotony ==
Note: The "Yes." and "No." options have the "[S:0]" text tag after them. This does functionally nothing, and exists primarily to aid in automatic string translation, as the localization teams translated the same English responses for questions differently based on context. This will be elaborated on further in "Full Script Translation". If there are no plans to use the sheet's translation features, it is safe to remove any variants of "[S:0]". (instructions to do so in SkyTemple directly are present below).
Note: The "Yes." and "No." options have the <code>[S:0]</code> text tag after them. This does functionally nothing, and exists primarily to aid in automatic string translation, as the localization teams translated the same English responses for questions differently based on context. This will be elaborated on further in "Full Script Translation". If there are no plans to use the sheet's translation features, it is safe to remove any variants of <code>[S:0]</code>. (instructions to do so in SkyTemple directly are present below).


=== About Question Templates ===
=== About Question Templates ===
This tab of the sheet is dedicated to the design and storage of the individual random questions in the quiz. The way this sheet works revolves  around "Question Templates" that store the question text, question number, answer text, pool ID, and points for that pool ID. Below is an example of a Question Template, and how it translates to question data:  
This tab of the sheet is dedicated to the design and storage of the individual random questions in the quiz. The way this sheet works revolves  around "Question Templates" that store the question text, question number, answer text, pool ID, and points for that pool ID. Below is an example of a Question Template, and how it translates to question data:  
{| class="wikitable"
{| class="wikitable"
|+ Do you prefer to be busy or have\na lot of free time?^35 |Being busy.^11^4^8^2|Free time!^9^4|In between.^12^4
|+ Do you prefer to be busy or have\na lot of free time?^35 |<code>Being busy.^11^4^8^2|Free time!^9^4|In between.^12^4</code>
!Question Text
!Question Text
! colspan="8" |Question #
! colspan="8" |Question #
Line 244: Line 244:


=== Pool Tinkering ===
=== Pool Tinkering ===
As stated above, the vanilla quiz favors pools with Sky-Exclusive Starters for the specified gender if they've played Time/Darkness. Through checking the BIT_FUWARANTE_LOCAL flags from the "Question Loop Generator", we can mimic this effect.
As stated above, the vanilla quiz favors pools with Sky-Exclusive Starters for the specified gender if they've played Time/Darkness. Through checking the <code>$BIT_FUWARANTE_LOCAL</code> flags from the "Question Loop Generator", we can mimic this effect.
[[File:Pool Tinkering.png|alt=Location of Pool Tinkering Portion.|center|thumb|600x600px|Location of Pool Tinkering Portion.]]
[[File:Pool Tinkering.png|alt=Location of Pool Tinkering Portion.|center|thumb|600x600px|Location of Pool Tinkering Portion.]]
On the far left, are the IDs of the two flags that should be checked (without modification, this could be 0 for "Time/Darkness", and 3/4 for "Male/Female"). Depending on if the 1st and 2nd flags are true (1), or false (0), the selected pools (as many as needed) will gain the specified number of points. In order to accommodate for the "Surprise Me!" gender option, 2 points are given for male, 2 for "not male", 2 for "female", and 2 for "not female", in order to influence every pool containing a sky-exclusive starter. (A similar process is done for the Time/Darkness exclusive starters I've added to my example quiz, if the player has NOT played time/darkness). Up to 10 slots are present for pool tinkering, though more could be added if there is a pressing need.  
On the far left, are the IDs of the two flags that should be checked (without modification, this could be 0 for "Time/Darkness", and 3/4 for "Male/Female"). Depending on if the 1st and 2nd flags are true (1), or false (0), the selected pools (as many as needed) will gain the specified number of points. In order to accommodate for the "Surprise Me!" gender option, 2 points are given for male, 2 for "not male", 2 for "female", and 2 for "not female", in order to influence every pool containing a sky-exclusive starter. (A similar process is done for the Time/Darkness exclusive starters I've added to my example quiz, if the player has NOT played time/darkness). Up to 10 slots are present for pool tinkering, though more could be added if there is a pressing need.  
Line 252: Line 252:


* Use DS Favorite Color (75% Chance): If the DS Favorite Color is selected, the user's favorite color will match the color of the bow.
* Use DS Favorite Color (75% Chance): If the DS Favorite Color is selected, the user's favorite color will match the color of the bow.
* Use DS Mac Address (25% Chance): If the Mac Address is selected, then "mac_address & 0xF" determines the color of the bow.
* Use DS Mac Address (25% Chance): If the Mac Address is selected, then <code>mac_address & 0xF</code> determines the color of the bow.


This functionality can be replicated by QuizMenuTool, and the chances can even be altered!
This functionality can be replicated by QuizMenuTool, and the chances can even be altered!
Line 271: Line 271:


== Variable Cleanup & End-Cap Generator: Nearly Finished! ==
== Variable Cleanup & End-Cap Generator: Nearly Finished! ==
This tab of the sheet aims to clean up the bevy of variables used by the quiz, and prep the game for actually running. Since QMT uses a majority of the script variables the game has to function, this tab resets them all back to what they should be at the beginning of a save file, now that the quiz no longer needs them. If some part of the quiz needs to be remembered, such as the color of the aura bow, whether the player has played Time/Darkness, or the winning Quiz personality pool, that needs to be preserved in this tab. In addition, this is the tab where the starters are officially initialized, which allows them to be nicknamed. Finally, the special process for actually assigning the starters, PROCESS_SPECIAL_INIT_MAIN_TEAM_AFTER_QUIZ, will wipe $CONFIG_COLOR_KIND clean, replacing it with what the real quiz determined your aura bow color to be. Because the real quiz never runs during QMT, this will always be zero. As a result, the aura bow color needs to be saved somewhere besides $CONFIG_COLOR_KIND, then returned afterwards.   
This tab of the sheet aims to clean up the bevy of variables used by the quiz, and prep the game for actually running. Since QMT uses a majority of the script variables the game has to function, this tab resets them all back to what they should be at the beginning of a save file, now that the quiz no longer needs them. If some part of the quiz needs to be remembered, such as the color of the aura bow, whether the player has played Time/Darkness, or the winning Quiz personality pool, that needs to be preserved in this tab. In addition, this is the tab where the starters are officially initialized, which allows them to be nicknamed. Finally, the special process for actually assigning the starters, <code>PROCESS_SPECIAL_INIT_MAIN_TEAM_AFTER_QUIZ</code>, will wipe <code>$CONFIG_COLOR_KIND</code> clean, replacing it with what the real quiz determined your aura bow color to be. Because the real quiz never runs during QMT, this will always be zero. As a result, the aura bow color needs to be saved somewhere besides <code>$CONFIG_COLOR_KIND</code>, then returned afterwards.   


=== Upper Panel ===
=== Upper Panel ===
This tab ALSO has an upper panel! The number of pools to clear should ideally match the number of pools in use. "White Space" does the same thing it has up to this point, and the far right output cell is read elsewhere, and only exists for debug purposes.
This tab ALSO has an upper panel! The number of pools to clear should ideally match the number of pools in use. "White Space" does the same thing it has up to this point, and the far right output cell is read elsewhere, and only exists for debug purposes.
[[File:Variable Cleanup & End-Cap Upper Panel.png|alt=Variable Cleanup & End-Cap Upper Panel Location.|center|thumb|600x600px|Variable Cleanup & End-Cap Upper Panel Location.]]
[[File:Variable Cleanup & End-Cap Upper Panel.png|alt=Variable Cleanup & End-Cap Upper Panel Location.|center|thumb|600x600px|Variable Cleanup & End-Cap Upper Panel Location.]]
In the center of the panel are three new checkboxes. "Name Partner?" and "Name Hero?" should be somewhat intuitive, they enable/disable the ExplorerScript inputs for naming the hero and partner respectively, which will be elaborated on below. Finally, "Set $VERSION to 1?" sets the "$VERSION" script variable to 1 at the very end of the script. Without ASM modification, saving the game with this variable as anything besides 1 results in a "corrupt" save file. In the absence of a strong reason otherwise, this box should remain checked.
In the center of the panel are three new checkboxes. "Name Partner?" and "Name Hero?" should be somewhat intuitive, they enable/disable the ExplorerScript inputs for naming the hero and partner respectively, which will be elaborated on below. Finally, "Set $VERSION to 1?" sets the <code>$VERSION</code> script variable to 1 at the very end of the script. Without ASM modification, saving the game with this variable as anything besides 1 results in a "corrupt" save file. In the absence of a strong reason otherwise, this box should remain checked.


=== Hero Name, Partner Name, & Closing Remarks ===
=== Hero Name, Partner Name, & Closing Remarks ===
These ExplorerScript Inputs are for... the code used for nicknaming the partner and hero respectively, as well as the last few lines of text before the quiz truly ends.[[File:Hero-Partner-Closing Remarks Input.png|alt=Location of ExplorerScript Code Inputs.|center|thumb|600x600px|Location of ExplorerScript Code Inputs.]]Note that MENU_PARTNER_NAME will not function without the dedicated SkyPatch, in the QMT github repo (linked at the top). Additionally, the menus themselves will close any active text-box the instant they are done printing, which is why the hero monologue ends with a [K]. A message_Close(); would also suffice. Finally, the closing remarks should actually fade out the bgm and screen as desired. Feel free to optimize the fades, there is probably a more efficient way to achieve the right effect.  
These ExplorerScript Inputs are for... the code used for nicknaming the partner and hero respectively, as well as the last few lines of text before the quiz truly ends.[[File:Hero-Partner-Closing Remarks Input.png|alt=Location of ExplorerScript Code Inputs.|center|thumb|600x600px|Location of ExplorerScript Code Inputs.]]Note that <code>MENU_PARTNER_NAME</code> will not function without the dedicated SkyPatch, in the QMT github repo (linked at the top). Additionally, the menus themselves will close any active text-box the instant they are done printing, which is why the hero monologue ends with a <code>[K]</code>. A <code>message_Close();</code> would also suffice. Finally, the closing remarks should actually fade out the BGM and screen as desired. Feel free to optimize the fades, there is probably a more efficient way to achieve the right effect.  


=== Script Variable Preservation Panel ===
=== Script Variable Preservation Panel ===
The Script Variable Preservation Panel serves to determine what information should be preserved after the quiz. By default, only the variables storing the personality pool counts are actually being erased, though certain configurations may require some variables to be kept, and others to be wiped in addition.[[File:Script Variable Preservation Panel.png|alt=Script Variable Preservation Panel Location.|center|thumb|600x600px|Script Variable Preservation Panel Location.]]Beginning at the top, is the "Variable Erasure Blacklist". Based on other interactions with the sheet, the "Automatic Variables" will fill up automatically, but any script variables specified in this row will be kept as they are at the end of the quiz, and not erased. An example of a manual blacklist example might be $VERSION, which doesn't need a dedicated line of code for erasure if it will ALSO be set to 1 at the end. The next row, "Additional Variables to Erase", will be added to the list of erased variables if they are not already present. The $BIT_FUWARANTE_LOCAL variables should be erased in addition, as the Driftblim Gondola will interpret these variables as valid station passes to enter. Below that, is the "Variable Transfer Table". Prior to erasing anything, variables in the "Old Variable Name" column will be moved to the "New Variable Name". The old variable will be slated for erasure, while the new one will be spared. For convenience, the "Variable Meaning" Tab on the left will autofill one or both of these columns depending on the option you select:
The Script Variable Preservation Panel serves to determine what information should be preserved after the quiz. By default, only the variables storing the personality pool counts are actually being erased, though certain configurations may require some variables to be kept, and others to be wiped in addition.[[File:Script Variable Preservation Panel.png|alt=Script Variable Preservation Panel Location.|center|thumb|600x600px|Script Variable Preservation Panel Location.]]Beginning at the top, is the "Variable Erasure Blacklist". Based on other interactions with the sheet, the "Automatic Variables" will fill up automatically, but any script variables specified in this row will be kept as they are at the end of the quiz, and not erased. An example of a manual blacklist example might be <code>$VERSION</code>, which doesn't need a dedicated line of code for erasure if it will ALSO be set to 1 at the end. The next row, "Additional Variables to Erase", will be added to the list of erased variables if they are not already present. The <code>$BIT_FUWARANTE_LOCAL</code> variables should be erased in addition, as the Driftblim Gondola will interpret these variables as valid station passes to enter. Below that, is the "Variable Transfer Table". Prior to erasing anything, variables in the "Old Variable Name" column will be moved to the "New Variable Name". The old variable will be slated for erasure, while the new one will be spared. For convenience, the "Variable Meaning" Tab on the left will autofill one or both of these columns depending on the option you select:
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 291: Line 291:
|-
|-
|Aura Bow Preserve
|Aura Bow Preserve
|$CONFIG_COLOR_KIND
|<code>$CONFIG_COLOR_KIND</code>
|$LOCAL0
|<code>$LOCAL0</code>
|If this Variable Meaning is present, $CONFIG_COLOR_KIND will be restored in post. It's only purpose is to prevent the quiz from wiping the variable on running  "PROCESS_SPECIAL_INIT_MAIN_TEAM_AFTER_QUIZ".
|If this Variable Meaning is present, <code>$CONFIG_COLOR_KIND</code> will be restored in post. It's only purpose is to prevent the quiz from wiping the variable on running  <code>PROCESS_SPECIAL_INIT_MAIN_TEAM_AFTER_QUIZ</code>.
|-
|-
|Winning Pool
|Winning Pool
|$SCENARIO_SUB7
|<code>$SCENARIO_SUB7</code>
|Any
|Any
|This variable retains the winning Pool ID from the quiz itself. This could prove useful for dialogue, or perhaps some other purpose?
|This variable retains the winning Pool ID from the quiz itself. This could prove useful for dialogue, or perhaps some other purpose?
|-
|-
|Winning Points
|Winning Points
|$SCENARIO_SUB6
|<code>$SCENARIO_SUB6</code>
|Any
|Any
|This variable retains the number of points the winning Pool ID had after the tie-breaking process. This could prove useful for dialogue, or perhaps some other purpose?
|This variable retains the number of points the winning Pool ID had after the tie-breaking process. This could prove useful for dialogue, or perhaps some other purpose?
|-
|-
|Fuwarante Bit X
|Fuwarante Bit X
|$BIT_FUWARANTE_LOCAL[X]
|<code>$BIT_FUWARANTE_LOCAL[X]</code>
|Any
|Any
|These correspond directly to the FUWARANTE blacklist, and in this example is used to pass forward the Time/Darkness question to $PLAY_OLD_GAME, the variable responsible for the recruitment rate buff for playing Time/Darkness.
|These correspond directly to the FUWARANTE blacklist, and in this example is used to pass forward the Time/Darkness question to <code>$PLAY_OLD_GAME</code>, the variable responsible for the recruitment rate buff for playing Time/Darkness.
|-
|-
|Direct Script Variable
|Direct Script Variable
Line 321: Line 321:


=== Upper Panel ===
=== Upper Panel ===
By default, the left-most checkbox of the upper panel will "activate" this sheet for translation. This may cause lag, and will cause more lag every time a change is made on one of the prior sheets, while enabled. Only begin translating once finished with the quiz, at least in the short term. [[File:Full Script Translation Upper Panel.png|alt=Location of the Full Script Translation Upper Panel.|center|thumb|600x600px|Location of the Full Script Translation Upper Panel.]]The "Auto-Translate Vanilla Strings" check-box will automatically search for and translate exact matches to vanilla Quiz strings. Additional translations can be added in "Vanilla Translation Strings" as needed. If no exact match is found, the translation will be left blank for manual translation. "Auto-Translate Pokemon" similarly will attempt to translate exact matches for dialogue specific to the final species. For example, "[R][CN]Will be a [CS:K]Magnemite[CR]![W:60]" will be automatically translated to "[R][CN]wird ein [CS:K]Magnetilo[CR]![W:60]" (German), based on Magnemite's German name and the phrase "wird ein ___!". This will only occur if the checkbox is enabled, and only for Pokemon names present in "Vanilla Translation Strings". Finally, the "Trim [S:0] Before Translation" checkbox will remove all "[S:0]" text tags from the dialogue before searching for a match, ensuring that the various "Yes.", "No.". "Of Course!", and "Open it!" are not translated automatically, per their vanilla quiz questions. Regardless of whether this checkbox is enabled, the final script output will not contain the "[S:0]" tags.  
By default, the left-most checkbox of the upper panel will "activate" this sheet for translation. This may cause lag, and will cause more lag every time a change is made on one of the prior sheets, while enabled. Only begin translating once finished with the quiz, at least in the short term. [[File:Full Script Translation Upper Panel.png|alt=Location of the Full Script Translation Upper Panel.|center|thumb|600x600px|Location of the Full Script Translation Upper Panel.]]The "Auto-Translate Vanilla Strings" check-box will automatically search for and translate exact matches to vanilla Quiz strings. Additional translations can be added in "Vanilla Translation Strings" as needed. If no exact match is found, the translation will be left blank for manual translation. "Auto-Translate Pokemon" similarly will attempt to translate exact matches for dialogue specific to the final species. For example, the English string <code>[R][CN]Will be a [CS:K]Magnemite[CR]![W:60]</code> will be automatically translated to <code>[R][CN]wird ein [CS:K]Magnetilo[CR]![W:60</code>] (German), based on Magnemite's German name and the phrase "wird ein ___!". This will only occur if the checkbox is enabled, and only for Pokemon names present in "Vanilla Translation Strings". Finally, the "Trim [S:0] Before Translation" checkbox will remove all <code>[S:0]</code> text tags from the dialogue before searching for a match, ensuring that the various "Yes.", "No.". "Of Course!", and "Open it!" are not translated automatically, per their vanilla quiz questions. Regardless of whether this checkbox is enabled, the final script output will not contain the <code>[S:0]</code> tags.  


=== String Translation Panel ===
=== String Translation Panel ===
Line 341: Line 341:
There are a handful of settings in this upper panel. "White Space" is as it has been for every prior tab, but that's the only returning input.
There are a handful of settings in this upper panel. "White Space" is as it has been for every prior tab, but that's the only returning input.
[[File:Full Script Compression Upper Panel.png|alt=Full Script Compression Upper Panel Location.|center|thumb|600x600px|Full Script Compression Upper Panel Location.]]
[[File:Full Script Compression Upper Panel.png|alt=Full Script Compression Upper Panel Location.|center|thumb|600x600px|Full Script Compression Upper Panel Location.]]
"Use Full MegaScript" will compile the entire quiz into one script. This is only possible for English-only quizzes, and is only advised for quizzes with few questions and fewer starter choices. "Use Translated Scripts?" will use the outputs from Full Script Translation, which will be empty if the sheet is not active. Disable this checkbox for English-only quizzes. "Generate Unionall CORO" will create the unionall code needed to run the quiz, for a copy and paste replacement for the existing '''CORO EVENT_M00A_01''' coroutine. The "Script File LEVEL Name" should reflect the location of the map LEVEL "folder" that the script file will actually be under. The "Script File SCRIPT Name" should become the name of the acting script itself, and should be 8 alphanumerical characters or fewer (not case-sensitive). Finally, the "Sector Param." is the sector parameter of the supervision_ActingSub() Opcode. Generally this should be zero, though none of these scripts internally utilize the sector parameter, should it be of interest for customization.
"Use Full MegaScript" will compile the entire quiz into one script. This is only possible for English-only quizzes, and is only advised for quizzes with few questions and fewer starter choices. "Use Translated Scripts?" will use the outputs from Full Script Translation, which will be empty if the sheet is not active. Disable this checkbox for English-only quizzes. "Generate Unionall CORO" will create the unionall code needed to run the quiz, for a copy and paste replacement for the existing <code>CORO EVENT_M00A_01</code> coroutine. The "Script File LEVEL Name" should reflect the location of the map LEVEL "folder" that the script file will actually be under. The "Script File SCRIPT Name" should become the name of the acting script itself, and should be 8 alphanumerical characters or fewer (not case-sensitive). Finally, the "Sector Param." is the sector parameter of the <code>supervision_ExecuteActingSub();</code> [[List of Opcodes#0x12d - supervision ExecuteActingSub|Opcode]]. Generally this should be zero, though none of these scripts internally utilize the sector parameter, should it be of interest for customization.


=== SkyTemple Script Outputs ===
=== SkyTemple Script Outputs ===
Line 349: Line 349:


== Importing The Scripts To SkyTemple ==
== Importing The Scripts To SkyTemple ==
Now for the fun part! Actually applying everything to SkyTemple, and seeing the quiz actually play out.


=== Converting From StarterMenuTool ===
=== Converting From StarterMenuTool ===
There are very few differences between starting fresh and converting from StarterMenuTool. The differences are as follows:
* FixPartnerNameMenu is Applied: Since the SkyPatch is already applied, it does not need to be applied again. It can be reapplied without issue, though it already exists in the ROM.
* Existing Special Processes: Older versions of <code>starter_setter</code> and <code>set_frame_color</code> were added via StarterMenuTool. These may function as intended for QMT, especially <code>set_frame_color</code> which has seen zero change between the two tools, but it is recommended to update them by replacing them, or to use new slots for the QMT SPs.
* Existing Acting Script: StarterMenuTool takes the same approach as QMT in creating a new acting scene for the quiz itself. This existing script can be repurposed into one of the QMT acting scripts, though with SkyTemple alone it cannot be renamed, meaning the script name it will be used for in the Full Script Compression Upper Panel must be renamed.
* Edit to Vanilla Quiz: StarterMenuTool modifies the original quiz script m00a01a.ssb. While these changes have no net impact on QMT, it would impact the debug mode, as the code to create a team from the default starters has been removed. If this functionality needs to be restored, simply add the following line after "if ( debug ) {" in m00a01a.ssb:
<code>switch ( ProcessSpecial(PROCESS_SPECIAL_INIT_MAIN_TEAM_AFTER_QUIZ, 0, 0) ) { }</code>
* Existing Unionall Edit: StarterMenuTool also requires the modification of <code>coro EVENT_M00A_01</code>. QuizMenuTool will require this coroutine to be edited to run m00a01a in debug mode, and the QMT scripts otherwise.


== Other Resources ==
== Other Resources ==