Going to try to tackle all of this in a logical order and without going on too long, but there's a good handful to cover.
At the most general level, if you see it working, it is accurate to say it is programmable - it just might not be nice to work with. As for what you can do in Lua, there are only a few things that you really can't do, though you do still have to get clever sometimes.
First off, regarding Stepmania versioning, you do seem to have things right. Here are the main relevant versions that I'll be mentioning:
- 3.9 (SMMAX theme)
- 3.95 and branches (real ITG and OpenITG)
- SM5 (4 branched as SSC, SSC officially became 5, the main point of SSC, as you mentioned, was originally a theme engine overhaul - 3.9+5 themes will not work and vice versa; introduced the new .ssc file format because there are new step types and other chart features that .sm and .dwi don't support)
I'm just going to work my way up the hierarchy of Stepmania hackery.
Without Lua, you get the following:
1. Chart Level
- Doubles as "Couples"
-> Pump Pro 2 (SM4-branched, IIRC? I don't remember) had proper engine support (Red/Blue per player) added. It may be possible to do the same in ITG with Lua and mods, but I don't know for sure.
- BPM tricks (double BPM with a short stop after each step to stutter, etc.)
-> Go fast enough and arrows appear to jump, since the game renders one frame every 16.6 milliseconds and they technically do "jump", you just can't see it until the arrows are really fast; mix with stops for more fun.
- Negative BPM Glitch (3.9+5 only; SM5 fixed the underlying bug)
-> If at the 60 second mark you flip to a negative BPM and 20 seconds "earlier afterward" (the editor will count time backwards as you scroll through measures) go back to the normal BPM, then 40 seconds in, the arrows on screen clear and it immediately thinks you're at the later 40 second mark, so it loads what would be on screen then and continues playing.
-> It more or less started with Monotune Respect (foonmix) back in the 3.9 days: https://youtu.be/b6nLOcpU4iQ?t=40s
-> SM's DDR scoring works fine, ITG scoring breaks (Monotune is AAAable, but a "quad" is about 76%, since the unused steps are simply 0's, equivalent to goods/decents)
2. Song Level
- BPM changes are constant across difficulties for a song, and technically should be listed here; SM5 may have or may not have or may in the future change to per-chart BPM stuff being allowed a la Pump
- BGAnimations supports placing graphics in the foreground that cover everything under them. There are charts like Sweet Doughnuts (Gay4Gimmix Again), Jayce's Still Alive, or the infamous Box (https://youtu.be/FCdx1bjGGRY) that do just cover the screen in something that tells you what to hit (as a conventional chart or otherwise), with the actual chart hidden underneath, others just use graphics to block the screen randomly (like Party Rock).
-> Full screen animations cover judgement, life bar, and score completely
- Mod scripts - you give a list of times to apply mods (turning them off is a matter of setting stuff back to normal).
-> I believe there's a non-Lua way to do this for a song, but am not 100% on that.
-> This is the way ITG courses do mods - the course definition supports mod scripting (the previous unknown is whether this exact format is available for songs as well)
-> The format translates to a very simple "at time X:XX, apply mod Y" with no way to do anything dependent on the current players nor any way to do something different to each player.
-> I know you can have arrows under different mods on screen if they're before/after the mod change, I don't know if you can set mods per-column or per-individual-arrow with a mod script.
-> Spergin2's Sweet Doughtnuts changes the chart (to left-right-left-right-...), but not the video overlay that displays the original G4G chart, so you have to know the pattern and when to start (and whether left or right) and get no judgment feedback.
-> Mod scripts support percentages, -50% mini makes the arrows bigger, various percentages (<50%) of reverse can be used to move the casings up and down without flipping the arrow direction, 10000% dizzy for a split second is a common flourish, etc.
Lua has been a core part of Stepmania for a long time, the engine overhaul for SM5 was basically a way to move more of the theme definition into Lua for simplicity, since theming via metrics.ini is kind of awkward and confusing even without a lot of Lua. The Lua execution environment offers access to anything the theme should need and more, regardless of what context Stepmania is trying to use Lua in, which is why the discovery that Lua can be called from within a song led to almost anything being fair game in OpenITG. For the most part, if you can do it without Lua, you probably can do it with Lua, too.
The rules of thumb on whether it takes Lua or not:
- Chart oddities and simple "display this image/video here" directives don't need Lua
- Unless they are dynamic somehow (selectively displaying an image, picking from a set conditionally, anything else that isn't always exactly the same)
- Everything else is probably Lua
Some actual Lua uses in game:
- Defining the flashing and display angle (ITG: great and lower are tilted) of judgement graphics in your theme's metrics.ini (and overriding it in song)
- Telling GAMEPREFSMAN that the Marvelous window (everything's DDR names internally still) is now 20 seconds wide
-> GAMEPREFSMAN persists changes, so this would actually stick, even across reboots
- WinDEU has used some combo of Lua and BGAnims to 3D render giant spinning ITG arrows that bounce around the screen as a foreground overlay
- Overriding your chart selection with a random pick for that song (the chart is actually immutable once picked, so you have to write Lua that edits it - which will apply on next load - and then exits/reenters the play screen, but it has been made to work)
- Scripting minigames into breaks between actual steps
-> Lose the minigame? You get random mods for awhile
-> WinDEU has a marathon where 1p plays a chart while 2p has to try to stop mods from being applied via various minigames as well as one where 1p plays a chart on a Taiko-style stripe at the top while 2p has to dodge TouHou-style bullet-hell by moving an unarmed character around the screen the whole time
- Alternate judgement graphics, including support for what seems to be a super-fantastic (displayed, not counted for scoring purposes): https://youtu.be/wBluMojRiO0
- Making the life bar, score, and any other standard objects spin, disappear, change colors, etc
- Among the many things in Party Rock ~bathtub mix~ is a text alert bar that goes very rarely used otherwise (certain operator actions trigger it IIRC) and "press GREEN to add even more crap": https://youtu.be/LnwnogQKfJw
- WinDEU has also managed to make a marathon jump to a Megaman-style stage select once started and between songs, so you can play the songs in any order you want before a final boss song. WinDEU has done a lot of things that Stepmania would rather not have had done to it, though.
I haven't seen Pi, but what you described sounds trivial from a non-graphics perspective at least - the score display is a function of the actual backing score, so removing it, then creating a separate one that plays by different rules (e.g. binary) should be easy in Lua. Translating bases is an absurdly common computer operation, so that should basically be a builtin in any language (and if not, it's dirt simple code). Having never done any SM Lua work beyond adding a little flicker to Chromatic's judgments (to differentiate steps, since the graphics don't move or bounce or anything).
Triggering sounds from Lua should also be reasonable (NOTE: have not seen Link or any that do it myself, so I'm just extrapolating from what I know), since there are already triggered sounds elsewhere in the engine (scrolling through the menu wheel, for example). There was a historical attempt to add full keysounding support, since 3.9 (and presumably later) could read .bms simfiles (beatmania charts) and remap them to 4/5/6/8/10 panel, it just wasn't able to play sounds on each key press a la most of the Bemani series.