Jump to content

[Question] OAR range condition


Recommended Posts

Posted
2 hours ago, traison said:

This smells like code golf.

 

:D

 

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
Posted (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 by traison
Posted (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 by anjenthedog

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...