Redbutton Spec_Proc

From: Primacy (jmrobins@moose.uvm.edu)
Date: 07/19/96


>From jmrobins@wired.uvm.eduFri Jul 19 15:39:38 1996
Date: Mon, 15 Jul 1996 19:27:50 -0400 (EDT)
From: Primacy <jmrobins@wired.uvm.edu>
To: circle@pvv.ntnu.no
Subject: Redbutton (fwd)




Here's some code I wrote for a `Red Button' that when pushed, will teleport
the character to a random room somewhere in the mud.

<In SPEC_ASSIGN.C add this:>
In void assign_objects(void) add the following lines:
        SPECIAL(redbutton);  
        ASSIGNOBJ(32, redbutton);     /* transport button */
--------------------------
<In SPEC_PROCS.C add this at the bottom:>
SPECIAL (redbutton)
{
  struct obj_data *obj = (struct obj_data *) me;
  struct obj_data *port;
  char obj_name[MAX_STRING_LENGTH];
  int z;
 
    if (!CMD_IS("push")) return FALSE;

    argument = one_argument(argument,obj_name);
    if (!(port = get_obj_in_list_vis(ch, obj_name,
world[ch->in_room].contents)))	{
      return(FALSE);
    }
    
    if (port != obj)
      return(FALSE);
    
        act("$n pushes $p and fades away.", FALSE, ch, port, 0, TO_ROOM);
        act("You push $p, and you are transported elsewhere", FALSE, ch,
port, 0, TO_CHAR);
        char_from_room(ch);
        char_to_room(ch, number(0, top_of_world));
        look_at_room(ch, 0);
        act("$n slowly materializes from nowhere...", FALSE, ch, 0, 0, TO_ROOM);
        return(TRUE);
}
----------------------------
<In 0.OBJ add this item:>
#32
button red~
a red button~
A large red button is protruding from the wall here.~
~
13 0 0
0 0 0 0
1000 0 -1 0
----------------------------
<In INTERPRETER.C add this line somewhere in the command list:>
  { "push"     , POS_DEAD    , do_not_here , 0, 0 },



Presto!  Load object 32 somewhere in the mud...and have someone PUSH BUTTON
away they go!

Primacy - Justin
ruin mud - wired.uvm.edu:4000
ruin@wired.uvm.edu
http://wired.uvm.edu/~jmrobins/



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