This is what I've done:
I've added a function; int exp_to_level(struct char_data *ch);
For what you need, you might not need to pass the entire character structure, but my system is relatively complex. You might be able to just pass an int for (GET_LEVEL(ch) and GET_RACE(ch)).
Here, you would do something like:
Code:
int exp_for_level(int ch_level, int ch_race) {
int base = (put in your base value, or pick it from a struct);
int expforlevel = 0;
ch_level++; // make sure you're checking exp to level for next level
expforlevel = (ch_level * base * (ch_level + 5) + (ch_level * 125 * racemultiplier[ch_race]));
return (expforlevel);
}
Now all you have to do from here on in, is anytime you want the value, is run that function and and it will tell you. You can go one step further, and take the expforlevel and have Your players current exp banked against it (which is what i do), so calculation = expforlevel - GET_EXP(ch) (this would require you to pass more of the character structure through the function though).
I hope this helps, let me know if you need any further clarification. After all it is like 8AM here, heh.