Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Color
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Fri 17 Jan 2003 01:11 AM (UTC) |
| Message
| | I've seen this question sorta asked before, but the answer didn't help me. The faq says to change send_to_char to send_to_char_color or whatever. Here's my problem-I want have it add color to who, but its sprintf not send_to_char. And I also want to be able to use colors in room desc. Anyone help? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Boborak
USA (228 posts) Bio
|
| Date
| Reply #1 on Fri 17 Jan 2003 01:30 AM (UTC) |
| Message
| do something like this..
declare this at the top of the function.
char buf[MAX_STRING_LENGTH];
then wherever you want color in the function, do something like this:
sprintf(buf, "This name be colored bright RED: &R%s", ch->name);
send_to_char(buf, ch);
Understand? If you need more clarification, post it ;-)
p.s. this assumes you have made teh necessary changes to colorize EVERYTHING sent to send_to_char otherwise, use send_to_char_color(buf, ch); | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #2 on Fri 17 Jan 2003 02:19 AM (UTC) |
| Message
| I tried that. The rank is now replaced with
''' |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Boborak
USA (228 posts) Bio
|
| Date
| Reply #3 on Fri 17 Jan 2003 05:32 AM (UTC) |
| Message
| | Hmm Maybe you could post a bit of your code so we can check it out. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #4 on Fri 17 Jan 2003 11:16 PM (UTC) |
| Message
| {
char buf[MAX_STRING_LENGTH];
(Other code stuff)
sprintf(buf, class_text, "[&R%s &Y%s ]", NOT_AUTHED(wch) ? "N" : "", class_table[wch->class]->who_name );
send_to_char_color(buf, ch); |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Boborak
USA (228 posts) Bio
|
| Date
| Reply #5 on Sat 18 Jan 2003 01:07 AM (UTC) |
| Message
| What exactly is class_text? Unless there's an alternate way to using sprintf() that I've never seen (which I don't believe), I would say that you need to remove the 'class_text' var from your sprintf statement, or if you want to *display* class_text too, change it like so:
sprintf(buf, "[%s &R%s &Y%s ]", class_text, NOT_AUTHED(wch) ? "N" : "", class_table[wch->class]->who_name );
Again, this depends on what the value of 'class_text' is, there's only a few instances I can think of, that would make this statement as you posted it, valid. | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #6 on Mon 20 Jan 2003 02:48 AM (UTC) |
| Message
|
Quote:
sprintf(buf, "[%s &R%s &Y%s ]", class_text, NOT_AUTHED(wch) ? "N" : "", class_table[wch->class]->who_name );
That statement can be better replaced by using ch_printf or ch_printf_color in this case. Like so:
ch_printf_color( ch, "[%s &R%s &Y%s ]", class_text, NOT_AUTHED(wch) ? "N" : "", class_table[wch->class]->who_name );
| | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #7 on Sat 25 Jan 2003 12:14 AM (UTC) |
| Message
| I did that, and now its odd.
65 Warrior
-----------------------------------[ IMMORTALS ]------------------------------
MUD owner (65) Zeno.
1 player.
See how it shows my status even though I'm an Immortal? Anyone help? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Boborak
USA (228 posts) Bio
|
| Date
| Reply #8 on Sat 25 Jan 2003 12:58 AM (UTC) |
| Message
| | Well you need to review your code a bit. Look for things that say IS_IMMORTAL(ch) or something similar. Perhaps you are missing one somewhere. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #9 on Sat 25 Jan 2003 07:26 PM (UTC) |
| Message
| All I did was change the original code to
ch_printf_color( ch, "&R%s%2d &G%s&W", NOT_AUTHED(wch) ? "N" : " ", wch->level, class_table[wch->class]->who_name );
on 1 line in do_who, and thats what it is now. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Boborak
USA (228 posts) Bio
|
| Date
| Reply #10 on Sat 25 Jan 2003 07:51 PM (UTC) |
| Message
| By 'status' I would assume you're talking about the line:
65 Warrior
That line is the result of the code you have posted. So, if it did not appear before you started modifing things, it is likely the result of your modifications. One thing you may want to look at, is when you changed 'sprintf' to 'ch_printf_color' you also needed to remove the 'send_to_char' that was right below that line. Negelecting to do so, could cause odd things to display. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #11 on Sun 26 Jan 2003 01:32 AM (UTC) Amended on Sun 26 Jan 2003 02:45 AM (UTC) by Zeno
|
| Message
| I did that before, there is no 'send_to_char' below it.
[EDIT]
I was told to get rid of that class stuff. Thats what screwed it up. So I changed it back to stock. Bah, is there any other way to allow colow everywhere? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
27,387 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top