The search_block() function is handy for this. It's mostly why the
constants in contants.c are set up with a '\n' at the end.
int door;
if ((door = search_block(arg, dirs, FALSE)) == -1) {
send_to_char("That's not a direction.\r\n", ch);
return;
}
do_simple_move(ch, door, TRUE);
Where arg is the argument after "retreat". 'door' will now have a value of
the direction that the player should retreat. You should perform other
checks such as CAN_GO. Take a look at do_flee for other things.
Rick
-----Original Message-----
From: Beau Perrizo <Perrizo@aol.com>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Tuesday, February 09, 1999 11:31 PM
Subject: Re: [NEWBIE] [CODE] Retreat
>Hello,
> I have been trying for some time to code a retreat skill which will
allow
>a player to choose the direction which he/she wishes to go when fleeing
from
>combat. My problem is getting the argument working so that if you type
>retreat n it goes north, and retreat s goes south. I haven't figured out
>quite how to do it and I was wondering if anyone could point me towards
some
>existing code which might help. I should add that my C skill is rather low
at
>the present time. Any help will be greatly appreciated.
>
>Turgantarganath
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST