ID:2065316
 
im basically trying to trim down some code and was wondering if doing this would work in checking if blood or blood off were a thing before it adds stats because before it was doing a check for each thing like if(blood) if(!blood) etc so i wanted to condenese it using a or statement and just wanted to kno if it would work
if(killer.bloodlineactivated||!killer.bloodlineactivated)




That's saying...
If Killer's bloodlineactivated is TRUE - OR - If Killer's bloodlineactivated is NOT TRUE.

Logically, it's not what you're looking for.

Try to translate the code into a sentence instead of letters and numbers, it'll make much more sense.

You might be looking for switch() instead.
switch(E)
if(A1,A2,...) Statement1
if(B1,B2,...) Statement1
else Statement3

/*
The switch instruction is MUCH more efficient than a lengthy "else-if" chain,
because the expression E is evaluated only once. The conditional values may
be any constant expression, such as a number or text string.
*/


Although, I'm not sure I understand. If you're using boolean values for your variables, you only have to check for 'either' TRUE or FALSE. If you're not using boolean variables, you should be using switch() instead of lengthy and complex if()+else statements (unless you're looking for a range of values).
If you're checking a bunch of variables for TRUE or FALSE, you technically could condense it and place the variables in a list and just loop through to check if any of the variables come back TRUE or FALSE.
hmm the list idea sounds interesting how would i do that?
It's not really clear at this point what you're looking to do. What's your goal in this code?
I think you were on the right logical train, you were just trying to do too much on one line with your thought process.

It sounds like you are trying to do one thing when a value is true, but another when a value is false.

That's the basic premise behind an if-else chain. Switches are more complex and tend to be used for a range of values with a range of behaviors.

I tend to use switch statements a lot when writing parsers.

For instance, my Dragon Warrior project, I wrote a parser to display messages one character at a time. Some characters could actually be one character at display time, but many in the string.

It sounds to me like the switch isn't what you are looking for, but rather a simple if-else pattern:

if(killer.bloodlineactivated)
//do the thing
else
//do the other thing
the way its coded was there were alot of variables for checking if each thing was on or not and to add stats to the player which i found pointless since it was alot of duplicated code when i could've just did one if statement for all of them and added the stats below it if any of them were that
I'm still not sure what you want. Not to get all grammar Nazi on you here, but sentences would help a lot. You're not making any effort to be clear. This isn't the first thread, or even the tenth, like that either. This isn't Twitter, so you have the freedom of space to stretch out an explanation and break it down as clearly as possible; and it isn't live, so you have the time to make posts clear as well.

The clearer your posts are, the better help you'll get. Right now all we can do is guess blindly, and it just means it takes longer for you to get a good answer.
In response to Lummox JR
I believe they are saying they have a multitude of variables they need to check whether it's True or False, and then make other variables greater depending on that. So, imagine like 20 different "statistics" variables for a character, and then a few more "physical characteristic" variables like health, magic, stamina, etc.

They basically want to go through every single statistics variable to check if it's active or not, and then increase the physical characteristic variables accordingly. But not in the sense of using 'or' or 'and'. Just cycle through all possible "multipliers" and add them accordingly.
In response to Maximus_Alex2003
That's just a headache to work with. If that's the case, he should get rid of all of those unnecessary variables and merge together as many as possible. This is exactly why it is recommended to use variables wisely, not liberally.