Re: [GOHOME] Repost.

From: Admin (admin@mudservices.com)
Date: 01/29/97


Sorry about the repost. Since I screwed the first one up, and have been
asked by several people to repost it, here it is, with all the
instructions needed :)



> In player_special_data_saved in structs.h, you will see a bunch of spares.
> Change one of them to int gohome.
> 
> then in utils.h, right below GET_PRACTICES(ch), put this line:
> 
> #define GET_GOHOME(ch)          ((ch)->player_specials->saved.gohome)
> 


In interpreter.c, with all the ACMD prototypes, put the following lines:
	ACMD(do_gohome);
	ACMD(do_takehome);
	ACMD(do_givehome);

Then, in the command list, make the command declarations like this:

{ "gohome", POS_STANDING, do_gohome, 1, 0 },

{ "givehome", POS_DEAD, do_givehome, LVL_GRGOD, 0 },

{ "takehome", POS_DEAD, do_takehome, LVL_GRGOD, 0 },

Here are the commands, just put these in whatever .c file you want.:

ACMD(do_gohome)
{

if (GET_GOHOME(ch) == 0)
{
  send_to_char("You don't have a gohome!\r\n", ch);
  return;
}

if (real_room(GET_GOHOME(ch)) < 0)
{
  sprintf(buf, "Invalid Gohome, Room %d does not exist.\r\n",
GET_GOHOME(ch));
  send_to_char(buf, ch);
  return;
}

  sprintf(buf, "%s fades into nothingness and is gone.\r\n",
GET_NAME(ch));
  send_to_room(buf, ch->in_room);
  char_from_room(ch);
  char_to_room(ch, real_room(GET_GOHOME(ch)));
  sprintf(buf, "%s appears in a flash of blinding light!\r\n",
GET_NAME(ch));
  send_to_room(buf, ch->in_room);
  look_at_room(ch, 0);

}


ACMD(do_givehome)
{
  struct char_data *vict;
  int home;

  half_chop(argument, arg, buf);

  if (!*arg || !*buf || !isdigit(*buf))
  {
    send_to_char("Usage: givehome <player> <location>\r\n", ch);
    return;
   }

  if (!(vict = get_char_vis(ch, arg)))
  {
    send_to_char(NOPERSON, ch);
    return;
  }

  if (GET_GOHOME(vict) != 0)
  {
    send_to_char("Character already has a gohome, remove the old one
first!\r\n", ch$
    return;
   }

  home = atoi(buf);

  if (real_room(home) < 0)
  {
  send_to_char("Room does not exist.\r\n", ch);
  return;
  }

  GET_GOHOME(vict) = home;
  GET_LOADROOM(vict) = home;
  sprintf(buf1, "You make %s a gohome!\r\n", GET_NAME(vict));
  send_to_char(buf1, ch);
  sprintf(buf1, "%s makes you a gohome!\r\n", GET_NAME(ch));
  send_to_char(buf1, vict);
}

ACMD(do_takehome)
{
  struct char_data *vict;

  skip_spaces(&argument);

  if (!*argument)
  {
    send_to_char("Usage: takehome <player>\r\n", ch);
    return;
  }

  if (!(vict = get_char_vis(ch, argument)))
  {
     send_to_char(NOPERSON, ch);
     return;
  }

  if (GET_GOHOME(vict) == 0)
  {
    sprintf(buf, "%s does not even have a gohome!\r\n", GET_NAME(vict));
    send_to_char(buf, ch);
    return;
  }

    GET_GOHOME(vict) = 0;
    sprintf(buf, "%s removes your gohome!\r\n", GET_NAME(ch));
    send_to_char(buf, vict);
    sprintf(buf, "You remove %s gohome!\r\n", GET_NAME(vict));
    send_to_char(buf, ch);
}



+-----------------------------------------------------------+
| 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/18/00 PST