From: Scott Warren Subject: Elevators and do_push Hi all, Here's a little snippet I did for Reimsmud last spring. I used the extra descripts in a room to create an elevator, along with a new command 'do_push' for things like 'push button'. I think this code will just drop in. Just need to add the following: do_push in interpreter.c ROOM_ELEVATOR and ROOM_ENTRANCE flags in structs.h and other places (olc, flag name arrays, etc) Now you are ready to create an elevator. I think the current code has fixed directions. East goes into an elevator, west exits the elevator. That would be easy to change though (Reimsmud never really opened so I got very little feedback on this stuff). Create a ROOM_ENTRANCE flagged room with an extra description keyword VNUM_e The extra description associated with that keyword should contain the VNUM of the room that is the 'inside' of the elevator. Create the other rooms that the elevator can visit. Higher VNUMS are considered 'up' so keep that in mind. At this point create the elevator room and flag it as ROOM_ELEVATOR. Be sure to put in the elevator's description some type of panel with labelled buttons. Use the extra description keywords to define which button goes to what room (similar to above). Example, you want 'button one' to goto room 1202. You have a keyword 'one' and the extra desc. is '1202'. To use: calling an elevator is done by 'push button' in a ROOM_ENTRANCE inside, going to a room is done by 'push button one' in the ROOM_ELEVATOR Problems: I think (trying to remember) you should set up the elevator as being open to a room when the mud loads. I think there was some other problem the builders were having with it too. Can't remember what it was (I would create an example to show builders and that example worked fine). Good luck and Happy Mudding. Scott Warren dswarren@bellsouth.net /* ************************************************************************ Winter/Spring 1997 Some new commands by DSW ************************************************************************ */ ACMD(do_push) { char *desc; int room_boundary, old_room; char arg1[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; two_arguments(argument, arg1, arg2); if (!*arg1) { send_to_char("Push what?\r\n", ch); return; } /* a list of valid push words and their results push button checks for room type currently only works for elevators */ if(!str_cmp(arg1,"button") && ROOM_FLAGGED(ch->in_room, ROOM_ELEVATOR)) { if((desc = find_exdesc(arg2, world[ch->in_room].ex_description))) { room_boundary = atoi(desc); old_room = world[ch->in_room].dir_option[3]->to_room; if(world[old_room].number < room_boundary) { act("$n pushes the button and the elevator moves upward", TRUE, ch, 0, 0, TO_ROOM); send_to_char("You push the button and the elevator moves upward.\r\n", ch ); } else if(world[old_room].number > room_boundary) { act("$n pushes the button and the elevator moves downward", TRUE, ch, 0, 0, TO_ROOM); send_to_char("You push the button and the elevator moves downward.\r\n", ch); } world[old_room].dir_option[1]->to_room = -1; world[ch->in_room].dir_option[3]->to_room = real_room(room_boundary); world[real_room(room_boundary)].dir_option[1]->to_room = ch->in_room; } else send_to_char("Error in this elevator.\r\n", ch); } else if(!str_cmp(arg1,"button") && ROOM_FLAGGED(ch->in_room, ROOM_ENTRANCE)) { if((desc = find_exdesc("VNUM_e", world[ch->in_room].ex_description)))^¿ { room_boundary = atoi(desc); if(world[ch->in_room].dir_option[1]->to_room == real_room(room_boundary)) { send_to_char("The elevator is already here!\r\n", ch); return; } old_room = world[real_room(room_boundary)].dir_option[3]->to_room; world[old_room].dir_option[1]->to_room = -1; world[real_room(room_boundary)].dir_option[3]->to_room = ch->in_room; world[ch->in_room].dir_option[1]->to_room = real_room(room_boundary); send_to_char("The elevator has arrived.\r\n", ch); } } else send_to_char("You see nothing to push here.\r\n", ch); return; }