Quote:
Originally Posted by Mephisto
I have interest in this =D
explain it 
|
mk
Well, a byte is only capable of storing integers between 0 and 255. It doesn't hold decimals. Let's say that TQ is coding an NPC that reads the character's class. Well, Ninjas are 50-55. Instead of making multiple cases, i'd use something like:
Code:
if ((Character.Class / 10) * 10 == 50)
Now let's say that you're a NinjaMaster (55). Well, it would go something like this... let's break it down.
Code:
byte Test = (Character.Class / 10) * 10;
Character.Class divided by 10 is 5.5... but bytes cannot hold decimals nor can
they round, so it equals 5. Then, it's multiplied by 10 to give 50.
The formula returns the base class.