Re: Push Command (fwd)

From: Demetrius Harris (ldh1@Archive.MsState.Edu)
Date: 07/20/96


Date: Sat, 20 Jul 1996 14:59:30 -0400
From: Primacy <jmrobins@wired.uvm.edu>
To: Demetrius Harris <ldh1@Archive.MsState.Edu>
Subject: Re: Push Command

I have a push command, it's for a spec_proc I wrote (Patch level 9)  It lets
you push buttons, and other objects to activate them.  (Here's my code if
you're interested)

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!



Also, wondering if you could do me a favor and forward this code to the
CircleMailing list...for some strange reason, I can't post to it.  <Sigh>

BTW - I like your idea about the push command.

Thanks!
 ------------------------------------------------------------
| Justin Robinson - Primacy                                  |
 ------------------------------------------------------------
| VTel - Springfield Vermont                                 |
| Computer Technician                                        |
| E-Mail ----------------> jmrobins@vermontel.com            |
| WWW-Page --------------> http://www.vermontel.com/         |
 ------------------------------------------------------------
| Ruin! Mud                                                  |
| WWW-Page --------------> http://wired.uvm.edu/~jmrobins/   |
| Mud Address  ----------> wired.uvm.edu:4000                |
| Implementors ----------> ruin@vermontel.com                |
| Mailing List  ---------> jrobins@griffin.emba.uvm.edu      |
 ------------------------------------------------------------



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