Re: NEWBIE: spec_proc problems...

From: Johan Dustler (epkjodu@hmepks1.ericsson.se)
Date: 05/14/96


> From: zero@baker.cnw.com
> 
> 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);

You don't need the "static char" and "half_chop()" lines in this function.

>   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;
>   }


Add the half_chop() function call here instead.


>   if (!*arg) {
>     send_to_char("Please specify a class.\r\n", ch);
>     return 1;

-- a heap of text removed --

> 
> 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 :)
>

The change in do_level is not necessary, but the two statements
are of no use.

Hope this helps.

-Johan



This archive was generated by hypermail 2b30 : 12/18/00 PST