> On Tue, 15 Jul 1997, Heartless wrote: > > > 'retreat n' > > (which would mean retreat north), what is the argument > > 'n' passed as? I was kinda hoping it was something simple like 'cmd' or > > 'argument' but neither of those seem to have worked.... Can anyone help > > me out? > > ACMD(do_retreat) > { > int dir = 0; > > one_argument(argument, arg); > > if (is_abbrev(arg, "north")) > dir = 0; > else if (is_abbrev(arg, "south")) > . > . /* Put rest of direction stuff here */ > . > else { > send_to_char("That is not a valid direction to retreat in\r\n", ch); > return; > } Ummm, yeah it'll work. but why write 20 lines of code where one will do (well, a couple)? int dir_num; (somewhere at the top) extern char * dirs[]; one_argument(argument, arg); dir_num = search_block(arg, dirs, FALSE); if (dir_num < 0) { send_to_char("Retreat in which direction?\r\n", ch); return; } The beauty of this is that it will accept "n" or "north" or anywherew in between as a valid direction, and returns the direction number (0->5). after that bit of code you go on to do your perform_move in whatever dir_num etc etc. I haven't written a retreat skill, and I'm not gpoing to, so you can work that out yourself ;-) enjoy. Chris /| _ />> \\ / \ |\_______|/\/-------------------------------------------------------, [*********<()>--- - ---=== Chris Proctor, a.k.a Deathblade ===--- --> |/~~~~~~~|\/\-------------------------------------------------------` // \ / cjp@yoyo.cc.monash.edu.au ~ \>> cjpro1@bedrock.eng.monash.edu.au \| cjp@red.icplus.net.au cjpro1@student.monash.edu.au Dominia Mud: snafu.net.au 3333 My homepage: http://yoyo.cc.monash.edu.au/~cjp +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list-faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST