[Circle][Long] Re: ?????SPECIAL PROCEDURE?????

From: Alvoria MUD (mudguy@conan.ids.net)
Date: 11/16/96

On Sat, 16 Nov 1996, BlackWind wrote:
> Here's an example of what I mean;

Hm... This is something that I've not seen anyone else do in reply, but at
a chance to make an innovation to get those newbies to code on their own,
here is what I call a fill-in-the-blank reply. I'm sorry bout the length
of the reply, but I make spec_procs all the time, and I guess you could
consider this a tutorial if you'd like. :P. Btw, look at the mayor spec...

Imho, making a proc as advanced like this is not a good idea... A lot of
procs that depend on a player being there can get ruined if the player
goes linkless (could miss several things... etc..), and checking all those
possibilities will contribute a lot more to slow the mud down than most
other procs you could have.

Ok, so first let's make a list of the steps & actions:
1. We can ignore this... We can just put a check to see if the princess
sees anyone else in the room.
> (character has arrived at the princess)

1a. If the princess sees the player and is in state 1, then do the below
and advance the state.
> Princess Sethran says, '(character)!  You've saved me!!!  Oh it is so
> nice to be free!  Please!  Go to my father at the end of the tunnel and
> tell him the secret code.

1b. Add an amount of time for switching states and these pauses won't be
needed. Spec_Procs get called few secs, so just keep a static counter or
something (or check the mud time, etc..).
> (small pause)

2a. Same as 1a.
> Princess Sethran tells (character), 'the code is 'peace'

2b. See 1b.
> (very small pause)

3a. Make sure this actually exists in the room before you test the proc.
> (Princess Sethran opens the trapdoor.)

3b. See 1b.
> (pause)

4a. See 1a.
> Princess Sethran says, 'please, hurry.

4b. Also, need to add a check to see if the char has left. Perhaps you
will want to do something funky with the MEMORY thing on the mob (add a
similar stack to the mob to store chars already seen, but then this will
be a possible memory leak if you don't figure a way to remove chars
regularly after a certain amount of time if necessary.)

5a. Here we need a separate proc for the king. See #1.
> (character has arrived at king)

5b. See previous message for how to do this.
> character tells King BradeLeck, 'peace'

5c. Continuation of 5b. See 1a.
> King BradeLeck tells character, 'I see you have talked to my daughter.
> The town will be safe for now, as long as you have this.

5d. See 1b.
> (very small pause)

6a. Make sure that the obj the king is wearing is the right obj, and also
first that there is an obj at that location.
> King BradeLeck stops usign the glowing talon of Gratonia.

6b. See 1b.
> (very small pause)

7a. Make sure #13 is done or your mud will crash :P.
> King BradeLeck gives character the glowing talon of Gratonia.

7b. See 1b.
> (small pause)

8a. See 3a.
> King BradeLeck opens the hatch.

8b. See 1b.
> (pause)

9a. See 1a. It would be interesting if after a certain amount of time,
that entity Schten came into the room or something. You can make a simple
proc to look thru the char_list for the king and check the people in the
same room as the king, or go thru the active descriptors and look in the
rooms of all the chars to see if the king is there (the latter is more
efficient if done right, I think.)
> King BradeLeck tells you, 'please, get out of here before Schten finds
> out about this.  Please do hurry.  Thank you ever so much.

9b. Like before, stuff to handle the char being gone or whatever.

10. Ok, vnums are not important here, because you will need the rnums or
pointers to actually manipulate the stuff. (Actually, using real_room()
for the previous suggestion would cut down the time to get the room
and check for the people in the same room as the king for a possible
Schten proc.)
> King  is 6612
> Princess is 6611
> Princess room is 6672
> King Room is 6678
> Talons are 6618

So, the fill in the blank looks like this... (I'm going to use __ __ , etc
to stand for blanks to fill in with the proper code concerning the
actions/steps above, etc)

struct char_data *last_princess_seen;

  static int state; /* so that this int stays the same */
  static int state_timer;
  __Some other ints and char_data pointers, depending on how you imp
    this, and what your implementation needs__

    return 0; /* none of the actions for the princess req response to cmd */

  if(!AWAKE((struct char_data *)me))
    return 0; /* Yah right... if the princess is sleeping don't make her
                 talk in her sleep! */

  if(FIGHTING((struct char_data *)me))
      state = 0;  /* clear the state */
      last_princess_seen = NULL; /* clear the var telling who the princess
                                    last saw */
      return 0; /* I don't think you want the princess talking about how
                   lucky it is to be rescued if the person she sees is
                   attacking her, or anyone else for that matter :P */

  __check the timer, if it's clear advance the state and continue, if not
    then don't continue and decrement the timer, also check if the last
    person the princess saw is still around, be careful with this part__

      case 0;
      case __1__:
        __look at the room using world[((struct char_data *)me)->in_room].people
          and store the char's pointer in last_princess_seen__
        __set the timer for the next action__

      case __2__:
        __Tell the player the code__  /* or whatever... */
        __set the timer again__

      case __3__:
        __Open the door below or wherever the trapdoor is__
        _set the timer again__

      __etc.. fill in here stuff to handle the other states...__

        __Put some something to log an error here, cause it'll help you
          to debug it__
  return 1;

  static int state;

  __This you can figure out... it will be just like the princess but you
    have to bail out of the proc without doing anything if the princess
    hasn't seen anyone.__


Alvoria MUD -- Where things aren't quite the same...
  Address   -- telnet://conan.ids.net:4000/
  Homepage  -- http://users.ids.net/~mudguy/
  (under construction, perhaps not even updated for months to come)

| 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/18/00 PST