15 Jul, 2011, triskaledia wrote in the 1st comment:
Votes: 0
I wanted to make it so that a mobs vnum would display after their long description, but I get an error message.
if((pMobIndex = get_mob_index (victim)) != NULL);
{

if (IS_IMMORTAL(ch) && IS_SET(ch->act, PLR_HOLYLIGHT) && IS_NPC (victim))
{
sprintf (message, " <%d>", pMobIndex->vnum);
strcat (buf, message);
}
}
act_info.c: In function 'show_char_to_char_0':
act_info.c:467: warning: passing argument 1 of 'get_mob_index' makes integer from pointer without a cast.
Not sure what I did wrong. I'm assuming something simple.
15 Jul, 2011, Zeno wrote in the 2nd comment:
Votes: 0
Can you show the prototype for get_mob_index?
15 Jul, 2011, Sharmair wrote in the 3rd comment:
Votes: 0
the function get_mob_index takes a vnum and returns a pointer to the mob
prototype if it exists. As you already have a pointer to a character, you can
just look at victim->pIndexData to get the index (or NULL for players):
if(victim->pIndexData && IS_IMMORTAL(ch) && IS_SET(ch->act, PLR_HOLYLIGHT)){
sprintf(message, " <%d>", victim->pIndexData->vnum);
strcat(buf, message);
}

You could just use the line you had with IS_NPC and it should work in most
cases (of code setup), but IS_NPC just checks the isnpc act flag and does
not explicitly check if a pIndexData exists.

Your code would probably have worked if you just removed that first if line,
as it just has a NULL statement (is followed by just a ;) and really does nothing.

Edit to clearify: Your first if statement does set your index variable and if you
did just remove that line, you would change your sprintf to use victim->pIndexData.
16 Jul, 2011, triskaledia wrote in the 4th comment:
Votes: 0
Appreciate the help. I ended up figuring out a working way to do what I was looking for.
if (victim->position == victim->start_pos
&& victim->long_descr[0] != '\0')
{
if(victim->pIndexData && IS_IMMORTAL(ch) && IS_SET(ch->act, PLR_HOLYLIGHT))
{
sprintf(buf2, "{W<{C%d{W>{x %s", victim->pIndexData->vnum, victim->long_descr);
strcat(buf, buf2);
stc(buf, ch);
return;
}
else
{
strcat (buf, victim->long_descr);
send_to_char (buf, ch);
return;
}
}

Now I'll be able to see those 'hidden' mobs with no long description that builders use to run programs. Should also make editing mobs easier to so you dont have to look up the vnum.

Edit by kiasyn: code tags
16 Jul, 2011, triskaledia wrote in the 5th comment:
Votes: 0
Also, get_mob_index wasn't needed - as a lesser coder, I was copying a 'snippet' a fellow coder dropped in for us to display object vnums. Obviously mobs and objects run to different ways.
0.0/5