Copyto and Dig for OasisOLC [by Myrddin]
Snippet Posted Wednesday, August 12th @ 11:25:25 PM, by George Greer in the OLC dept.
Added Dec 7, 1996. Click the link below to read it or download it.

From: Corey Hoitsma (choitsma@netcom.com)
Subject: Copyto and Dig Commands for OasisOLC

/* Add to bottom of act.wizard.c */

ACMD(do_copyto)
{

/* Only works if you have Oasis OLC */
extern void olc_add_to_save_list(int zone, byte type);

  char buf2[10];
  char buf[80];
  int iroom = 0, rroom = 0;
  struct room_data *room;

  one_argument(argument, buf2);
  /* buf2 is room to copy to */


CREATE (room, struct room_data, 1);



iroom = atoi(buf2);

rroom = real_room(atoi(buf2));

*room = world[rroom];

 if (!*buf2) {
    send_to_char("Format: copyto <room number>\r\n", ch);
    return; }
 if (rroom <= 0) {

sprintf(buf, "There is no room with the number %d.\r\n", iroom);

send_to_char(buf, ch);

return; }

/* Main stuff */

  if (world[ch->in_room].description) {
    world[rroom].description = str_dup(world[ch->in_room].description);

/* Only works if you have Oasis OLC */
  olc_add_to_save_list((iroom/100), OLC_SAVE_ROOM);

 sprintf(buf, "You copy the description to room %d.\r\n", iroom);
 send_to_char(buf, ch); }

else

send_to_char("This room has no description!\r\n", ch);
}

ACMD(do_dig)
{
/* Only works if you have Oasis OLC */
extern void olc_add_to_save_list(int zone, byte type);

  char buf2[10];
  char buf3[10];
  char buf[80];
  int iroom = 0, rroom = 0;
  int dir = 0;
/*  struct room_data *room; */

  two_arguments(argument, buf2, buf3);
  /* buf2 is the direction, buf3 is the room */


iroom = atoi(buf3);

rroom = real_room(iroom);

 if (!*buf2) {
    send_to_char("Format: dig <dir> <room number>\r\n", ch);
    return; }
 else if (!*buf3) {
    send_to_char("Format: dig <dir> <room number>\r\n", ch);
    return; }
 if (rroom <= 0) {

sprintf(buf, "There is no room with the number %d", iroom);

send_to_char(buf, ch);

return; }
/* Main stuff */
    switch (*buf2) {
    case 'n':
    case 'N':
      dir = NORTH;
      break;
    case 'e':
    case 'E':
      dir = EAST;
      break;
    case 's':
    case 'S':
      dir = SOUTH;
      break;
    case 'w':
    case 'W':
      dir = WEST;
      break;
    case 'u':
    case 'U':
      dir = UP;
      break;
    case 'd':
    case 'D':
      dir = DOWN;
      break; }

CREATE(world[rroom].dir_option[rev_dir[dir]], struct room_direction_data,1);
  world[rroom].dir_option[rev_dir[dir]]->general_description = NULL;
  world[rroom].dir_option[rev_dir[dir]]->keyword = NULL;
  world[rroom].dir_option[rev_dir[dir]]->to_room = ch->in_room;

CREATE(world[ch->in_room].dir_option[dir], struct room_direction_data,1);
  world[ch->in_room].dir_option[dir]->general_description = NULL;
  world[ch->in_room].dir_option[dir]->keyword = NULL;
  world[ch->in_room].dir_option[dir]->to_room = rroom;

/* Only works if you have Oasis OLC */
  olc_add_to_save_list((iroom/100), OLC_SAVE_ROOM);

 sprintf(buf, "You make an exit %s to room %d.\r\n", buf2, iroom);
 send_to_char(buf, ch);
}



<< Coke Machine Special Procedure [by Sliver] | Reply | View as text | Flattened | Colour For Circle [by Nashak] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.
 
 


Dig Command
by Marc Lank (mesa@enia.net) on Sunday, December 31st @ 11:28:55 AM
http://
i used your copyto and dig commands to improve the olc capabilites on the mud and they make things much easier..but is there anyway to make it create a room on the fly if there isnt one there?
[ Reply to this comment ]