Fraying9981 Posted November 9, 2025 Posted November 9, 2025 what's the easiest way to have a range condition for OAR? I see >= <= operators, but I would prefer to avoid doing ">= x AND < y" to define a range..
Fraying9981 Posted November 9, 2025 Author Posted November 9, 2025 2 hours ago, traison said: This smells like code golf. Here is what I mean: A BETWEEN-style function (e.g., value BETWEEN x AND y) as condition to trigger an animation (e.g. factionrank, health) Instead of having to write: "value >= x AND value < y" -> because this is TWO conditions if I'm correct
traison Posted November 9, 2025 Posted November 9, 2025 (edited) Well looking at the source code I can tell you it looks like it's possible, but it would require new conditions to be added for these range variants of existing conditions: FactionRank -> FactionRankRange OAR provides example plugins, and is open-source. Should be relatively easy to copy-paste the existing FactionRank implementation and extend it. Probably the biggest issue is getting it to compile. For some reason, humans are really bad at making compiling instructions for C++ projects; I can count the number of projects that have compiled without issues in the past 2 decades on one hand (I think there's been 2 of them). Edited November 9, 2025 by traison
anjenthedog Posted November 11, 2025 Posted November 11, 2025 (edited) Maybe I'm missing something, but Afaik and IME, you cant find too many programming environments (or similar) where a data range can be directly input as a logical condition. at some point, the baseline comparison has to be done, whether it's overt or hidden under the carpet. If you're concerned about the sometimes cross-eyed readability of long conditionals, you can use intermediary values to store partial tests then combine during the test ex: A = ( x >= N ) B = ( x < M) IF A AND B or condensing more C = (A AND B) IF C here I'm skipping any type casting some environments require for variable definition, in favor of read simplicity x is numeric input under test, N and M are your lower and upper numeric thresholds A, B, and C are implied booleans if I were concerned about clock ticks, I'd probably avoid using substitutions Edited November 11, 2025 by anjenthedog
anjenthedog Posted November 11, 2025 Posted November 11, 2025 for instance, in a control loop... if just handling statics, no problem.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now