balala wrote: ↑August 7th, 2020, 5:42 pm
Didn't follow closely everything posted in this topic, but here is it:
Still for just three colors.
Yeah, the idea was to eliminate all the hardcoded values from the code (like 3 as the number of colors, 100 as the upper limit of your "Range" variable, etc.) and make everything configurable just by editing the variables in the
[Variables] section. Like inputing the parameters to a program and let it run based on those parameters, without having to edit the code itself each time one of those parameters changed.
In other words, it wasn't necessarily about not having IfConditions per se, but about having the skin react automatically to the parameters and not needing subsequent editing of the code. It just happened that your IfConditions made used of hardcoded values (like -50; /50; R, G and B indexes in the form of 1, 2 and 3, that kind of things) so I mentioned them to make my idea easier to understand.
For example, in the code I posted
here, one can just change the variables and the skin will run accordingly, without needing code adjustments based on the new values of those variables - I hope I'm clear in my explanation and you understand what I wanted. In that code, you can add or remove any number of colors, change the upper limit of what is "Range" in your code (I named your "Range" as "Value" and in my code "Range" became the upper limit of "Value", as it made more sense from a logical point of view) and no modification in the measures or meters is required.
I really don't know how to call this concept. Parametrization, or
softcoding, maybe (that wiki article is a bit questionable though, as it implies softcoding to be a bad practice towards the end of it, just because some incompetent folks in some software companies can't code their products to avoid the increased maintenence due to softcoding - pfff).