Hi,
there are some errors in this spec_proc that might be your problem:
On Tue, 30 Jul 1996 linebacker@microlink.net wrote:
> while (time_info.hours == 10) {
> for (i = world[ch->in_room].contents; i; i = i->next_content) {
> act("The Moonshadow has left dock and headed down river.", FALSE, ch, 0, 0, TO_ROOM);
> obj_from_room(i);
> ship_count 6~= 1;
> return TRUE;
> }
Because of the return statement here, the for loop will only ever execute
once. If that is what you want, why use a for loop.
> }
>
> while ((time_info.hours == 8) && (ship_count == 1)) {
> ship = read_object(ship_num, VIRTUAL);
> obj_to_room(ship, real_room(dock_num));
> act("The Moonshadow has quietly pulled into dock.", FALSE, ch, 0, 0, TO_ROOM);
> ship_count=0;
> return TRUE;
> }
>
> return FALSE;
> }
>
Also, everytime this function is called, ship_count is reset to 1.
I have never coded one of these before, but give this a try (i did not
try to change much of what you wanted)
SPECIAL(dockmaster)
{
struct obj_data *ship;
struct obj_data *iterator;
long shipVirtNum = 10039;
long dockVirtNum = 2113;
int MaxAllowableShips = 1;
static int numShips = 0; /* only initialized once and stored */
bool retCode = FALSE; /* rename to something more descriptive */
/* start of special procedure, at 10 o'clock the ship leaves,
at 8 o'clock it arrives. */
if (time_info.hours == 10) { /* is it 10 o'clock, if so remove ship */
for(iterator = world[ch->in_room].contents;iterator;;) {
if (iterator->virtual == shipVirtNum) { /* is obj a ship? */
act("The Moonshadow has left dock and headed down river.",\
FALSE, ch, 0, 0, TO_ROOM);
obj_from_room(iterator); /* if ship not created by proc */
numShips--; /* you will have a problem */
retCode = TRUE; /* don't know purpose of TRUE here */
}
iterator = iterator->next_content; /* check next obj for ship */
}
return retCode; /* still FALSE if no ships in room */
}
if ((time_info.hours == 8) && (numShips < MaxAllowableShips)){
/* if it is 8 o'clock and max ships not reached, add ship to room */
act("The Moonshadow has quietly pulled into dock.",\
FALSE, ch, 0, 0, TO_ROOM);
ship = real_object(shipVirtNum);
obj_to_room(ship, real_room(dockVirtNum));
numShips++;
retCode = TRUE;
}
return retCode;
}
Later...
...Chuck
Crom of Dragon'Spire
+-----------------------------------------------------------+
| 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/07/00 PST