Re: Cases in Spec_procedures

From: Jens Malare (raidell@dalnet.se)
Date: 07/14/96


>Me again, still trying to figure out special procedures. I've been taking a
>look at the King's Castle Special procedures and am trying to figure out
>what all the "cases" mean.

>For example, SPECIAL(king_welmar) has nothing for cases 1-4, but will move
>for case 5.  Then, nothing for A-D, but things do happen for
>D,P,W,S,r,s,G,g,o,c,.
>How are these letters and numbers determined?  Where do they come from?  How
>are outside actions by other players to determine which case is selected?

Well, It's totally up to the programmer himself to decide what should
happen at a special case. If you look at the top of SPECIAL(king_welmar)
you'll notice that there are char arrays set up with a lot of numbers and
figures. Those strings are the path that king welmar will follow. Time will
decide what path he will follow (you really should check the code :).

Let's go for an example. This is the path which welmar will follow when
he gets tired and want's to go to bed:

static char bedroom_path[] = "s33004o1c1S.";

This is a part of the code:

} else if (time_info.hours == 21 && ch->in_room == R_ROOM(Z_KINGS_C, 17)){
  move = TRUE;
  path = bedroom_path;
  index = 0;

First the "else if ()" function will check that the clock is 21:00 and
that the king is standing at his throne (he has to stand at the right
place, else he might get lost. :).

Then the move variable will be set to true, indicating that welmar is
moving around at the moment, so that no other path will be started before
he actually gets to his bedroom (More about this later).

Index is the variable holding the current position in the path array.
It's set to zero, so that the path will start at the first character in
the string.

Ermm. I think that was what had to be explained. If you still don't
understand how it works or what I mean, mail me back and I'll try
to explain again. :)

>It seems that cases are specific to each Special() function as case 1 for
>Peter, Captain of the Guards, does not correspond to case 1 for Jerry  the
>gambler.

Nope, they have different things to do, and as I said before, it's totally
up to the programmer himself to set the paths and decide what's supposed to
happen at a special case.

---
Regards, Jens Malare <raidell@dalnet.se>



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