Need help understanding this.

Posts 18 of 8 · Page 1 of 1
Need help understanding this.
I'm at a level below beginner, I'm not even sure what code language this is, please move me to the right sub-forum if I get this wrong, but I need help understanding

these two lines of code.

DamageReductions[it].PercentageReduction*2.0*(DamageReductions[it].PercentageReduction<0?NEGATIVE_EQUIPMENT_STAT_WEI GHT:1.0); //120


StatModifiers[it]*9.0*(StatModifiers[it]<0?NEGATIVE_EQUIPMENT_STAT_WEIGHT:1.0); //300

I don't understand what the //120 and the //300 at the end are for. Nor negative_equipment_stat_weight:1.0

I'd appreciate it if someone could explain both lines in full detail. (or somewhat near it)
The Conditional (or Ternary) Operator (? - C++ Articles

Code:
(expression 1) ? expression 2 : expression 3
If expression 1 evaluates to true, then expression 2 is evaluated.

If expression 1 evaluates to false, then expression 3 is evaluated instead.
In this case:
StatModifiers[it]*9.0*(StatModifiers[it]<0?NEGATIVE_EQUIPMENT_STAT_WEIGHT:1.0);

So if StatModifiers[it] is less than 0, use the NEGATIVE_EQUIPMENT_STAT_WEIGHT value and mutliply it with the other values. If StatModifiers[it] is bigger than or equal to 0, use 1.0 and multiply it with the other values.

As for the // 120 and //300, I got no idea. Doesn't tell me anything.
Oh you're from Melbourne too . Happy 9.45pm.

Also, can you explain what this means - (StatModifiers[it]<0?NEGATIVE_EQUIPMENT_STAT_WEIGHT:1.0)

I'm trying to figure out (or get someone else to) a quality/rating system of items.

What I'm trying to find is how to get to this number - 863.6

With that equation, and a positive value of 1146.
And a negative value of 191.

The part I truly don't understand is how to get from 1146 and 191 to 863.6. Someone has told me that negative values are 1.4 more than positives.
So 1146 - 191 is 955, which is clearly not 863.6
But if I take what they told me that negatives are 1.4 more? - 1146 - 286.5, which is 859.5
Still not 863.6.

If I work backwards from 1146 and 863.6. The value of multiplying is 1.4785, but I don't see how that fits into the script there, Am I missing something? Or just not understanding it.

EDIT: After searching for awhile i found this - NEGATIVE_EQUIPMENT_STAT_WEIGHT = 1.4;

But, if that is correct, how is the other one wrong. I did not find the value 863.6, so the only conclusion I can draw is that they lied?
Sorry for this being so long, I've tried to put spaces so it doesn't look as long

EDIT AGAIN: If it's alright with you, can you give me your msn so I don't have to have such long posts? (It's alright if you say no, I actually do realize how much of a burden and stupid I am )
Quote Originally Posted by OwnageMoreDE View Post
Oh you're from Melbourne too . Happy 9.45pm.

Also, can you explain what this means - (StatModifiers[it]<0?NEGATIVE_EQUIPMENT_STAT_WEIGHT:1.0)
I explained this before:
Quote Originally Posted by master131
In this case:
StatModifiers[it]*9.0*(StatModifiers[it]<0?NEGATIVE_EQUIPMENT_STAT_WEIGHT:1.0);

So if StatModifiers[it] is less than 0, use the NEGATIVE_EQUIPMENT_STAT_WEIGHT value and mutliply it with the other values. If StatModifiers[it] is bigger than or equal to 0, use 1.0 and multiply it with the other values.
Quote Originally Posted by OwnageMoreDE
What I'm trying to find is how to get to this number - 863.6
Sorry, no idea. Not really sure what you're trying to achieve.
Quote Originally Posted by master131 View Post


I explained this before:




Sorry, no idea. Not really sure what you're trying to achieve.
Thanks for helping, Just trying to figure out a games quality rating system.

And I wrote in the post, I have no idea what language it is.

Does DamageReductions refer to another line in the code? Should I go search for this?
And btw, we can't tell what language that is because it could really be anything. You should provide more source. This could be C++ or C# or phyton or ruby or php, I have no idea.
let me try to explain:

DamageReductions : avariable. probably type of someclass array

[in]: the array index.

.PercentageReduction : a member in the class

*2.0 : multiplied by 2.0

*(DamageReductions[it].PercentageReduction<0?NEGATIVE_EQUIPMENT_STAT_WEI GHT:1.0) : multiplied by NEGATIVE_EQUIPMENT_STAT_WEIGHT if the condition DamageReductions[it].PercentageReduction<0 is true or by 1.0 if it is false.

; : end of the line

//120 : a comment by the coder

the second line is almost the same. but the variable StatModifiers type is something numberic array this time (could be float array for example)
You should learn first how programming works, dont you think?

DamageReduction as giniyat101 said, its an array. (If you dont know what an array is, you are doing everything wrong)
Posts 18 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?