Honestly, I wouldn't go at this angle. Instead implement 'as':
Then you can just do: 'as <name> score'
But, of course, all your commands must make sure they don't reference
->pcdata when used on an NPC.
void do_as (CHAR_DATA *ch, char *argument)
{
CHAR_DATA *vic;
DESCRIPTOR_DATA *orig;
char arg[MAX_INPUT_LENGTH];
argument = one_argument (argument, arg);
vic = get_char_world(ch, arg);
if (!vic){
printf_to_char(ch, "No one here by that name.\n\r");
return;
}
orig = vic->desc;
vic->desc = ch->desc;
ch->desc = NULL;
interpret (vic, argument);
ch->desc = vic->desc;
vic->desc = orig;
}
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 06, 2003 10:22 AM
> To: [email protected]
> Subject: ok i guess im at my first question
>
>
> I have a command called cscore which lets me as a immortal
> see the score
> of any charecter or mob. well the charecter part works but
> when you do a
> mob it crashes. Here is the gdb out put
>
> gdb) bt
> #0 0x080731c8 in do_cscore (ch=0x406329a0,
> argument=0xbfffe767 "devil")
> at act_wiz.c:6739
> #1 0x080a3e61 in interpret (ch=0x406329a0,
> argument=0xbfffe760 "cscore
> devil") at interp.c:698
> #2 0x08075a2a in substitute_alias (d=0x40630320, argument=0x40630c9d
> "cscore devil") at alias.c:107
> #3 0x0807ae4f in game_loop_unix (control=5, wwwcontrol=6) at
> comm.c:910
> #4 0x0807a810 in main (argc=2, argv=0xbffffb64) at comm.c:477
> #5 0x40066657 in __libc_start_main (main=0x807a430 <main>, argc=2,
> ubp_av=0xbffffb64,
> init=0x8048e7c <_init>, fini=0x80db150 <_fini>,
> rtld_fini=0x4000dcd4
> <_dl_fini>, stack_end=0xbffffb5c)
> at ../sysdeps/generic/libc-start.c:129
> (gdb) frame 1
> #1 0x080a3e61 in interpret (ch=0x406329a0,
> argument=0xbfffe760 "cscore
> devil") at interp.c:698
> warning: Source file is more recent than executable.
>
> 698 ( *cmd_table[cmd].do_fun ) ( ch, argument );
> (gdb) frame 0
> #0 0x080731c8 in do_cscore (ch=0x406329a0,
> argument=0xbfffe767 "devil")
> at act_wiz.c:6739
> 6739 printf_to_char ( ch,
> I think it is because a mob isent a charecter there for that
> is why it is
> crashing cause it also crashes when ou type score switched as
> a mob could
> anyone tell me maybe a if check to say if your a mob or
> looking at a mob
> score that you can do that..
> like
> This is the line im not sure what to put below
> ---->IF !IS_NPC duh duh duh
> {
> send_to_char( ch, "Not on Mobiles" );
> return;
> }
> --
> Thank You
> Gothmog
> Planet Anime!
> amr.kyndig.com port 1601
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>