I am trying to implement a generic special procedure to handle
falling/transportation traps. And have hit a stumbling block. I want
the trap to trigger off a command that a character types like, 'open'
or 'close' or whatever it could be anything. The problem is that the
trap never gets activated. Here is what I have:
---DEFINITIONS---
struct t_trap
{
int room; /* Room of trap occurance */
char *command; /* Command to activate trap */
int new_room; /* Room character is trasported to */
int type; /* Type of trap */
};
struct t_trap tran_trap[(NUM_T_TRAPS + 1)] =
{
{ 908, "open", 1014, TT_SLIDE},
{ 913, "close", 1014, TT_TELE },
/* this must go last -- add new traps above! */
{-1, "\n", -1, -1}
};
The way it is supposed to work is that if a player is in room 908 and
types 'open' then they will be transported to room 1014 with the message
that accompanies trap type SLIDE.
However, if I am in room 908 and type 'open' all I get is:
Open what?
Here is the procedure (albiet unfinished):
SPECIAL(transport_trap)
{
int i;
if(!argument)
return FALSE;
for (i = 0; tran_trap[i].room != -1; i++)
{
if(world[ch->in_room].number == tran_trap[i].room)
{
if(!strcmp(argument, tran_trap[i].command))
{
switch(tran_trap[i].type)
{
case TT_TRAPDOOR:
case TT_SLIDE:
send_to_char("You fall into a trap.",ch);
char_from_room(ch);
char_to_room(ch, (real_room(tran_trap[i].new_room)));
break;
default:
break;
}
return TRUE;
}
}
}
return FALSE;
}
Can anyone help me find out what is wrong with this procedure and why it
doesn't recognize the trigger command?
-Haddixx
--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Haddixx | -=-=-Implementor of Avalanche MUD-=-=- |
+ Brian M. Menges + Running at: 143.207.31.45 8000 +
| haddixx@megamed.com | Web Page: http://www.megamed.com/~haddixx |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-----------------------------------------------------------+
| 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/07/00 PST