Wizhelp, colored commands

Posted by Dextermovies on Sun 18 Sep 2005 05:09 PM — 17 posts, 66,228 views.

#0
I found a wizhelp snippet, that adds color to the commands. It is for afk, but I figure with some tweaking I whould be able to use it. THe snippet can be found at http://mindcloud.com/modules/Downloads/files/wizhcolor.txt#dl
I am running fedora core 4, and I am to mud programming.
Here is the issue I am having,

[josh@localhost src]$ make
make -s smaug
Compiling o/act_info.o....
act_info.c: In function ‘do_config’:
act_info.c:4025: error: called object ‘ch->act.bits[0] & 16384’ is not a function
cc1: warnings being treated as errors
act_info.c:4025: warning: too few arguments for format
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2

Here is the code that goes with it

ch_printf( ch, "Roomvnum [%s] Wizhelp Color [%s]", xIS_SET( ch->act, PLR_ROOMVNUM ) IS_SET(ch->pcdata->flags, PCFLAG_WIZHCOLOR ) ? "+" : " " );

Any help on this is greatly appreciated.
USA #1
You're missing a comma after the first xIS_SET
#2
Thanks, but now I get this warning/error ... it is in the same code.

[josh@localhost src]$ make
make -s smaug
Compiling o/act_info.o....
cc1: warnings being treated as errors
act_info.c: In function ‘do_config’:
act_info.c:4025: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
act_info.c:4025: warning: too few arguments for format
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2
USA #3
Change your first %s (the one showing the room vnum) to a %d and see if that fixes the problem for you. %s is used for strings and %d for numbers.
#4
thanks for that, now I know the diff between then %s and %d :) ...

but, not I am getting mor errors, this time in act_wiz.c ...

I have tried changing the %s to %d on line 7242, but it gives me another warning...

here are the errors

Compiling o/act_wiz.o....
cc1: warnings being treated as errors
act_wiz.c: In function ‘do_cedit’:
act_wiz.c:7241: warning: format ‘%s’ expects type ‘char *’, but argument 5 has type ‘int’
act_wiz.c:7241: warning: too few arguments for format
make[1]: *** [o/act_wiz.o] Error 1
make: *** [all] Error 2

Here is the code for that error + a few wxtra lines

7240 command->fun_name,
7241 flag_string( command->flags, cmd_flags ));
7242 ch_printf( ch, "Type: %s\n\r", flag_string( command->types, command_types ));
USA #5
hmm, the warning indicates that the %s on 7242 should be a %d, but it also says that your flag_tring doesn't have enough components between the (), but looking at that function in my own code it doesn't look like it. Is that part of the code you'd altered, or maybe something above it isn't quite right?
#6
that is part of the code the instruction said to put in. I did have to comment out two things in the code due to 1. the were undeclared 2. when I uncomment them, and declare them I get pointer errors.
But I still have that error about line 7240 wether they are commented out or not.
USA #7
What's the code before line 7242?
Lines 7240 and 7241 are only the end portion of a if check or loop or, whatever they're a part of.
#8
here is the code for the whole thing.

ch_printf( ch, "Command: %s\n\rLevel: %d\n\rPosition: %s\n\rLog: %s\n\rCode: %s\n\rFlags: %s\n\r",
command->name,
command->level,
//npc_position[command->position],
//log_flag[command->log],
command->fun_name,
flag_string( command->flags, cmd_flags ));
ch_printf( ch, "Type: %s\n\r", flag_string( command->types, command_types ));

That used to be

if ( arg2[0] == '\0' || !str_cmp( arg2, "show" ) )
{
ch_printf( ch, "Command: %s\n\rLevel: %d\n\rPosition: %s\n\rLog: %s\n\rFunc Name: %s\n\rFlags: %s\n\r",
command->name, command->level, npc_position[command->position], log_flag[command->log],
command->fun_name, flag_string( command->flags, cmd_flags ) );
return;
}
#9
I used some code from a different custome wizhelp .. and I got past those errors. Thanks for all your help :D
USA #10
that works then :)
#11
ok, I figured out my problems. I ausmed that smaug fuss had already had things in it, that it did not.

so I fixed all those errors, only to get another one.

it is

[josh@localhost src]$ make
make -s smaug
Compiling o/act_wiz.o....
o/act_wiz.o(.text+0x13c4e): In function `do_cedit':
/home/josh/Desktop/mud/src/act_wiz.c:7234: undefined reference to `log_flag'
o/act_wiz.o(.text+0x13c5d):/home/josh/Desktop/mud/src/act_wiz.c:7234: undefined reference to `npc_position'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make: *** [all] Error 2

and here is the code for it

ch_printf( ch, "Command: %s\n\rLevel: %d\n\rPosition: %s\n\rLog: %s\n\rCode: %s\n\rFlags: %s\n\r",
command->name,
command->level,
npc_position[command->position],
log_flag[command->log],
command->fun_name,
flag_string( command->flags, cmd_flags ));
ch_printf( ch, "Type: %s\n\r", flag_string( command->types,
USA #12
Looks like npc_position is missing? Where is that function?
#13
I ahve npc_positon and log_flag both in mud.h ... in afk they were in olc.h but smaugfuss does not olc.

I have them on lines 309 and 310

extern char *const log_flag[];
extern char *const npc_position[POS_MAX];
USA #14
Yes, that's where it is declared, but where is const table?
#15
oh ... I did not put them in for them ..... so it is why it is not working ...
USA #16
Probably. The snippet should have said to put them in.