char_to_room

From: Glenn Campbell (glenn@ccgc.tc.gc.ca)
Date: 10/04/95


Ok, my portal spell is almost done. The Spell part works great, and I would
like to thank those that helped. However, (theres always a however) my enter
command is fubared. When a player sees a portal and types enter , wirld
thyings happen. As an example, I (as IMP) cast 'portal' <playername in room
3001>. The portal appears at both ends and everything seems cool. When I try
to enter I go to a room with roomnum=NULL. If I then try to goto a different
room the mud crashes. It seems like the char_from_room(ch) and char_to_room
function calls are behaving improperly. Does anyone out there know if there
is a problem passing these functions ch.  

Here is my code :)

I have modified room_data to include the following:

int gate_room

gate_room being the room that the portal takes you to ..

Also , a new room flag was created called ROOM_HAS_GATE ..
............................................................................
.......

ASPELL(spell_portal)
{

/* First Set the Room Flags to Display the Portals */
SET_BIT(ROOM_FLAGS(ch->in_room),ROOM_HAS_GATE);
SET_BIT(ROOM_FLAGS(victim->in_room),ROOM_HAS_GATE);

/* Next We Set the Room To Room Values for Each Room */
world[ch->in_room].gate_room=world[victim->in_room].number;
world[victim->in_room].gate_room=world[ch->in_room].number;
send_to_char("You hear an grinding noise as a magic portal opens before
you!\r\n", ch);

}


ACMD(do_enter)
{

sh_int destination;

if (ROOM_FLAGGED(ch->in_room,ROOM_HAS_GATE)) {

send_to_char("Your body is sucked into the watery portal , you exit into a
new room!\r\n",ch);
destination=world[ch->in_room].gate_room;

char_from_room(victim); 
char_to_room(victim, destination); 

look_at_room(ch, 0);

} else {
  send_to_char("Sorry no portal here dude!\r\n", ch);
  return;} 

}
 ________________________________________________________________________(_) 
(_)  Glenn Campbell                   Voice:902-564-3660 (136)             |
| |  Computer Systems Specialist      Fax:902-562-6113                     |
| |  Canadian Coast Guard College     Voice Mail:902-565-6563 (20 seconds) |
| |________________________________________________________________________)
(_)



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