LONG: A couple of neat SPEC_PROCS

From: Sliver (sliver@lightspeed.bc.ca)
Date: 07/11/96


Second of all, is a newbie tour guide for the city of midgaard. Make him
load in the temple.


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SLiVER Implementor of
ArmadaMUD                    lightspeed.bc.ca 4000
EMail:                     sliver@lightspeed.bc.ca
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
==============================================================================
Content-Disposition: inline; filename="coke.c"

SPECIAL(pop_dispenser)
{
 struct obj_data *obj = me, *drink;
 int give_coke = 1206; /* Vnum of the can of coke */
 if (CMD_IS("list"))
     {
     send_to_char("To buy a coke, type 'buy coke'.\r\n", ch); /* 
     return (TRUE);
     }
 else if (CMD_IS("buy")) {
          if (GET_GOLD(ch) < 25) {
          send_to_char("You don't have enough gold!\r\n", ch);
          return (TRUE);
          } else {
            drink = read_object(give_coke, VIRTUAL); 
            obj_to_char(drink, ch);
            send_to_char("You insert your money into the machine\r\n",ch);
            GET_GOLD(ch) -= 25; /* coke costs 25 gold */
            act("$n gets a pop can from $p.", FALSE, ch, obj, 0, TO_ROOM);
            send_to_char("You get a pop can from the machine.\r\n",ch);
          }
          return 1;
 }
 return 0;
}
==============================================================================
Content-Disposition: inline; filename="guide.c"

SPECIAL(newbie_guide)
{
 
 
 static char tour_path[] =
 "WAAA2E3J1230D22G032K011110I22M033212L030014R530A00001HBC32222Z."; 
/* The above is the path that the guide takes. The numbers are the */
/* Directions at wich he moves                                     */

static char *path; 
static int index; 
static bool move = FALSE;

  if (!move) {
       if (time_info.hours == 1) { /* Tour starts at 1 am*/
       move = TRUE;
       path = tour_path;
       index = 0;
     } else if (time_info.hours == 12) { /* And at 12 pm */
       move = TRUE;
       path = tour_path;
       index = 0;
}
  }
  if (cmd || !move || (GET_POS(ch) < POS_RESTING) ||
      (GET_POS(ch) == POS_FIGHTING))
    return FALSE;

  switch (path[index]) {
  case '0': 
  case '1': 
  case '2': 
  case '3': 
  case '4':
  case '5':
    perform_move(ch, path[index] - '0', 1); 
    break;
  case 'W':
    GET_POS(ch)=POS_STANDING;
    act("$n stands up and announces 'The tour is going to start soon!'", FALSE, ch, 0, 0, TO_ROOM);
    break;
  case 'Z':
    act("$n sits and rests for his next journey.", FALSE, ch, 0, 0, TO_ROOM);
    GET_POS(ch)=POS_RESTING;
    break;
  case 'M': 
    act("$n says 'This is the enterence to the WARRIORS guild.'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
   case 'L': 
    act("$n says 'This is the enterence to the THEVES guild.'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'K': 
    act("$n says 'This is the enterence to the MAGES guild.'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
    case 'J': 
    act("$n says 'This is the enterence to the CLERICS guild.'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'H': 
    act("$n says 'Right now, you may find it usefull to type 'WEAR ALL''", FALSE, ch, 0, 0, TO_ROOM); 
    break;
    case 'A': 
    act("$n says 'Newbies!! Type 'FOLLOW GUIDE' for a guided tour'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'B': 
    act("$n says 'This here is the enterence to the newbie area. Please, type 'FOLLOW SELF''", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'C': 
    act("$n says 'Now have fun out there, and be careful!'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'D': 
    act("$n says 'This is our dear friend the baker, to buy bread from him, type 'BUY BREAD''", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'E': 
    act("$n says 'This is the Fountain, to drink from it, type 'DRINK FOUNTAIN''", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'F': 
    act("$n says 'This is our dear friend Wally, he will sell you water, 
type 'LIST' to see a list of what he has.'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case 'G': 
    act("$n says 'This is the Armorer, he makes armor, type LIST to see 
what he has to sell'", FALSE, ch, 0, 0, TO_ROOM); 
    break;
  case '.':
    move = FALSE;
    break;
  case 'R':
    act("$n says 'This is the RECEPTION, in this MUD, you must RENT.'", FALSE, ch, 0, 0, TO_ROOM);
    act("$n says 'To see how much your rent will cost, type 'OFFER'", FALSE, ch, 0, 0, TO_ROOM);
    act("$n says 'To rent, type RENT.'", FALSE, ch, 0, 0, TO_ROOM);
    break;
}
index++;
return FALSE;
}



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