
Last updated | 3 days ago |
Total downloads | 37 |
Total rating | 0 |
Categories | |
Dependency string | Team036-Roulette-1.0.0 |
Dependants | 2 other packages depend on this package |
README
///
/// This mod is still in development. You may encounter issues such as CTD/CTM. Use at your own risk.
///
/// If you have any problems (bugs, suggestions, screenshots, etc.), contact me via Discord @raintrap341. Or maybe a QQ group? Not sure…
///
/// If you like this mod, please give it a thumbs-up.
///
/// Special thanks to @justanormaluser and @uniboi
This mod is a UI library that provides modders with a roulette-style menu.
Please follow the guide below to use it.
How to use
1. Prepare a UI script
You need to have a script running on the UI VM.
2. (Optional) Set up title/desc/extra hud
The title appears above the roulette, and the description appears below.
void function SetupRoulette(string title = "", string description = "", var extraHud = null) {
file.title = title
file.description = description
file.extraHud = extraHud
}
3. Register Shards
By default, the circle is divided into 8 shards. You can register only the shards you want. Note: Shard index 0 is at 225°, which is the first segment to the lower left of the x-axis.
Function: RegisterShard
Purpose: Registers and configures a single shard (sector) in the roulette UI, including its asset, name, display options, callback, color, position bias, and description.
Parameters:
int index
The index of the shard (0–7).asset shardAsset
The asset to display as the shard's image.string shardName
The display name for the shard.bool shouldShowImage
(default:false
) Whether to show the image for this shard.bool shouldShowText
(default:true
) Whether to show the text label for this shard.bool isAssetRui
(default:false
) Whether the image is a RUI asset.void functionref(int index, entity localPlayer, var roulette) confirmCallback
(default:null
) The callback function to execute when this shard is confirmed/selected.vector textColorOverride
(default:<255, 255, 255>
) The color override for the text label.vector shardNameBias
(default:<0, 0, 0>
) The positional bias for the text label.string shardDescription
(default:""
) The description text for this shard.
Behavior:
- Stores all provided parameters in the
file
struct for later use. - Finds the corresponding UI elements for the shard and its text label.
- Applies the text color and position bias to the text label.
- Registers the confirmation callback if provided and not already registered.
- Outputs a debug message indicating the shard has been registered.
void function RegisterShard(int index, asset shardAsset, string shardName, bool shouldShowImage = false, bool shouldShowText = true, bool isAssetRui = false, void functionref(int index, entity localPlayer, var roulette) confirmCallback = null, vector textColorOverride = DEFAULT_SHARD_TEXT_COLOR, vector shardNameBias = <0, 0, 0>, string shardDescription = "")
// or below
void function RegisterShardOnlyCallback(int index, void functionref(int index, entity localPlayer, var roulette) confirmCallback)
4. Open It
AdvanceMenu( GetMenu( ROULETTE_MENU_NAME ) )
ROULETTE_MENU_NAME
is a globalized const string. You should not change it.
5. (Optional) With Concommand and key binding
Check the NS mod wiki and QuickTyping | Thunderstore - The Northstar Mod Database .
Example
From my mod QuickTyping | Thunderstore - The Northstar Mod Database :
void function QuickTyping_OpenRoulette()
{
// printt("QuickTyping UI: Opening Roulette Menu\n")
for (int i = 0; i < SHARD_MAX; i++) {
string content = GetTexts()[i]
RegisterShard(i, $"", content, false, true, false, void function (int index, entity localPlayer, var roulette) : (content) {
RunClientScript("CodeCallbackQuickTypingSay", content)
}, <0, 0, 0>)
}
SetupRoulette( Localize("#QUICKTYPING_TITLE"))
AdvanceMenu( GetMenu( ROULETTE_MENU_NAME ) )
}
Warning
This mod maintains only a single instance of the Roulette menu at any given time. Make sure to avoid opening the Roulette menu simultaneously to prevent interference between mods.