Writing a Plugin
Let's get started with writing our first plugin. The gimmick method we currently have in Ichigo is nice, but we can only change one gimmick per line. Let's write a plugin that will allow us to define multiple gimmicks with one ease, and multiple gimmicks with one set.
Create a new file called multimod.lua in the /src/plugins folder. We can create two functions to accomplish the goals of this plugin. We can name them anything that isn't taken already. Let's go with ease and set. They should take in a table, just like gimmick does.
function ease(t)
end
function set(t)
endLet's work with ease first. We want to make this as little confusing as possible, so let's get an idea of how to use this function.
ease {0, 2, Tweens.linear, 0, 100, "flip", 0, -100, "invert"}We have three arguments that are constant, the first three, and we have a boundless number of arguments that are variable. However, it follows a pattern. Do you notice it? Each group of three contains the following:
A start value
An end value
A gimmick name
After some calculation, we can boil our table of arguments down to the following:
-- [1]: start beat
-- [2]: length (or end)
-- [3]: the ease
-- [4 + 3*n]: the source mod value
-- [5 + 3*n]: the destination mod value
-- [6 + 3*n]: the mod nameIf you don't understand, it's okay. The point is that what we want to accomplish is possible. Let's fill in our ease function.
Now with set. This one is easier.
Let's go ahead and fill in our set function with this in mind.
Great! We now have a plugin that allows us to set or ease multiple mods at once. Here's the entire code we've written so far:
Plugins can be a great way to provide easy, lightweight tools that can speed up the gimmick creation process.
Last updated
Was this helpful?