newbie coloring question

Posted by Devbmx on Tue 16 Mar 2004 08:51 AM — 50 posts, 153,451 views.

#0
ok i have a very newbie question IMHO. I want to add color to everything ie. You say, hello. i want to have "you say." dark blue and "hello." to be light blue, how would i do this? And sorry if this is answered anywhere i tried searching but didnt find anything like this.
Canada #1
If you want multiple colors in the same string, the easiest way to do this is to edit do_say in act_comm.c, find the part that says "you say", and add the color codes in manually.
#2
allright how should i edit it? i tried to do it like this (very new to this so sorry of if i sound like an idiot) "you say, AT_DBLUE '$T' AT_LBLUE" i dunno if thats how you meant on put it directly into the code but that didnt work
USA #3
Something more like

at_dblue "you say, " at_lblue "hello"
(yes, yes, I ignored caps for the color codes)
#4
still no dice on it, i tried it exactly like you said and its still showing up all that on ugly stock color =\
USA #5
Simply adding the color tags won't do anything if your print function doesn't support color. There are a few other threads along similar lines you might want to read up on if you're serious about doing this.
#6
allright i really feel incredably stupid on this, but i have no idea what you mean and ive tried searching the forums for colors but nothing was like what i needed, and ive been searching for snippets all day and still nothin on it.
Canada #7
Are you getting compilation errors with it? Is it rebooting properly after you compile?
#8
as far as i know of its working, i see alot of bugs on fread something when i reboot
Canada #9
Your not getting any errors while compiling? You can also paste your code here, and we will take a look.
USA #10
A quick search for send_to_char found this forum which is one of the ones I was specificly refering to for color support in what youre trying to send to the characters.

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3416
#11
i did what it said in that post and what you said and still nothing. Maybe its cuz i dunno exactly what he did, he talks about how he didnt see the "else" and i dunno wtf that is but i commenteed everything out that he shows he did
Canada #12
You mention on another post that you can't get cygwin to compile. After you are changing your .c files, are you compiling these changes into a new executable file? If you are not compiling, or if the compiling fails, then you will not see any changes.
#13
no i cant even get cygwin to install, 9 out of 10 times the setup program locks up, and when i do get to install it, it somehow takes up around 900mb while installing, and ive deleated just about everything on my computer i can to make room for it, and when i was able to use VC++ to compile i had TONS of errors but i think thats cuz i went in and tried to do what i thought i needed to, and it wasant so if/when i can get cygwin to DL im gonna try fuss
Australia Forum Administrator #14
The source on this site should compile under Visual Studio with little problems.

Cygwin *does* take a lot of disk to install, however these days hard disks are cheap. Perhaps upgrade your disk, or add a second one?
#15
i really wana get fuss since it has all the fixes on it and on your site it looks like all of them are for cygwin/unix only which is why ive been trying to dl cygwin, and it says on your site ygwin should only take at the max 500-600 mb, but i lose 900mb
Australia Forum Administrator #16
Looks like the FUSS source has the Win32 stuff in it, so it may well compile under Visual C++, but I haven't tried recently.
#17
how do i get the fuss source? i tried downloading the smaug.1.4a.gz and uncompressed it with pico and was just a file that i couldnt open with anything that i have
USA #18
Try using winzip.
#19
winzip wont unzip it
USA #20
Under a Unix-like environment, type:
tar -xzf smaug[whateverit'scalled]

Looks like you'll need Cygwin. Just follow Nick's instructions (on the download page) to the letter and you should have no trouble. Don't make any "creative additions", just follow them exactly and it'll all work.
Amended on Thu 18 Mar 2004 01:45 AM by David Haley
#21
i did follow them EXACTLY and even unselected the ones werent in the one nick had but came automaticly selected in the one i had
USA #22
It's worked for plenty of people before you. If it didn't work for you, you must have done something wrong, somewhere. :)
#23
i stick to the fact that my computer is a POS, im sure the cygwin installer worked first try for everyone else besides me as well, but it doesnt for me like i said it very rarely works for me and when it does it runs out of memory before its even done
USA #24
It should be noted that I have no means to verify if it will still compile under VC++ but if it did stock, there's nothing major enough that should choke it now unless it doesn't like the new color system.
USA #25
For starters, the smaug downloads available here are tgz files - meaning you cannot simply untar or ungzip and expect to make sense of the files, you *must* do both. This also changes the switch used in a *nix environment since you need to add the ungzip flag (-xvzf I believe it is to unpack a tgz properly). Winzip *can* handle tgz files but you have to stop winblows from changing the file extension when you download.
#26
ok i got everything running on cygwin on another computer on my LAN, now im still haveing troubls with the color, and i am having errors while compiling which are
act_comm.c in function 'do_say'
act_comm.c:937:error:syntax error before string constant

and the code was
act( AT_SAY, AT_BLUE "You say AT_LBLUE '$T'", ch, NULL, drunk_speech( argument, ch ), TO_CHAR );
i dunno what im doing wrong, im still trying to find things online to teach myself c so i can stop bugging you guys about what im sure is an EXTREMLY easy thing to do. I did everything in the post you had shown me but in smaugfuss there doesnt apear to be the same send_to_char as in the other smaug i had used before which DID have that so i didnt comment anything out, perhaps that is a problem as well?
Amended on Fri 19 Mar 2004 06:12 AM by Devbmx
Canada #27
Well, so you know for reference, that a function(like act) can only accept as many inputs as is specified in the function code, so you can't just add in other data. Try this instead:
act( AT_BLUE, "You say '$T'", ch, NULL, drunk_speech( argument, ch ), TO_CHAR ); 


I think thats what you were trying to do, make all the text blue? If you really wanted to, you could:
act(  AT_BLUE, "&RY&Co&Ru &Cs&Ra&Cy &R'&C$T&R'", ch, NULL, drunk_speech( argument, ch ), TO_CHAR );
Now, that will look really, really ugly, and give you far less functionality, but sometimes it worth it to make it look as you want.
Amended on Fri 19 Mar 2004 06:42 AM by Greven
#28
kind of, i actually wanted the "you say." to be blue and what your saying to be light blue
and when i try to compile with the code you gave me i still get the same error along with
make[1] *** [act_comm.o]error 1
Amended on Fri 19 Mar 2004 06:37 AM by Devbmx
Canada #29
Pardon me, I have amended the post, I forgot a comma. If you just want that, try this:
act( AT_BLUE, "You say '&C$T&D'", ch, NULL, drunk_speech( argument, ch ), TO_CHAR ); 


That should do 'er.
Amended on Fri 19 Mar 2004 06:45 AM by Greven
#30
if you dont mind asking me what does the &c and &D do? for future refrence on other color changes
also the code didnt work, my color is still coming up all blue
Amended on Fri 19 Mar 2004 06:54 AM by Devbmx
Canada #31
Are you rebooting your mud after you made the change? If that code is there, and you compiled cleanly, and you rebooted, the color should have changed. The &C is a color code that is used in smaug. Its like using that in your title or something in the mud, same effect. The &D reverts is only for Samson's color stuff, it reverts to the standard set color on that character.
#32
yep just rebooted it and its all just blue instead of thw two colors
Canada #33
K, lets double check, what code in say are you use? Are you using it in all conditions? Did you compile after you saved the change? Did the compile work? Did you reboot?

Cause that makes no sense, if you hard coded colors in, they should change.
#34
allright i used the last code you gave me, the you AT_BLUE, "you say &C%T&D" one and it compiled fine except for an error that always comes up but has nothin to do with the colors, and i did reboot, twice
Canada #35
Whats the error? if its not generating a new file, then depending on your makefile, you might just be loading off of the old one every time. If you can paste the entier process from when you enter make to when it finishes I can probable be sure.
#36
i dunno where to get logs of the make process but i can tell you it has to do with chmod saying something about smaug not being a directory
Canada #37
If your using cygwin, then you can get the logs by copying out of the window. Click the icon on the top left corner of the prompt window, go to edit, and select mark. Then select the text like you would in any other window application, and hit enter to copy it. A make clean migth reveal all the problems.
Australia Forum Administrator #38
In Cygwin the chmod line isn't all that important. In the cygwin makefile it is actually changed to smaug.exe not smaug, like this:


ifdef CYGWIN
smaug: $(O_FILES)
        rm -f smaug.exe
        $(CC) -o smaug.exe $(O_FILES) $(L_FLAGS)
        chmod g+w smaug.exe
        chmod a+x smaug.exe
        chmod g+w $(O_FILES)

clean:
        rm -f *.o smaug.exe *~
else

#39
yea the error line was
chmod g+w smaug
chmod: changing permissions of `smaug': No such file or directory
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/home/Default/smaugfuss/src'
make: *** [all] Error 2
[1]+ Done tcsh startup

which doesnt seem to affect act_comm.c at all
Amended on Fri 19 Mar 2004 09:28 PM by Devbmx
USA #40
You're right in saying it doesn't affect the files in question but the reason why is the problem with you not seeing any code changes - your new executable is never created so you're just using the old file over and over and over again. Change the filename in the makefile to smaug.exe and recompile, then come back and tell us what problems you have with the code - if any.
#41
allright did all the recompiled and the colors still havent changed
USA #42
OK, now that you have everything compiling properly and the new exe actually being created, post us the actual code you're using again if you'd be so kind. I suspect I know the problem but until I see the codeblock I can't be certain. I may also have to do some research into how SMAUG handles colorized output to confirm my theory :(
#43
act( AT_SAY, "$n says '$T'", ch, NULL, argument, TO_ROOM );*/
ch->act = actflags;
MOBtrigger = FALSE;
act( AT_BLUE, "You say '&C$T&D'", ch, NULL, drunk_speech( argument, ch ),
TO_CHAR );
if ( IS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )
{
sprintf( buf, "%s: %s", IS_NPC( ch ) ? ch->short_descr : ch->name,
argument );
append_to_file( LOG_FILE, buf );
}
mprog_speech_trigger( argument, ch );
if ( char_died(ch) )
return;
oprog_speech_trigger( argument, ch );
if ( char_died(ch) )


im not sure if thats all you needed or if you needed more =\
Canada #44
That should work, I don't see any problems with it. If you want to be sure that your creating a new executable, and not just using the old one again, you can delete your current .exe manually, and then when you compile, if everything works out, it will regenerate your executable.
#45
nope still nothin its all still just one color
USA #46
Look up the TO_ROOM code and see if it parses for color codes or not, Im not sure. As for the TO_CHAR, try to TO_CHAR_COLOR instead, I dont believe the TO_CHAR function parses for color codes.
#47
allrigth i tried that and got an error upon compiling
act_comm.c: In function `do_say':
act_comm.c:958: error: `TO_CHAR_COLOR' undeclared (first use in this function)
act_comm.c:958: error: (Each undeclared identifier is reported only once
act_comm.c:958: error: for each function it appears in.)
make[1]: *** [act_comm.o] Error 1
make[1]: Leaving directory `/home/Default/smaugfuss/src'
make: *** [all] Error 2
Canada #48
Well, I downloaded smaugfuss, and did this test, to no avail. While I changed it to ACT_SAY instead of ACT_BLUE, to allow the color command to work, it would not accept me putting colors into anything, even from within the game. It looks to me as if the color code is going bad, specifically here:
   bool ansi = FALSE;
   char *sympos = NULL;

   /* No descriptor, assume ANSI conversion can't be done. */
   if( !d )
      ansi = FALSE;
   /* But, if we have one, check for a PC and set accordingly. If no PC, assume ANSI can be done. For color logins. */
   else
   {
      ch = d->original ? d->original : d->character;
      if( ch )
         ansi = ( xIS_SET( ch->act, PLR_ANSI ) );
      else
         ansi = TRUE;
   }
Seems that ansi is being set to false, but my crappy computer keeps bailing out on me, and crashing cygwin, so maybe someone can help from there?
#49
has anyone been able to figure it out?