Sending snprintf to one person


I’m working on modifying some code to add some additional features. It is related to emoting and using tokens for targeting users/items/etc. So far I’ve had some luck with updating it so that a user can target an item equipped, in inventory, or in the room. When it comes to targeting users, the echo that the room sees is the player name, no matter who it is.

I’d like that to change based on the victim’s perspective so that instead they see “you”. I’m unsure exactly whether this is possible with snprintf or not. Code example below:

            char_desc = GET_NAME(victim);
	snprintf (p, MAX_STRING_LENGTH,  "%s", char_desc);
	p += strlen(p);
        tochar = TRUE;

While the echo comes out alright, it isn’t personalized based on the perspective of the victim yet. Any thoughts on this or whether it is possible?




Not sure what codebase you’re using, but if it’s merc I’m pretty sure you can use PERS() instead of GET_NAME. Should be in merc.h