Mprog ifcheck, check act flags

Posted by Zeno on Tue 29 Mar 2005 12:44 AM — 5 posts, 18,725 views.

USA #0
Is there a way for a prog ifcheck to check if a act flag is set on a player? Like I'd like it to be done like this:
if is_set($n) == boughtpet


This would save me a lot of time adding an ifcheck for each different flag.
Canada #1
There's not one that I know of, but its a fairly straight forward process to make it, loop through the names, str_cmp, stop at the right one, check that number against set flags.
USA #2
Well I have the basic concept down, but what do you mean loop through the names? Act flags are EXT_BV, so you can't strcmp a BV.
USA #3
I think he meant the name of the flag, which is then used to look up the BV. Anyways, I have one (an is_set mprog function) and it wasn't hard to make.
USA #4
Finally got to doing it.
        if ( !str_cmp(chck, "issetact") )
        {
            int value = IS_NPC( chkchar ) ? get_actflag( rval ) : get_plrflag( rval );

            if ( value < 0 || value > MAX_BITS )
            {
                progbug("Unknown act flag being checked", mob);
                return BERR;
             }

             return xIS_SET(chkchar->act, value) ? TRUE : FALSE;
        }


Feel free to use it or let me know if anything should be changed.