I was searching around trying to find a 7-segment digital counter implemented in lua and was surprised that no one else seems to have made one yet. I'm not counting the Jason Harper one from Missed Island because that required a mess of platforms, an enforcer shooting various switches, and custom textures. Using lua is so much cleaner. Since I wasn't able to find one, I've implemented one myself.
I played around a bit with the map geometry to get something that looks decent. I found that the digits looked best the two vertical segments on the right side are taller and the two segments on the left side shorter. The end result is that the bottom segments of the digit 2 and digit 9 look a little off but overall is better than the other configurations that I tried.
Counter viewed from front
The numbering I designated for the 7 segments is 1 & 2 for the two segments that comprise a digit 1, then went clockwise around for the rest. Distances in W.U. are shown along the bottom. Here is what the digits look like when using the lava texture set:
To create the 7 segments in a map editor requires something like the 6 polygons shown in the image below. Floor/ceiling heights are shown for each polygon. I found that in Weland, using a custom grid scale of 0.2 with 1/8 world size works best so that the grid size is effectively 0.025 W.U. Once textures & lighting have been assigned, the polygons can be compressed down so that they are each only 1 internal unit tall in the Y direction, so that the digital counter doesn't protrude very far into the wall.
If you're still having trouble grasping what the finished counter looks like, the isometric view below should help.
The last step is to specify in the lua script the 4 lines that make up the sides of the 7 segment display. It is also possible to specify which textures and lights are to be used for the on and off state. See the script files for more details.
The 00_Counter.lua script creates a single digit counter 0-9. 01_DotCounter.lua creates a counter with 1 segment that can be used for displaying decimal points. 03_MegaCounter.lua is used to manage multiple counters and dot_counters to effectively have a multi-digit counter.
Finally, to demonstrate a multi-digit counter in action, I created a calculator with 7-digit display. Not that having a calculator in a marathon map is all that useful, but it does serve to test the limits of what can be implemented with a lua digital counter. I used custom textures for the buttons (not the prettiest but who cares?). The calculator buttons are not actually switches but are activated by the lua script when it detects the detonation of a projectile in their polygon.
Feel free to leverage the scripts in your own maps. Counter.lua, DotCounter.lua, and MegaCounter.lua shouldn't require any modifications to be used and are configured from the main script. I commented the code pretty extensively, but ask questions if anything is unclear.