~sapidlib-dev/sapidlib/message_class

Viewing all changes in revision 52.

  • Committer: Joseph von Arx
  • Date: 2008-02-05 20:17:13 UTC
  • Revision ID: aishiteru@charter.net-20080205201713-w05wcnzwyejrvw57
Modified receive_message() in mobile.c to reference msg_colours.h for the appropriate
color and starting text.

For example:
  message( "success", "message\n", this_player() ); will now show this:
    [%^GREEN%^BOLD%^SUCCESS%^RESET%^]: message\n

In the msg_colours.h I defined the message class "success" to put the header in front
of the actual message.  This is not nessesary.  Instead, you can just put the pinkfish
tag of the desired color to colorize the message.

One problem with this system of using color tags is if I define the message class "talk"
to be "%^CYAN%^" and do:

message( "talk", "Hello everyone.  I am %^RED%^Happy%^RESET%^ to see you!", this_player() );

Then, the message class "talk" will make the "Hello everyone.  I am" to show up as cyan
"Happy" will be red and the "to see you!" will be white (because of the RESET).

The workaround to this is to have the following in the code:

    msg = replace_string(msg, "%^RESET%^", col);



and put it above this:
    msg = col + msg + "%^RESET%^";

The only problem this causes is with the first example of using a header text:
    [%^GREEN%^BOLD%^SUCCESS%^RESET%^]:
Then the header text would be written with every %^RESET%^ that is found.
This is bad so using headers should either be discouraged or simply done differently.

An example:
    message( "success", "", this_player() );
    message( "text", "You have successfully....\n", this_player() );

Another example:
    change the replace_string() that we added to a different standardized color tag such
    as %^NOR%^. *shrugs*

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: