SHARE
TWEET

Untitled

a guest Jun 19th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #6:@icjoin   any none none
  2. if (!args)
  3.   player:tell("Usage: @icjoin <player/npc>");
  4.   return;
  5. endif
  6. target = $string_utils:match_actor(args[1]);
  7. if (target == #-2)
  8.   player:tell(args[1], " could be a few different people. Be more specific.");
  9.   return;
  10. elseif (target == #-3)
  11.   player:tell(args[1], " isn't a player or NPC.");
  12.   return;
  13. endif
  14. rooms = {};
  15. loc = target.location;
  16. if (is_player(target) && !(target in connected_players()))
  17.   player:tell(target:title(), " isn't logged on, thus you can't @icjoin ", target.po, ".");
  18.   return;
  19. elseif (player.location == target.location)
  20.   player:tell("You're already in the room with ", target:title(), ".");
  21.   return;
  22. elseif (!$object_utils:isa(player.location, $room))
  23.   player:tell("Sorry, your current location doesn't support this feature.");
  24.   return;
  25. elseif (target.location.ooc)
  26.   player:tell("There's no need to @icjoin someone in an OOC area.");
  27.   return;
  28. elseif (parent(target.location) == $fp_room)
  29.   player:tell("You can't @icjoin someone in the Fantasy Game.");
  30.   return;
  31. elseif (parent(player.location) == $fp_room)
  32.   player:tell("You can't @icjoin someone from within the Fantasy Game.");
  33.   return;
  34. elseif (parent(target.location) == $battleroom)
  35.   player:tell("Moving you to ", loc.exita[2].name, ".");
  36.   player.location:announce(player:title(), " leaves.");
  37.   suspend(2);
  38.   player:moveto(loc.exita[2]);
  39.   player.location:announce(player:title(), " has arrived.");
  40.   return;
  41. elseif (target.location == #2315 && $ansi_utils:delete(#2315.name) == "Battleroom 4")
  42.   player:tell("Moving you to ", loc.exita.name, ".");
  43.   player.location:announce(player:title(), " leaves.");
  44.   suspend(2);
  45.   player:moveto(loc.exita);
  46.   player.location:announce(player:title(), " has arrived.");
  47.   return;
  48. elseif (!$object_utils:has_property(target.location, "ventrances"))
  49.   "if the commented-out if below is used instead, this should ask for vexits insead of ventrances";
  50.   player:tell(target:title(), "'s current location doesn't support this command.");
  51.   return;
  52.   "elseif (target.location.vexits == {})";
  53. elseif (target.location.ventrances == {} && target.location.entrances == {})
  54.   "even if you can't get out, if you can get in you should be able to @icjoin";
  55.   player:tell(target:title(), "'s current location doesn't support this command.");
  56.   return;
  57. elseif ($exit_utils:map_exit_path(player.location, target.location) == {})
  58.   player:tell("You cannot @icjoin someone at that location since you cannot `path` to it from here.");
  59.   return;
  60. endif
  61. if (target.location.ventrances != {})
  62.   for a in (target.location.ventrances)
  63.     "as before, if vexits are the way to go, change this if";
  64.     "..If its an obvious entrance and the room isn't a barracks and the room isn't a Commander's Quarters..";
  65.     "if you're using ventrances, a[4], if you're using vexits, a[3]";
  66.     "if (a[5]) means 'if the exit is not hidden'";
  67.     if (!valid(a[3]) || !valid(a[4]))
  68.       continue;
  69.     elseif (a[5] && isa(a[4], $vroom) && parent(a[4]) != $vbarracks && a[4].owner.home != a[4])
  70.       rooms = setadd(rooms, a[4]);
  71.     endif
  72.   endfor
  73. endif
  74. if (target.location.entrances != {})
  75.   for b in (target.location.entrances)
  76.     "if vexits are the way to go, change entrances to exits and source to dest";
  77.     if (b.obvious && parent(b.source) != $vbarracks && b.source.owner.home != b)
  78.       rooms = setadd(rooms, b.source);
  79.     endif
  80.   endfor
  81. endif
  82. if (player.location in rooms)
  83.   player:tell("You are already in a room connected to ", target:title(), "'s location. (", target.location.name, ")");
  84.   return;
  85. elseif (rooms == {})
  86.   player:tell(target:title(), "'s current location doesn't support this command.");
  87.   return;
  88. endif
  89. halls = {};
  90. for b in (rooms)
  91.   if (parent(b) == $battleroom || (b == #2315 && $ansi_utils:delete(#2315.name) == "Battleroom 4"))
  92.     rooms = setremove(rooms, b);
  93.   elseif ($object_utils:has_property(b, "vexits"))
  94.     for c in (b.vexits)
  95.       "..This tries to figure out if the room is a hallway..I think every hallway has these kinds of exits..";
  96.       if (c[1] in {"port", "starboard", "(P)ort", "(S)tarboard"})
  97.         halls = setadd(halls, b);
  98.       endif
  99.     endfor
  100.   endif
  101. endfor
  102. player:tell("Moving you to a location close to ", target.location.name, ".");
  103. suspend(2);
  104. if (target.location != loc)
  105.   player:tell(target:title(), " has moved. Please try again.");
  106.   return;
  107. endif
  108. player.location:announce(player:title(), " leaves.");
  109. "..Better to deposit someone in a hallway than in the middle of a classroom..";
  110. if (halls != {})
  111.   player:moveto(halls[random(length(halls))]);
  112. else
  113.   player:moveto(rooms[random(length(rooms))]);
  114. endif
  115. player.location:announce(player:title(), " has arrived.");
  116. if ($object_utils:has_property(player.location, "vexits"))
  117.   for zot in (player.location.vexits)
  118.     if (zot[3] == target.location)
  119.       player:tell(target:title(), " is located through ", zot[2][1]);
  120.       return;
  121.     endif
  122.   endfor
  123.   for toz in (player.location.exits)
  124.     if (toz.dest == target.location)
  125.       player:tell(target:title(), " is located through ", toz.listname);
  126.       return;
  127.     endif
  128.   endfor
  129. endif
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top