[code][question] coke machine special...

From: Mouchie (annbell@gpu.srv.ualberta.ca)
Date: 02/23/97


just double checking something.  I am adding the coke special
procedure from the snippets page...ok, first of all, i have to make the obj
the coke machine in my obj files...right? then i have to go to spec_a.c (i
think) and add a special " SPECIAL(pop_dispenser)"...then i assign it...
ASSIGNOBJ(pop_dispenser)...then i go into spec_p.c and add this code:

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;


Then i have to make the coke can thingy, and insert the Coke machine obj,
and the coke can obj, into the zone things, and define which room i want
them to be in...sound good?

Mouchie

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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