Welcome to the Builder Academy

Question Adding Color question

More
31 Jul 2025 22:12 #10841 by wlessard1
I added a new affect and I am trying to hopefully get it to go colorized.

In act_informative.c under list_to_char I am adding this in 


if (AFF_FLAGGED(i, AFF_RADIATION))
act("...$e glows with a " CCGRN(ch, C_NRM) "sickly green light" CCNRM(ch, C_NRM) "!", FALSE, i, 0, ch, TO_VICT);

Between aff_sanctuary and aff_blind.

I either get errors or if I take out the color enhancements it doesn't seem to work.

Any suggestions would be appreciated.

Please Log in or Create an account to join the conversation.

More
Yesterday 19:32 - Yesterday 19:33 #10842 by thomas
Replied by thomas on topic Adding Color question
Instead of building the string directly (which wont work since the CCGRN macro expands to some strange things), add them as strings in the format:
Code:
char tmpbuf[MAX_STRING_LENGTH]; snprintf(tmpbuf, sizeof(tmpbuf), "...$e glows with a %ssickly green light%s!", CCGRN(ch, C_NRM), CCNRM(ch, C_NRM)); act(tmpbuf, FALSE, i, 0, ch, TO_VICT);

Or use the shortcuts:
Code:
act("...$e glows with a \tGsickly green light\tn!", FALSE, i, 0, ch, TO_VICT);
the tab character functions as an escape char, due to the setup in protocol.h :  github.com/tbamud/tbamud/blob/f6339b495e.../src/protocol.h#L261
Last edit: Yesterday 19:33 by thomas. Reason: forgot a line
The following user(s) said Thank You: wlessard1

Please Log in or Create an account to join the conversation.

More
Yesterday 20:12 #10843 by JTP
Replied by JTP on topic Adding Color question
\tGsickly green light\tn


Works really well
The following user(s) said Thank You: wlessard1

Please Log in or Create an account to join the conversation.

More
Yesterday 20:51 #10844 by wlessard1
Replied by wlessard1 on topic Adding Color question
I see how that should work based on things like asciimap.c and how that is done for the mapping.

Thanks folks.

Please Log in or Create an account to join the conversation.

More
Yesterday 21:07 - Yesterday 21:08 #10845 by wlessard1
Replied by wlessard1 on topic Adding Color question
Okay, closer or at least it compiles.

This is the section I am working on, list_one_char, this is the section I am working on.
Code:
  if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) {     if (AFF_FLAGGED(i, AFF_INVISIBLE))       send_to_char(ch, "*");     if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN)) {       if (IS_EVIL(i)) send_to_char(ch, "(Red Aura) ");       else if (IS_GOOD(i)) send_to_char(ch, "(Blue Aura) ");     }     send_to_char(ch, "%s", i->player.long_descr);     if (AFF_FLAGGED(i, AFF_SANCTUARY))       act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT);    if (AFF_FLAGGED(i, AFF_BLIND) && GET_LEVEL(i) < LVL_IMMORT)       act("...$e is groping around blindly!", FALSE, i, 0, ch, TO_VICT);     if (AFF_FLAGGED(i, AFF_RADIATION))       act("...$e glows with a \tGsickly green light\tn!", FALSE, i, 0, ch, TO_VICT);    if (IS_NPC(i) && GET_MOB_SPEC(i) == questmaster)       send_to_char(ch, " (Multicolored Aura) ");     return;   }

The line for aff_radiation

Complies fine but no result when tested. Is there somewhere else I need to add something?

To be more clear, when I look I do not see the message at all. Even with the change.
Last edit: Yesterday 21:08 by wlessard1.

Please Log in or Create an account to join the conversation.

Time to create page: 0.178 seconds