If you're like me, you may want to play the most up-to-date version of Character Select. This includes in-dev versions, however, detecting if you're above a specific version can be hard when it's labeled as
This is useful when creating Character Select packs that are backwards-compatible as well! For example, if your character comes with a preset palette, versions below 1.8 will not support this. For my own code, I use this check:
Feel free to use, but do credit me for the code if possible! Would really appreciate it.
1.8.1 (In-Dev)
. That's why I whipped up this section of code, originally meant for my own in-development mods!
Code:
if _G.charSelectExists and SM64COOPDX_VERSION then
local curVers = _G.charSelect.version_get();
if not tonumber(curVers) then -- if this cannot be simplified to a number, there's other strings in this
curVers = string.gsub(curVers, "[%a%s_()!?:,@#-]+", ""); -- removing all letters, spaces, and the chars in the [set]
curVers = curVers:gsub("%.", "X", 1):gsub("%.", ""):gsub("X", "."); -- removes all instances except the first decimal point
end
curVers = tonumber(curVers);
-- rest of your code here
end
This is useful when creating Character Select packs that are backwards-compatible as well! For example, if your character comes with a preset palette, versions below 1.8 will not support this. For my own code, I use this check:
Code:
if curVers >= 1.8 then -- if this version is 1.8 or later
_G.charSelect.character_add_palette_preset(E_MODEL_X, X_PALETTE); -- add the palette
end
Feel free to use, but do credit me for the code if possible! Would really appreciate it.