Today, Kyos ~Overlord~ spake to the list: > i need to convert the numbers on a stat to text..like 1 == "bad" const char * intel_text [] = { "brainless", /* 0: 0-2 */ "moronic", /* 1: 3-5 */ "stupid", /* 2: 6-8 */ "average", /* 3: 9-11 */ "above average", /* 4: 12-14 */ "smart", /* 5: 15-17 */ "genius", /* 6: 18-20 */ "omniscient" /* 7: ... */ }; #define INTEL_DESC(ch) intel_text[MIN(7, (GET_INT(ch) / 3))] Of course, if you have races, a better implementation is to make the descriptions relative to the person's chosen race. So, for an orc, an intelligence of 11 is borderline genius, but for an elf it's slightly below average. What you would probably do is keep (in your race table; or if your races are setup like classes, in a new table or a function) an integer value that represents the average intelligence of a race. Let's say that humans, since they almost always seem to be used as the "average" race in every game (why?), have an average intelligence of 10. Since our target is to have one description for every three numbers, we compare other values to this average using groups of three (thus, there's no real difference between an average intelligence of 9, 10, and 11, but a difference between 8 and 9, 11 and 12). If you're one group below the average, you're "below average," two groups below and you're "stupid," three groups below and you're "moronic." One group above the average, you're "above average"; two groups above and you're "smart;" three groups above and you're a "genius." If you're more than three groups above the average, then you're "omniscient." Although, really, no player of any race should get beyond genius, and extremely few should get genius. The implementation of this would look more like, const char * intel_text [] = { "moronic", /* -3 */ "stupid", /* -2 */ "below average", /* -1 */ "average", /* 0 */ "above average", /* 1 */ "smart", /* 2 */ "genius", /* 3 */ "omniscient" /* ... */ }; #define COMP_RACE_INTEL(_i, _r) \ MAX(0, MIN(7, ((_i) / 3 - race_table[(_r)].avg_int / 3) + 3)) #define INTEL_DESC(ch) \ (intel_text[COMP_RACE_INTEL(GET_INT(ch), GET_RACE(ch))]) I think making the textual descriptions relative to the race of the character is a good idea, so long as when (if) characters get an opportunity to review/modify their stats during creation you make it known that stats are *relative* to their race. Thus, a strong elf would be no match for a below average (in strength) giant. -dak +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST