Re: Adding a new command.

From: Rasmus 'Con' Ronlev (raro94ab@hp4.econ.cbs.dk)
Date: 06/28/96


On Thu, 27 Jun 1996, Dann Fuller wrote:

> I'm planning on adding a 'zone' command, with which PCs can either 
[SNIP]
> I know you need an ACMD(do_zone){...}, which I'm thinking would go in 
> act.other.c.  I know you also need to put a line in interpreter.c, so 
> people can use the command.  Is that all, or are there other files I need 
> to change, too?

All you need to do is to add this in interpreter.c:

ACMD(do_zone);    at the start somewhere
....
	{ "zone", POS_SLEEPING, do_zone, 1, 0 },
....

in SOME c file, could be act.informative.c or act.other.c .. or or or :)

ACMD(do_zone)
{
  char arg1[MAX_INPUT_LENGTH];
  int zonenum;
.....
  skip_spaces(&argument)
  if (!*argument)
  {
    --- LIST ALL ZONES STUFF ---
  }
  else
    one_argument(argument, arg1);
    if(!(zone = atoi(arg1)))
    {
       send_to_char("Illegal zone number\r\n", ch);
       return;
    }
    else
    {
       --- WE HAVE A ZONE NUM ---
       --- CHECK FOR THE EXISTANCE OF THE ZONE ---
       --- IF EXISTS PRINT INFORMATION ---
    }
}

This is free from my non-cretive mind, it's untested, completely filled 
with bugs, and will never be able to work :) Still, use it as a 
framework/idea skelleton, and you should be on your way.

> Also, how would YOU go about storing the zone descriptions?  I'm planning 
> on creating a 6th part to the split world file, for descriptions, and 
> just reading the descriptions from there, mainly because it's neat, and 
> was the first thing that came to me.  Any other ideas?

Well, I made something 'similar', and I just made a couple of additional
field in the zone_data struct, there is a runtime structure/table called 
zone_table *hint* ... 
Just use that to add the information to, and you'll have it accesible in 
a fast way, instead of loading it from a file for example, each time a 
player wants some zone information... 
The descriptions should be added to the .zon file, and then it's easy to 
go and seek the place where the zone_table is loaded and filled with 
information and modify the routine to invlude the needed stuff..

just my two cents.
From here on it's up to you.. :)

Regards,
Con.

d.
--
     Rasmus Rønlev DOEK'94      WWW: http://www.econ.cbs.dk/people/raro94ab  
     Student instructor         MUD: exiled.mud.circlemud.org 5000
                                         199.199.16.100 5000
       Student, B.Sc in Computer Science and Business Administration. 



This archive was generated by hypermail 2b30 : 12/18/00 PST