I am attempting to write a spec_proc for having guildmasters let you gain levels. Note that i have correctly assigned the proc and gain_exp no longer automatically raises levels when you have enough exp. I created the command "level" and the follwoing spec_proc called "guild_levels". ACMD(do_level) { static char arg2[MAX_INPUT_LENGTH]; half_chop(argument, arg, arg2); send_to_char("You can only gain levels in a guild.\r\n", ch); } The command works fine but when level is typed at a guildmaster it always gets stuck at one part of the code and returns from there. I am assuming it is either the way i tried to handle 2 arguments or my misuse of is_abbrev. SPECIAL(guild_levels) { static char arg2[MAX_INPUT_LENGTH]; int class; if (IS_NPC(ch) || !CMD_IS("level")) return 0; if (GET_LEVEL(ch) >= LVL_IMMORT) { send_to_char("Your already an Immortal!!\r\n", ch); return 1; } if (!*arg) { send_to_char("Please specify a class.\r\n", ch); return 1; } else if (is_abbrev(arg, "mage")) { class = CLASS_MAGIC_USER; } else if (is_abbrev(arg, "cleric")) { class = CLASS_CLERIC; } else if (is_abbrev(arg, "thief")) { class = CLASS_THIEF; } else if (is_abbrev(arg, "warrior")) { class = CLASS_WARRIOR; } else if (is_abbrev(arg, "bard")) { class = CLASS_BARD; } else { send_to_char("usage: level <class> [gain]\r\n", ch); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ No matter what i type after level or even just level by itself i get this message. I changed the second occurence of this message to make sure this waswhere it gets stuck and it is. return 1; } if (!*arg2) { sprintf(buf, "You need %d experience points to reach the next level.\r\n", exp_for_level(GET_LEVELX(ch, class))); send_to_char(buf, ch); return 1; } else if (is_abbrev(arg2, "gain")) { if (GET_EXP(ch) >= exp_for_level(GET_LEVELX(ch, class))) { GET_LEVELX(ch, class) += 1; GET_EXP(ch) -= exp_for_level(GET_LEVELX(ch, class)); send_to_char("You rise a level!\r\n", ch); return 1; } else { send_to_char("You don't have enough experience yet.\r\n", ch); return 1; } } else { send_to_char("usage: level <class> [gain]\r\n", ch); return 1; } } In case it matters this is my exp_for_level function (remember this was just written so i could use the function and make the function realistic later) int exp_for_level(int level) { level += 1; level *= 1000; return level; } If someone can point out my error(s) i would appreciate it. Thanks, Chris (who always knows when he messed up, just not why it is wrong :)
This archive was generated by hypermail 2b30 : 12/18/00 PST