On Sun, 22 Jan 1995, Sean P. Mountcastle wrote: > > I am sorry for posting that lame question about variable > assignment. But now I have another question that I hope will > test your C Programming knowledge a bit more. > I have changed the levelling routine so that you can only > gain levels while with in your guild (well, any guild for that > matter). It seems to work the way intended when the character > does not meet the criterion for advancing. But if the character > is able to advance then it just swallows the command (as if the > player had just hit return). I have included the code so that > hopefully someone can spot my mistake. > Thanks in advance, for any help you could offer. > > --stuff deleted-- > if ((GET_CLASS(ch) == (CLASS_MAGIC_USER || CLASS_CLERIC || CLASS_DRUID)) > && (GET_REL(ch) == REL_NONE)) > { > can_level = FALSE; > send_to_char("You must declare a religion before the guild will allow you to advance any further.\r\n",ch); > } > else > can_level = TRUE; > return 1; > } ^ You're returning right here, and not getting any farther. You probably want to instead, return if they fail your checks along the way and dispense with that can_level variable, since if they make it passed all the checks, they obviously can. > > if ((can_level) && GET_LEVEL(ch) < LVL_HERO && > GET_EXP(ch) >= exp_needed(GET_CLASS(ch), GET_LEVEL(ch) + 1)) > { > while (GET_LEVEL(ch) < LVL_HERO && > GET_EXP(ch) >= exp_needed(GET_CLASS(ch), GET_LEVEL(ch) + 1)) > { > send_to_char("You rise a level!\r\n", ch); > GET_LEVEL(ch) += 1; > advance_level(ch); > is_altered = TRUE; > return 1; > } > } > else { > send_to_char("Sorry you are unable to gain levels at this time.\r\n",ch); > return 1; > } > } return 0; > }
This archive was generated by hypermail 2b30 : 12/07/00 PST