~sapidlib-dev/sapidlib/message_class

  • 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*
Filename Latest Rev Last Changed Committer Comment Size
..
bin 1 17 years ago Cody A.W. Somerville Initial Import. Diff
etc 1 17 years ago Cody A.W. Somerville Initial Import. Diff
lib 1 17 years ago Cody A.W. Somerville Initial Import. Diff
source 1 17 years ago Cody A.W. Somerville Initial Import. Diff
.bzrignore 27 16 years ago Cody A.W. Somerville * Added lib/adm/etc/new_install so that nightly b 136 bytes Diff Download File
COPYRIGHT 40 16 years ago Richard Harrison Upper-cased the filenames LICENSE and COPYRIGHT. 1.5 KB Diff Download File
LICENSE 40 16 years ago Richard Harrison Upper-cased the filenames LICENSE and COPYRIGHT. 10.1 KB Diff Download File
README 22 16 years ago Cody A.W. Somerville * Updated license to Open Software License 3.0 * 1.2 KB Diff Download File
RELEASE_NOTES 1 17 years ago Cody A.W. Somerville Initial Import. 5.1 KB Diff Download File