Re: [CODE] SpecProcs

From: Sammy (samedi@DHC.NET)
Date: 06/08/98


On Mon, 8 Jun 1998, Quinn ShadowStalker wrote:

> Ok my friend wrote a specproc but he didnt make it into a
> SPECAL(blah_blah)  here is how he put it.
>
> void slash_materia(struct char_data * tech)
> {
>         int ii, jj;
>     struct obj_data *temp_obj;
>
>     jj = 0;
>         for (ii = 0; ii < NUM_WEARS; ii++)
>         {
>                 temp_obj = GET_EQ(tech, ii);
>                 if (temp_obj)
>                 if (GET_OBJ_VNUM(temp_obj) == SLASH_MATERIA)
>                         {
>                                 jj = 1;
>                                 break;
>                         }
>         }
>
>
> Now how would I change this into a normal specproc?

Oh!  Easy one!

SPECIAL(slash_materia)
{
        int ii, jj;
    struct obj_data *temp_obj;

    jj = 0;
        for (ii = 0; ii < NUM_WEARS; ii++)
        {
                temp_obj = GET_EQ(me, ii);
                if (temp_obj)
                if (GET_OBJ_VNUM(temp_obj) == SLASH_MATERIA)
                        {
                                jj = 1;
                                break;
                        }
        }

There ya go.  Easily converted from....something...to a spec_proc (note
braces mismatched for backward compatibility).  Also note that you now
have to return an int.  That'll go at the end of the function (assuming
there is an end).

ObCircle:

Ascii pfiles 98 beta release date June 14th, or the next version's free!

Sam


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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