Re: [NEWBIE] Leech command.

From: Mike Stilson (
Date: 09/18/02

On Wed, Sep 18, 2002 at 01:42:20AM +0200, Peter d wrote:
>i made a command called leech, well. the name should say it all..
Yeah, it does, but if you really WANT it to work like you have it coded
then I'd really suggest not putting this in for less than imp's.

>here's the command, i know that i have made lots of errors here.. but i need
>help in finding and correcting them..

I could write a short book about this one.
For starters, try indenting this right.  I'll try to make it readable in
this reply.

>       struct char_data *victim;
>       char buf[MAX_INPUT_LENGTH];
>       one_argument(argument, buf);
>       if (!*buf)
>           send_to_char(ch, "Whom do you wish to leech?\r\n");
Well, you got this part right, kinda.  see below.

>       else if (!(victim = get_char_vis(ch, argument, NULL, FIND_CHAR_WORLD)))
No need for this else.

>           send_to_char(ch, NOPERSON);
>       else {
Or this one

>           if (ch == victim){
>               send_to_char(ch, "Well, that wasn't so smart, was it?");
forgot the \r\n at the end of this one.

>               return;
>           }
>           GET_HIT(victim) = 1;
>           GET_MANA(victim) = 1;
>           GET_MOVE(victim) = 1;
I really wanna play this mud.  I can take out any mob or player in the
world w/in seconds of starting a character.

>           act("You leech $n's soul. You feel fully refreshened by it.",
>              FALSE, ch, 0, victim, TO_CHAR);
This act() is quite misleading.  You never do anything to increase ch's

>           act("You feel your soul being leeched while $n draws power from it!",
>              FALSE, ch, 0, victim, TO_VICT);
>       }
>and a second question.. what is the structure of act()?
see the docs specifically written on it.  act.pdf I think; look in the
docs dir.

The biggest problem here is the design absolutely sucks.  A perfectly
coded function with this design would still suck.

Ok, you use one argument to put the first arg into buf, but then you
still use argument in get_char_vis().  argument still contains the
leading space.  Either replace the one_argument with
skip_spaces(&argument);  and the if(!*buf) { with (!*argument) {   or
replace the use of argument in get_char_vis() with buf.
(The first has the advantage of not needing another kinda large buffer..
it's nicer on memory)

That covers your specific request about why it doesn't work.  The rest
of it wil work as you coded, but here are some design issues you didn't
really seem to think thru:

1: You really want any char of any level to be able to set any other
char's conditions to all 1, regardless of their level or level
2: Do you want them to be able to do this to any other player they
3: Do you really want them to be able to do this from anywhere to
anywhere on the mud?
4: Do you want it to actually improve ch's condition, or is this just a
funky zap command for the gods?
5: Is this command for all races, classes, and levels?
6: This skill always and automatically works w/o fail or any type of
retribution to ch?

(I could probably keep going, but by the time you're done with that list
it should at least start to look right.)


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT