EA Mod for the game Beatblock
by Pentatrate
More up to date info about this mod can be found in the beatblock modding discord server (invite)
It has a dedicated post named Utilitools in the ea-mods forum
-
Download zip: Either directly download the repository as a zip (I recommend this)
or download the "latest" release (The latest release may not have features added in later commits)
-
Unzip and place in
beatblock/Mods/folder (where all the other mods are)!!!Reminder!!!: Make sure the mod.json file is in
beatblock/Mods/utilitools/mod.jsonand NOTbeatblock/Mods/utilitools/utilitools/mod.json -
Relaunch modded beatblock
This is for mod creators looking to use utilitools as a "dependency".
Definitely message me if you need any additional information regarding utilitools processes or setup, since this README is rather incomplete.
For the following sections, unless otherwise stated, all filepaths provided are relative to your current working directory, the folder of your mod.json file.
-
Bare minimum:
utilitools.jsonTechnically optional, but HIGHLY RECOMMENDED.
Create the
utilitools.jsonfile in the same folder next to themod.jsonfile with the following content.{ "dependencies": { "utilitools": { reason: "Required API", versions: [ [">=", "!!!current utilitools version, for example 1.2.2!!!"] ] } } }Obviously replace the placeholder string with the lowest utilitools version your mod is compatible with. Remember to change this value to reflect the current circumstances when updating your mod.
This should be the minimal requirement since specifying the lowest supported utilitools version will simply force the user to update their old utilitools mods before they get a chance to complain on discord because of a crash. (It may sound blunt, but on the other hand I'm happy to at least get any kind of feedback)
-
Dependencies and incompatibilities
Dependencies and incompatibilities are both specified in basically the same way. You may use the
utilitools.jsonfile of the utilitools mod or the example content in (1.) as reference.Within the
utilitools.jsonfile of your mod, add an attribute either calleddependenciesorincompatibilities. Its value is an object. You may now add multiple other mods that your mod interacts with.Add an attribute and call it the mod ID of another mod you want to specify compatibility with. Its value is an object. Inside it, add an attribute
reason. Its value is a string. Obviously specify the reason the mod is listed there.-
Optional:
Add an attribute
versions. Its value is an array. You may now add multiple versions that interact with your mod. Utilitools will only act as if the mod exists if its version is in the defined range. (Leaving this array empty means that no matter what, utilitools will act as if you do not have the mod installed)Add an array with the first entry being the operation you want to check. You may choose between
"=","<","<=",">",">=","fromTil"and"between". The second (and, if you chose one of the later two operations, also the third) entry should be a string of a version.Optional 2:
If it interests you, you may check out the
files/versions.luafile in this mod to see how things work behind the scenes. (Take an educated guess as to which functions get called when lol.)
-
-
Configs
Utilitools provides you with powerful config functions to cleanly create config options. You may use the
utilitools.jsonandfiles/configOptions.jsonfiles of the utilitools mod as reference.-
Config Options
-
Basic Setup
Within the
utilitools.jsonfile of your mod, add an attribute either calledconfig. Its value is an boolean. Set it to true.With this, you may now create a
files/folder next to themod.jsonfile. Create afiles/configOptions.luafile orfiles/configOptions.jsonfile. All following examples will be in luaTo make utilitools recognize it as a file to be loaded, you must add it to your
utilitools.jsonfile. For more information about the utilitools file manager, see (4.)The content of the
files/configOptions.*file is a table with the config name as a key and a table as its value. See the following example in lua.return { editorMenu = { type = "bool", name = "Configs in Editor", tooltips = "Adjust the configs directly in the editor in the same menu format", default = true } }
-
Required fields
The
typefield specifies the Dear ImGui input type of the config. The currently accepted types are:bool: A boolean.int: An integer. Additional fields:flags,step,stepFastfloat: A floating point number. Additional fields:flags,step,stepFast,formattext: Simple text. Additional fields:flags,sizemultiline: Text with line breaks. Additional fields:flags,sizecombo: A dropdown to select an option. Additional fields:flags,values,valueTooltipsease: A dropdown to select an ease. Eases are provided by the base game. Additional fields:flagscolor: The color input. Additional fields:flagslist: (Not recommended) A string of number separated by a comma, converted to an indexed array in the code. Additional fields:flags,sizekey: A hotkey.branch: (Not recommended) A dropdown to select a git branch, rather used internally for autoupdating mods.sliderInt: An integer slider. Additional fields:flags,min,max,innerLabelsliderFloatA floating point slider. Additional fields:flags,min,max,innerLabel
The
namefield specifies the label of the Dear ImGui input shown to the user.The
tooltipsfield specifies the tooltip the user recieves upon hovering over the Dear ImGui input. In it's most basic form, it is a simple string. Optionally, it may be a table consisting oflongandshortkey-value pairs. This requires an additionaltooltipsconfig optionreturn { editorMenu = { -- See previous example for more fields tooltips = { long = "Adjust the configs directly in the editor in the same menu format", short = "Show this menu in the editor" } } }
The
defaultfield specifies the default value the config option gets initialized as if it is unset upon the lauch of the game. This serves to ensure that the mod does not have the additionally check fornilwhen accessing the config values. -
Optional/Specific fields
There are a few additional fields that arent generally required or are required by a specific input
type:-
off: (optional)Specifies the value the config gets set to when the button gets pressed to turn all configs off. Leaving it empty will make the option unaffected by the button to turn all configs off.
-
flags: (int,float,text,multiline,combo,ease,color,list,sliderInt,sliderFloat)Dear ImGui inputs accept optional flags. Flags are stored as integers where each binary digit stands for a specific flag. Instead of passing a "magic number" as a flag, I recommend adding multiple flags together. Individual flags are provided by Dear ImGui in a readable format. Here is an example for creating readable window flags.
local windowFlags = imgui.ImGuiWindowFlags_NoTitleBar + imgui.ImGuiWindowFlags_NoResize
Different input types require different flags. The exact details are listed below.
ImGuiInputTextFlags:int,float,text,multiline,listImGuiComboFlags:combo,easeImGuiColorEditFlags:colorImGuiSliderFlags:sliderInt,sliderFloat
There are different ways to look for Dear ImGui flags, like the Dear ImGui Explorer, but when all else fails due to the poor documentation, you can always find them in the
lib/cimgui/cdef.luafile within the game files. (Here is the official Dear ImGui Repository by the way, it's README might link to other useful resources. Beatblock uses a binding based on cimgui) -
step,stepFast: (int,float)The step fields provide the number that is stepped up or down when pressing the
+or-buttons next to the input. -
format: (float)The format specifies how the number is rounded/represented. It can for example be used to adjust how many decimals the input rounds to. The structure might be similar to python formatting, I'm not sure, it's been a while.
-
size: (text,multiline,list)Specifies the maximum amount of characters allowed in the input field, defaults to 1024.
-
values,valueTooltips: (combo)The values of a combo are stored in an indexed array. They specify the different options the user can choose from. The options may also have their individual tooltip. The individual tooltips may again be split into long and short versions. The main tooltip explanation can be found in (3.i.b).
return { tooltips = { -- See previous example for more fields values = { "long", "short", "none" }, valueTooltips = { { long = "When hovering over menu options, display a detailed tooltip", short = "Display detailed tooltip" }, { short = "Shorten tooltip" } } } }
-
min,max,innerLabel: (sliderInt,sliderFloat)Specify the lower and upper limit of the slider. Additionally, the
innerLabelfield may be used to show text within the slider. (Otherwise, thenamefield usually shows text next to the input.)
-
-
Example Options
Unfinished D:
-
-
Config Helpers
-
Basic Setup
After your mod has been equipped with configs, utilitools provides a
utilitools.configHelpersmodule for cleanly building your configs. To properly prepare the module, prepend the start of yourconfig.luafile with the following example code.if not utilitools then imgui.Text("Utilitools is disabled") return end local configHelpers = utilitools.configHelpers if configHelpers.setMod(mod) then return end -- real config start configHelpers.input("editorMenu")
Now, you can just call
configHelpers.input(key)with your internal config name and not worry about the Dear ImGui code that happens in the background. -
Additional functions
-
configHelpers.doc(key, force, noSep)For the use of this function, create afiles/documentation.luaorfiles/documentation.jsonfile. You may use thefiles/documentation.luafile of the utilitools mod as reference.To make utilitools recognize it as a file to be loaded, you must add it to your
utilitools.jsonfile. For more information about the utilitools file manager, see (4.){ // previous utilitools.json content here "files": { // previous files content here, if any "documentation": { "extension": "lua", // or "json", depending on your extension of choice "load": true, "call": true // only if your file is a .lua extension } } }Also create an additional config... that will be made in 3.i.d later sry
Unfinished D:
-
configHelpers.treeNode(label, func, flags),configHelpers.condTreeNode = function(label, key, target, same, func, flags)Unfinished D: -
configHelpers.presets.menuOptions()Unfinished D: -
configHelpers.presets.menuButtons()Unfinished D: -
configHelpers.presets.search()Unfinished D: -
configHelpers.presets.updateOptions()Unfinished D: -
configHelpers.default(),configHelpers.off()These functions reset all configs to default or turn all of them to their off value when called.
-
-
-
Imgui helpers
Unfinished D:
-
-
Utilitools file manager
Unfinished D:

{ // previous utilitools.json content here "files": { // previous files content here, if any "configOptions": { "extension": "lua", // or "json", depending on your extension of choice "load": true, "call": true // only if your file is a .lua extension } } }