Found a linkload snippet

  • dracmas
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
More
3 years 6 months ago #5171 by dracmas
Found a linkload snippet was created by dracmas
Found a linkload snippet online. Was trying the one from the circlemud website but didn't seem to get it to work. Next one was dropped in and didn't need modifications whatsoever.

Linkload loads up a player's character into the mud.

Snippet link: www.mudconnect.com/SMF/index.php?topic=74158.0
ACMD(do_linkload)
{
  char buf[MAX_INPUT_LENGTH];
  struct char_data *vict;

  one_argument(argument, buf);

  if (!*buf) {
    send_to_char(ch, "Syntax: linkload <player name>.  See help linkload.\r\n");
    return;
    }

  if (!(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD))) {
    CREATE(vict, struct char_data, 1);
    clear_char(vict);
    CREATE(vict->player_specials, struct player_special_data, 1);
    if (load_char(buf, vict) >= 0) {
      mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE,
        "(GC) Linkload: %s has linkloaded %s.", GET_NAME(ch), GET_NAME(vict));
      Crash_load(vict);
      vict->next = character_list;
      character_list = vict;
      vict->desc = NULL;
      char_to_room(vict, IN_ROOM(ch));
      act("You gesture and bring $N into existence before you.",
        FALSE, ch, 0, vict, TO_CHAR);
      act("$n gestures and brings $N into existence before $m.",
        FALSE, ch, 0, vict, TO_NOTVICT);
      }
    else {
      send_to_char(ch, "%s", CONFIG_NOPERSON);
      free(vict);
      return;
      }
    }
  else {
    send_to_char(ch, "You can't linkload someone already in the game.\r\n");
    return;
    }
}

When I added the snippet into my own code, I placed it in act.wizard.c with other imp commands. But for people new to putting in a command like I am, that's not enough to get it to work. Somewhere in act.h the command needs to be added.

+ means add in the line ACMD(do_linkload); (not +)
 ACMD(do_plist);
ACMD(do_purge);
ACMD(do_recent);
+ACMD(do_linkload);
ACMD(do_restore);
void return_to_char(struct char_data * ch);
ACMD(do_return);

Lastly, add in linkload to interpreter.c
{ "levels" , "lev" , POS_DEAD , do_levels , 0, 0 },
{ "list" , "lis" , POS_STANDING, do_not_here , 0, 0 },
{ "links" , "lin" , POS_STANDING, do_links , LVL_GOD, 0 },
+ { "linkload" , "linkload", POS_DEAD , do_linkload , LVL_GRGOD, 0 },
{ "lock" , "loc" , POS_SITTING , do_gen_door , 0, SCMD_LOCK },
{ "load" , "load" , POS_DEAD , do_load , LVL_BUILDER, 0 },

Please Log in or Create an account to join the conversation.

Time to create page: 1.504 seconds