Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I'm trying to figure out format strings, specifically to get a slider to show its max value. Is %v what I want, and if so how do I use it? Or is this even possible without additional scripting?

(2 edits) (+1)

You can find documentation for format strings in Lil, The Formatting Language.

The format string of a slider widget is only given its value, which would usually be displayed as an integer (%i) or a floating-point number (%f); the rest of the string could, for example, provide units, like "%f degrees". In this way you *could* hardcode a maximum into the format string, like "%i/20" for an integer between 1 and 20 to be displayed like "7/20".

Extending the current behavior of sliders to make min/max and possibly other attributes of the widget available for formatting could be an interesting feature; I'll mull it over. For now, including that sort of information would require scripting. If you need this functionality in more than one place, perhaps you could use The Enum Contraption as a starting point?

(+1)

Okay, thanks. The description of the "v" pattern type in the Lil docs made me think I could maybe insert any variable using just format strings. It's not too bad to just hardcode it and update it with a script whenever I change the max, though.