A downloadable plugin

This is a plugin for GB Studio. It lets you store "mini variables" inside variables, similarly to flags. "Mini variables" are smaller numbers that you can store in the same variable instead of having to use separate variables. These are useful to save on variables. 

The plugin includes 5 events:

Variable: Set 2-Bit Variables

This event allows you to store 4 variables up to 3 in only 1 variable.

Variable: Set 2-Bit Variable

This event allows you to set a certain 2-bit variable.

Variable: Set 4-Bit Variables

This event allows you to store 2 variables up to 15 in only 1 variable.

Variable: Set 4-Bit Variable

This event allows you to set a certain 4-bit variable.

Variable: Store Bits in Variable

This event allows you to extract certain bits from one variable and put it in another. For example, check off Bits 1-4 to get 4-Bit Variable 1 and check off Bits 5-6 to get 2-Bit Variable 3.


There are no "Set 1-Bit Variables" or "Set 1-Bit Variable" events because 1-bit variables are basically the same as flags.

StatusReleased
CategoryTool
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorYousurname
Made withGB Studio
TagsGame Boy, gb-studio, gbstudio, plugin
Average sessionA few seconds
LanguagesEnglish

Download

Download
miniVariablesPlugin.zip 4 kB
Download
miniVariablesPlugin (old).zip 3 kB

Install instructions

Create a new folder called "plugins" inside your project folder. Next, unzip miniVariablesPlugin.zip inside the "plugins" folder. (the folder structure should look like [project name] > plugins > miniVariablesPlugin) Now you can insert the plugin's events in your game!

GB Studio plugins haven't been officially released, so there's a risk they'll stop working in the future and potentially make your project unusable.

Tested to work with GB Studio Version 2 Beta 5.

Comments

Log in with itch.io to leave a comment.

I've decided to take a stab at a GB Studio 3 version of this with MiniVariables16 since I think it would still be useful to have as something that can easily integrate into the scripting UI.

Thanks for laying out the blueprint with this older version! If you know of anywhere else I should post this let me know, I actually have no experience with GB Studio, just felt like contributing something.

(1 edit) (+1)

Need an update! Variables must have changed in 4.13, as bit values only work on local variables now :(

Are you planning to update this for GB Studio 3? Variables are 16-bit now so this could add even more functionality to the engine.

In v3 you can simply use bitwise operators to set bits.

Can you elaborate? I'm having trouble looking up exactly what you mean by 'bitwise operators' in the context of GB Studio/GBVM.

The “Evaluate Math Expression” and “If Math Expression” events support the bitwise operators & | ^, which you can search up without the context of GB Studio. For example, $00$ & 0b1111 will be the lowest 4 bits of the variable, or a “4-Bit Variable” in the terminology of this plugin.

Deleted 1 year ago
(+2)

Very cool, very useful