View Single Post
Old 2011-03-23, 06:45 PM   #9
Full Member
~Fang~'s Avatar
Join Date: 2011-03-15
Location: California, USA
Posts: 224
~Fang~ Ordinary Player -- showing a lot of promise

Originally Posted by Mephisto View Post
I have interest in this =D

explain it

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:
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.
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.
~Fang~ is offline   Reply With Quote