SuperFlag is an API for other modules to check conditionals (booleans).
Made by me and Evanbowl. Big thanks to Evan for the help!
This module requires PTUtils to function.
Basic programming knowledge will help in understanding this module, but it is not required.
First, download the template. Put it in your mod's SystemData folder.
Super Flags are essentially booleans and have two values: true or false.
Name this whatever you want*. If a module's BCSV file has a FlagName and indicates that it's for SuperFlag, put the name you have here in that field.
*The flag name "True" is reserved and always returns true.
What you choose to check will dictate what the rest of the fields are.
Speaking of, the last two fields in this bcsv are Param01Str and Param01Int.
Some flag types have multiple aliases, and are indicated with a /.
If a type is marked as this, Param00Str and Param00Int will ALWAYS be the same thing.
Param00Str: The sign to use. Supports >=, ==, >, <, <=, !=. If you don't know what these symbols mean, you can look here.
Param00Int: What the value is compared to.
It looks like an average programming comparison. If the CoinNum is greater than or equal to 100 when this flag is checked, it returns true. Otherwise, it returns false.
Checks if all of the flags provided are true.
Param00Str is the first flag it will check. If true, it goes to Param01Str. If false, it returns false. If blank, it assumes the previous flag was the last one.
This will go on up to Param99Str, but you will have to add those fields.
Checks if any of the flags provided are active.
Param00Str is the first flag it will check. If true, it returns true. If false, it goes on to Param01Str. If it's blank, it assumes the previous flag was the last one and return false.
This goes on up to Param99Str, but likewise with And, you'll have to add those fields.
Checks if the flag in Param00Str is true. If it is, it returns false. If it isn't, it returns true.
Checks if any of the galaxy names provided are the current galaxy.
Checks Param00Str. If that's the current galaxy's name, returns true. If false, it goes on to Param01Str. If that's blank, it assumes the previous flag was the last one and returns false.
Like Or, goes on up to Param99Str (but you will have to add these fields).
Comparison Type. Compares the current scenario number.
Comparison Type. Compares the currently selected scenario number. Green Star 1 in Flip Swap would have a SelectedScenarioNo of 3, and a ScenarioNo of 1 because it takes place in Scenario 1, but you select the 3rd star.
Comparison Type. Compares the current amount of collected stars in the current save file.
Comparison Type. Compares the current amount of stocked coins in the current save file. Stocked coins are what you see as the coin counter in Starship Mario.
Comparison Type. Compares the current amount of stocked starbits in the current save file. Stocked starbits are what you see as the starbit counter in Starship Mario.
Comparison Type. Compares the current amount of collected Starbits in the current level.
Comparison Type. Compares the current amount of collected Coins in the current level.
Comparison Type. Compares the current amount of collected Purple Coins in the current level.
Comparison Type. Compares the clear time (in frames) of a certain galaxy in the current save file.
Param01Str: The name of the galaxy to check. Put $CurrentGalaxy to check the current galaxy.
Param01Int: The scenario number to check. 0 or less checks the current selected scenario.
Comparison Type. Compares the current comet medal count. Includes the comet medal in the current galaxy. So, it's like the number in the pause menu.
Comparison Type. Compares the current number of lives, also known as the number in the bottom left.
Comparison Type. Compares the current count in the life meter. In other words, this:
Comparison Type. Compares the current race time based on a race id.
Param01Int: The Race ID to check. In the vanilla game, 0 is Wild Glide Galaxy and 1 is Fleet Glide Galaxy.
Checks if a bronze star in a galaxy has been collected in the current save file.
Param00Str: The name of the galaxy to check. Put $CurrentGalaxy to check the current galaxy.
Param00Int: The scenario number to check. 0 or less checks the current selected scenario.
Checks if a star in a galaxy has been collected in the current save file.
Param00Str: The name of the galaxy to check. Put $CurrentGalaxy to check the current galaxy.
Param00Int: The scenario number to check. 0 or less checks the current selected scenario.
Checks if the comet medal in a galaxy has been collected in the current save file.
Param00Str: The name of the galaxy to check. Put $CurrentGalaxy to check the current galaxy. If you collect the comet medal, this will return true even if you haven't saved yet. In other words, it is collected when the icon on the UI shows it's collected.
Checks if the game event flag is active in the current save file. A list of those can be found here.
Param00Str: Game Event Flag name
Checks if the galaxy has a silver crown in the current save file.
Param00Str: The name of the galaxy to check. Put $CurrentGalaxy to check the current galaxy.
Checks if the galaxy has a gold crown in the current save file.
Param00Str: The name of the galaxy to check. Put $CurrentGalaxy to check the current galaxy.
- Support for specifying which save file to check may be added in the future.
Using SuperFlag in your module allows users to specify conditions for activating features in your module.
- Put
#include "SuperFlag.h"at the top of the .cpp file - Add SuperFlag as a required API to your
ModuleInfo.json:
"RequiredAPIs": [
"SuperFlag"
],
"InstallDependencies": [
"SuperFlag"
]- Call it using:
const char *name = "Your Flag Name Here";
bool result = sf::isFlagActive(name);or
int index = 0;
bool result = sf::isFlagActive(index);- Add the following to ModuleInfo.json's ModuleData:
"ModuleData": [
{
"SuperFlagCustomFlags": [
{
"Name": "CoinFlip",
"FunctionName": "handleTypeCoinFlip"
}
]
}
]The Name is what users will put as the FlagType.
The function name is what SuperFlag will call. It must match the parameters of other types (handleTypeCoinFlip(JMapInfoIter iter)).
- Define the function. By default SuperFlag will look for the type under the
sfnamespace.
namespace sf {
bool handleTypeCoinFlip(JMapInfoIter iter)
{
return MR::isHalfProbability();
}
}And you're done!

