> char eventarray[30000]; Umm let me say I do NOT recommend this! > void set_event(int time, long idnum, char *comm) > { > eventarray[0] = *comm; /* Put's all of comm into 0 */ > } > As far as your event system goes, I personally would recommend a linked list, or a binary tree sorted based on the time before the event is to be done. However I would definately NOT recommend allocating an array that big. char stuff[] = {"Hello", "how", "are", "you?"}; What you have seen is char *stuff[] = {"Cervo", "is", "the", "redoC", "retsaM", "!!!!"}; This is an array of pointers to a character string. You could also do the same thing with a two dimensional array. If you wanted to access the v in cervo it would be stuff[0][3], unless I screwed up the order of the array :P But this is most likely what you are referring to. If you wanted to do an event system, you would probably have to dynamically allocate the string using CREATE, or just assign the one string to another. However for what you what to do, the best way would probably be a limit of 10 events or so. --char *events[10]; and then for each event you wish to add to it --events[x] = (char *) calloc(strlen(comm) + 1, sizeof(char)); --strcpy(events[x], comm); Then when you access events[0] or whatever, you will end up with with whatever string is stored in it. However this is just (watch check) 30 second code, so there are tons of other things you could do. One thing might be dyanmically allocating the entire events array, but the best thing would be a linked list. something like struct event_structure { int time; long idnum; char *command; struct event_structure *next; }; I am not sure what else you would want to store, but this way you could have it more organized. As far as a procedure using the linked list if you don't know check circle, however if you do know you are all set. This is also ideal because you do not know how many events are going to be in the queue, and a linked list is ideal for this type of situation. Of course, I didn't see all of the code, so for all I know you could be doing it this way and having the event array doing something else. Well these are just suggestions and me killing some time(thanks for five minutes of fun). <-----||||Cervo the redoC retsaM||||-----> \|/ | +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST