Player Class hacked with eval that does substitutions and assorted stuff #8855

Parent #5803Owner Flags Source rpg_march_2006/Dependencies/8855.txt

Aliases: Player Class hacked with eval that does substitutions and assorted stuff, eval-test

22 verbs · 34 properties · 1 children

Verbs

VerbSpecFlagsDefinerLines
eval(old)this none thisr#885541
@defineany as any#885514
@undef*ineany none none#885513
@listdefsnone none nonerxd#885520
initializethis none this#88558
'*any any anyrxd#885512
help_msgthis none thisrx#88555
movetothis none thisrxd#885514
fol*lowthis none nonerxd#885512
unfol*low stop-fol*lowing don't-fol*lowthis none nonerxd#885516
@list-fol*lowersnone none nonerxd#88551
loseany none nonerx#885532
@parentany none nonerxd#88556
_who's_followablethis none thisrx#885519
_who's_following_*none none nonerxd#885526
@list(old)this none thisr#885568
bonked_msgthis none thisrx#88556
@grep(old)this none thisr#885527
@paste(old)any any any#885525
@pasteany any anyrxd#885532
do_followersthis none thisrxd#885565
moveto(old)this none thisrxd#885556

Properties

PropertyDefinerFlagsOwnerValue
followable#8855rc0
followers#8855r#3685{}
follow_teleport#8855rc0
paste_footer#8855rc""
paste_header#8855rc""
spoof_attribution#8855" --"
idle_messages#8855not readable (E_PERM)
respond_to#8855not readable (E_PERM)
moved_by#8855{}
sessile#88550
witnessing#8855not readable (E_PERM)
rooms#8855{{"Living", #17}, {"Dining", #28}, {"Library", #1670}, {"Pool", #1428}}
messages_going#8855not readable (E_PERM)
mail_options#8855{"sticky", {"@mail", "new"}}
current_message#8855not readable (E_PERM)
messages#8855not readable (E_PERM)
features#8855{#55317, #30203, #40842, #26787}
previous_connection#8855not readable (E_PERM)
email_address#8855not readable (E_PERM)
help#8855#16122
linebuffer#8855not readable (E_PERM)
current_folder#8855not readable (E_PERM)
all_connect_places#8855not readable (E_PERM)
last_connect_place#8855not readable (E_PERM)
lines#8855not readable (E_PERM)
ownership_quota#8855not readable (E_PERM)
password#8855not readable (E_PERM)
size_quota#8855not readable (E_PERM)
last_password_time#8855not readable (E_PERM)
last_connect_attempt#8855not readable (E_PERM)
key#8855not readable (E_PERM)
aliases#8855{"Player Class hacked with eval that does substitutions and assorted stuff", "eval-test"}
description#8855"You see a player who looks like it has a Special Nifty eval command."
object_size#8855{27096, 1141286558}

Ancestry

Ancestors (nearest first): #5803 Experimental Guinea Pig Class with Even More Features of Dubious Utility#7069 Generic Player Class With Additional Features of Dubious Utility

Children: #33337 Politically Correct Featureful Player Class Created Because Nobody Would @Copy Verbs To 8855

Call graph

calls n8855_5 #8855:'* n5803_25 #5803:page n8855_5->n5803_25 n8855_7 #8855:moveto n8855_20 #8855:do_followers n8855_7->n8855_20 n7069_19 #7069:moveto n8855_7->n7069_19 n7069_1 #7069:title n8855_20->n7069_1 n7069_6 #7069:tell n8855_20->n7069_6 n8855_8 #8855:fol*low n8855_8->n7069_1 n8855_9 #8855:unfol*low n8855_9->n7069_1 n8855_21 #8855:moveto(old) n8855_21->n7069_1 n8855_21->n7069_6

Source

eval(old)

Spec this none thisFlags rOwner #2487Definer #8855

Referenced by

none

Source

1"Should be wizard-owned.";
2"A MOO-code evaluator.  Type `;CODE' or `eval CODE'.";
3"  For the case where CODE is an expression, we need to prepend `return ' and append `;' to CODE before passing it to eval().  For statements, though, we don't want to make any changes before passing it to eval().  The code below assumes that CODE is an expression unless it either begins with a semicolon `;' or one of the MOO language keywords.";
4"  If you set your .eval_time property to 1, you find out how many ticks and seconds you used.  Also allows you to have your own predefined variables like `here' and `me': These should be set with the @define and @undef commands.  To list your current @defines, use the @listdefs command.  Player.eval_ticks may be subtracted from the resulting tick count; the author never really followed that, and would appreciate any assistance on fixing it if it doesn't work.";
5set_task_perms(player);
6argstr = argstr + ";";
7start = 1;
8while (argstr[start] == " ")
9  start = start + 1;
10endwhile
11end = start;
12while (("A" <= (l = argstr[end])) && (l <= "Z"))
13  end = end + 1;
14endwhile
15if ((argstr[start] == ";") || (argstr[start..end - 1] in {"if", "for", "fork", "return", "while"}))
16  program = this:fixeval(argstr);
17else
18  program = this:fixeval("return " + argstr);
19endif
20ticks = (ticks_left() - 13) - player.eval_ticks;
21seconds = seconds_left();
22value = eval(program);
23seconds = seconds - seconds_left();
24ticks = ticks - ticks_left();
25if (value[1])
26  val = value[2];
27  if (typeof(val) == OBJ)
28    player:tell("=> ", val, "  ", valid(val) ? ("(" + val.name) + ")" | ((a = $list_utils:assoc(val, {{#-1, "<$nothing>"}, {#-2, "<$ambiguous_match>"}, {#-3, "<$failed_match>"}})) ? a[2] | "<invalid>"));
29  elseif (typeof(val) == ERR)
30    player:tell("=> ", $code_utils:error_name(val), "  (", val, ")");
31  else
32    player:tell("=>  ", $string_utils:print(value[2]));
33  endif
34  if (player.eval_time && (!output_delimiters(player)[2]))
35    player:tell("[used ", ticks, " tick", (ticks != 1) ? "s, " | ", ", seconds, " second", (seconds != 1) ? "s" | "", ".]");
36  endif
37else
38  player:tell_lines(value[2]);
39  nerrors = length(value[2]);
40  player:tell(nerrors, " error", (nerrors == 1) ? "." | "s.");
41endif

@define

Spec any as anyDefiner #8855

Referenced by

none

Source

1"Define <label> as <value>";
2"eval will then substitute <value> for <label> in any code it's given.";
3label = dobjstr;
4value = iobjstr;
5if ((!label) || (!value))
6  player:tell("Usage: @define <label> as <value>");
7else
8  if (place = $list_utils:iassoc(label, player.eval_subs))
9    player.eval_subs = listset(player.eval_subs, {label, value}, place);
10  else
11    player.eval_subs = listappend(player.eval_subs, {label, value});
12  endif
13  player:tell("Defined ", label, " as ", value, ".");
14endif

@undef*ine

Spec any none noneDefiner #8855

Referenced by

none

Source

1"@undef <label>";
2"Undefine a label for eval.  See eval and @define for more information.";
3label = dobjstr;
4if (!label)
5  player:tell("Usage: @undef <label>");
6else
7  if (place = $list_utils:iassoc(label, player.eval_subs))
8    player.eval_subs = listdelete(player.eval_subs, place);
9    player:tell("Label ", label, " now undefined.");
10  else
11    player:tell("Label ", label, " not found.");
12  endif
13endif

@listdefs

Spec none none noneFlags rxdDefiner #8855

Referenced by

none

Source

1"List the definitions made with @define.";
2labels = $list_utils:slice(player.eval_subs, 1);
3values = $list_utils:slice(player.eval_subs, 2);
4if (labels)
5  maxlen = length("Label");
6  for label in (labels)
7    if (length(label) > maxlen)
8      maxlen = length(label);
9    endif
10  endfor
11  maxlen = maxlen + 1;
12  player:tell($string_utils:left("Label", maxlen), "Value");
13  player:tell($string_utils:left("-----", maxlen), "-----");
14  for i in [1..length(player.eval_subs)]
15    player:tell($string_utils:left(labels[i], maxlen), values[i]);
16  endfor
17  player:tell($string_utils:left("-----", maxlen), "-----");
18else
19  player:tell("No labels defined.");
20endif

initialize

Spec this none thisDefiner #8855

Referenced by

none

Source

1if ((caller == this) || $perm_utils:controls(caller_perms(), this))
2  if (!this.eval_subs)
3    this.eval_subs = {{"HERE", "player.location"}, {"ME", "player"}};
4  endif
5  return pass(@args);
6else
7  return E_PERM;
8endif

'*

Spec any any anyFlags rxdDefiner #8855

Referenced by

none

Source

1"Usage:  '<player> <message>";
2"Shortcut for page.";
3if (!(who = verb[2..length(verb)]))
4  player:tell("Usage:  '<player> <message>");
5else
6  if (argstr)
7    argstr = tostr(who, " ", argstr);
8  else
9    argstr = who;
10  endif
11  this:page(who, @args);
12endif

help_msg

Spec this none thisFlags rxDefiner #8855

Referenced by

none

Source

1if (this != #8855)
2  return this.help_msg;
3else
4  return this.help:get_topic(tostr(this));
5endif

moveto

Spec this none thisFlags rxdOwner #3685Definer #8855

Referenced by

Source

1"Special moveto to move followers.";
2"Set .followable = 0 to disallow people from following you.";
3"Set .follow_teleport = 1 to allow people to follow you when you move by teleportation (e.g. home or @move).";
4"@list-followers to see who's following you currently.";
5"lose <player> will delete <player> from your .followers list.";
6"moved the work to :do_followers";
7if (this.followable && this.followers)
8  call = callers();
9  src = this.location;
10  fork (1)
11    this:do_followers(src, call);
12  endfork
13endif
14return pass(@args);

fol*low

Spec this none noneFlags rxdOwner #3685Definer #8855

Referenced by

none

Source

1"follow <player> will cause you to follow <player> everywhere <player> goes, as long as you can go there too.  If <player> teleports, you will only follow him if <player>.follow_teleport is nonzero.";
2"";
3"unfollow <player> will stop you from following <player>.";
4if ((player in this.followers) || (player == this))
5  player:tell(("You are already following " + this:title()) + "!");
6elseif (!this.followable)
7  player:tell(this:titlec(), " does not want to be followed right now.");
8else
9  this.followers = listappend(this.followers, player);
10  player:tell(("You now follow " + this:title()) + ".");
11  player.location:announce_all_but({player}, ((player:titlec() + " now follows ") + this:title()) + ".");
12endif

unfol*low stop-fol*lowing don't-fol*low

Spec this none noneFlags rxdOwner #3685Definer #8855

Referenced by

none

Source

1"follow <player> will cause you to follow <player> everywhere <player>";
2"goes, as long as you can go there too.  If <player> teleports, you will";
3"only follow him if <player>.follow_teleport is nonzero.";
4"";
5"unfollow <player> will stop you from following <player>.";
6if (callers())
7  player = caller;
8endif
9index = player in this.followers;
10if (index)
11  this.followers = listdelete(this.followers, index);
12  player:tell(("You no longer follow " + this:title()) + ".");
13  player.location:announce_all_but({player}, ((player:titlec() + " no longer follows ") + this:title()) + ".");
14else
15  player:tell(("But you don't follow " + this:title()) + "!");
16endif

@list-fol*lowers

Spec none none noneFlags rxdOwner #3685Definer #8855

Referenced by

none

Source

1player:tell("You sense that ", $string_utils:english_list($list_utils:map_verb(player.followers, "title"), "no one"), (length(player.followers) < 2) ? " is " | " are ", "following you.");

lose

Spec any none noneFlags rxOwner #3685Definer #8855

Referenced by

none

Source

1"'lose <name>' will get rid of <name>, if <name> is following you.";
2"'lose all/every{thing,one,body}' is allowed also.";
3losers = {};
4if (!dobjstr)
5  player:tell("Lose whom?");
6elseif (!(dobj in player.followers))
7  dobj = $string_utils:match(dobjstr, player.followers, "aliases");
8  if (dobj == $failed_match)
9    if (dobjstr in {"all", "everyone", "everything", "everybody"})
10      losers = player.followers;
11    else
12      if ($object_utils:has_callable_verb(player.location, verb))
13        player.location:(verb)();
14      else
15        player:tell("There's no one named \"", dobjstr, "\" following you.");
16      endif
17    endif
18  elseif (dobj == $ambiguous_match)
19    player:tell("\"", dobjstr, "\" could mean more than one person who is following you.");
20  else
21    losers = {dobj};
22  endif
23else
24  losers = {dobj};
25endif
26for fol in (losers)
27  player:tell("Losing ", fol:title(), ".");
28  player.followers = setremove(player.followers, fol);
29  fol:tell(player:titlec(), " lost you!");
30  fol.location:announce_all_but({fol, player}, player:titlec(), " lost ", fol:title(), "!");
31endfor
32return losers;

@parent

Spec any none noneFlags rxdDefiner #8855

Referenced by

none

Source

1"@parent <thing> - only tell you one parent.";
2if (!dobjstr)
3  player:tell("Usage:  @parent <object>");
4elseif (!$command_utils:object_match_failed(dobj = player:my_match_object(dobjstr), dobjstr))
5  player:tell($string_utils:names_of({dobj, parent(dobj)}));
6endif

_who's_followable

Spec this none thisFlags rxDefiner #8855

Referenced by

none

Source

1"Called by \"who's followable\" and \"@who's followable in <room>\"";
2where = args[1];
3connected_players = connected_players();
4if (where == player.location)
5  where_name = "here";
6  no_one = "No one else %l seems to be followable.";
7else
8  where_name = "in " + where.name;
9  no_one = "No one seems to be followable in %l.";
10endif
11someone = "%w %a followable %l.";
12who_all = {};
13for thing in (where.contents)
14  if (((is_player(thing) && (thing != player)) && (thing in connected_players())) && thing.followable)
15    who_all = {@who_all, thing};
16  endif
17endfor
18wo = this:feature("who's");
19player:tell(wo:("who's_substitute")(who_all ? someone | no_one, $list_utils:map_arg(wo, "who's_title", who_all), where_name));

_who's_following_*

Spec none none noneFlags rxdDefiner #8855

Referenced by

none

Source

1name = verb[18..length(verb)];
2who = $string_utils:match_player(name);
3if ($command_utils:object_match_failed(who, name))
4  return;
5elseif (!$object_utils:has_property(who, "followable"))
6  player:tell($string_utils:pronoun_sub("%n is not followable.", who));
7  return;
8endif
9where = args[1];
10main = args[2];
11followers = who.followers;
12if (where == player.location)
13  where_name = "";
14  who_all = followers;
15else
16  where_name = " in " + where.name;
17  who_all = $set_utils:intersection(where.contents, followers);
18endif
19if (main in followers)
20  no_one = ("No one else%l seems to be following " + who:title()) + ".";
21else
22  no_one = ("No one%l seems to be following " + who:title()) + ".";
23endif
24someone = ("%w %a following " + who:title()) + "%l.";
25wo = this:feature("who's");
26player:tell(wo:("who's_substitute")(who_all ? someone | no_one, wo:("who's_titles")(who_all, 1), where_name));

@list(old)

Spec this none thisFlags rOwner #24442Definer #8855

Referenced by

none

Source

1"Like the standard @list, but allows you to specify ranges of lines:";
2"  @list me:foo 14..16, ..9, 28..";
3"lists lines 1-9, 14-16, and 28-$ of the verb.";
4set_task_perms(player);
5nargs = length(args);
6if ((((nargs > 2) && (args[2] == "with")) && (index("parentheses", args[3]) == 1)) || (((nargs > 4) && (args[4] == "with")) && (index("parentheses", args[5]) == 1)))
7  pflag = 1;
8else
9  pflag = 0;
10endif
11if ((((nargs > 2) && (args[2] == "without")) && (index("numbers", args[3]) == 1)) || (((nargs > 4) && (args[4] == "without")) && (index("numbers", args[5]) == 1)))
12  nflag = 0;
13else
14  nflag = 1;
15endif
16range_st = ((-2 * nflag) + (2 * pflag)) + 4;
17"if (nargs - 2 * pflag + 2 * nflag != 3 || !(spec = $code_utils:parse_verbref(args[1])))";
18if (!(spec = $code_utils:parse_verbref(args[1])))
19  player:notify("Usage:  @list <object>:<verb> [with parentheses] [without numbers]");
20  return;
21endif
22object = $string_utils:match_object(spec[1], player.location);
23if ($command_utils:object_match_failed(object, spec[1]))
24  return;
25endif
26what = object;
27vname = spec[2];
28while ((what != $nothing) && ((code = verb_code(what, vname, pflag)) == E_VERBNF))
29  what = parent(what);
30endwhile
31range_spec = $string_utils:from_list(args[range_st..nargs], " ");
32if (range_spec)
33  seq = $seq_utils:from_string(range_spec);
34else
35  seq = {1, length(code) + 1};
36endif
37if (code == E_VERBNF)
38  player:notify("That object does not define that verb.");
39elseif (typeof(code) == ERR)
40  player:notify(tostr(code));
41  "elseif (typeof(range = this:parse_range(length(code), {\"1-$\"}, 1, \"That verb has not been programmed.\", @args[range_st..nargs])) != LIST)";
42elseif (typeof(seq) == ERR)
43  player:notify(tostr("Range error: ", seq));
44  "elseif (range[3] && !(nonum = \"nonum\" == $string_utils:trim(range[3])))";
45  "player:notify(tostr(\"Don't understand this:  \", range[3]));";
46else
47  if (what != object)
48    player:notify(tostr("Object ", object, " does not define that verb, but its ancestor ", what, " does."));
49  endif
50  info = verb_info(what, vname);
51  vargs = verb_args(what, vname);
52  if (index(vargs[2], "/"))
53    vargs = listset(vargs, tostr("(", vargs[2], ")"), 2);
54  endif
55  player:notify(tostr(what, ":", info[3], "   ", $string_utils:from_list(vargs, " ")));
56  lines = $seq_utils:tolist($seq_utils:intersection(seq, {1, length(code) + 1}));
57  for line in (lines)
58    if (!nflag)
59      number = "";
60    elseif (line < 10)
61      number = tostr(" ", line, ":  ");
62    else
63      number = tostr(line, ":  ");
64    endif
65    player:notify(tostr(number, code[line]));
66    $command_utils:suspend_if_needed(0);
67  endfor
68endif

bonked_msg

Spec this none thisFlags rxOwner #15550Definer #8855

Referenced by

none

Source

1if (typeof(this.bonked_msg) != LIST)
2  msg = this.bonked_msg;
3elseif (length(this.bonked_msg))
4  msg = this.bonked_msg[random(length(this.bonked_msg))];
5endif
6return $string_utils:pronoun_sub(msg || "");

@grep(old)

Spec this none thisFlags rOwner #24442Definer #8855

Referenced by

none

Source

1set_task_perms(player);
2if (prepstr == "in")
3  pattern = dobjstr;
4  objlist = $code_utils:eval_d(("return " + iobjstr) + ";");
5  if (!objlist[1])
6    player:tell("Had trouble reading `", iobjstr, "':  ");
7    player:tell_lines(@objlist[2]);
8    return;
9  elseif (typeof(objlist[2]) == OBJ)
10    objlist = {objlist[2..2]};
11  elseif (typeof(objlist[2]) != LIST)
12    player:notify(tostr("Value of `", iobjstr, "' is not an object or list:  ", $string_utils:print(objlist[2])));
13    return;
14  else
15    objlist = objlist[2..2];
16  endif
17elseif (args && player.wizard)
18  pattern = argstr;
19  objlist = {};
20else
21  bracket = player.wizard ? "[]" | "";
22  player:tell("Usage:  @grep <pattern> ", player.wizard ? "[in {objectlist}]" | "in {objectlist}");
23  return;
24endif
25player:tell("Searching for verbs in ", iobjstr, " containing the string ", $string_utils:print(pattern), " ...");
26player:tell();
27$code_utils:find_verbs_containing(pattern, @objlist);

@paste(old)

Spec any any anyDefiner #8855

Referenced by

none

Source

1"Usage: @paste <prefix> <suffix>";
2"Announce a series of entered lines to the room the player is in.";
3"Before the lines are quoted, player.paste_header is run through";
4"$string_utils:pronoun_sub(), and if the result contains the player's";
5"name, it is used as a header.  Otherwise player.name centered in a";
6"line of dashes is used.";
7"A footer comes afterwards, likewise derived from player.paste_footer.";
8"<prefix> and <suffix> are placed before and after each line.";
9"";
10"This verb is, as one might guess, designed for pasting text to MOO using";
11"GnuEmacs or a windowing system.  You should remember that after you";
12"have pasted the lines in, you must type . on a line by itself, or you'll";
13"sit around waiting for $command_utils:read_lines() to finish _forever_.";
14len = length(args);
15prefix = len ? args[1] | "";
16suffix = (len > 1) ? args[2] | "";
17lines = $command_utils:read_lines();
18header = $string_utils:pronoun_sub_secure(player.paste_header, "") || $string_utils:center(player.name, 75, "-");
19player.location:announce_all(header);
20for line in (lines)
21  $command_utils:suspend_if_needed(0);
22  player.location:announce_all((prefix + line) + suffix);
23endfor
24footer = $string_utils:pronoun_sub_secure(player.paste_footer, "") || $string_utils:center(player.name, 75, "-");
25player.location:announce_all(footer);

@paste

Spec any any anyFlags rxdDefiner #8855

Referenced by

none

Source

1"Usage: @paste <prefix> <suffix>";
2"Announce a series of entered lines to the room the player is in.";
3"Before the lines are quoted, player.paste_header is run through";
4"$string_utils:pronoun_sub(), and if the result contains the player's";
5"name, it is used as a header.  Otherwise player.name centered in a";
6"line of dashes is used.";
7"A footer comes afterwards, likewise derived from player.paste_footer.";
8"<prefix> and <suffix> are placed before and after each line.";
9"";
10"This verb is, as one might guess, designed for pasting text to MOO using";
11"GnuEmacs or a windowing system.  You should remember that after you";
12"have pasted the lines in, you must type . on a line by itself, or you'll";
13"sit around waiting for $command_utils:read_lines() to finish _forever_.";
14len = length(args);
15prefix = len ? args[1] | "";
16suffix = (len > 1) ? args[2] | "";
17lines = $command_utils:read_lines();
18to_tell = {$string_utils:pronoun_sub_secure(this.paste_header, "") || $string_utils:center(player.name, 75, "-")};
19for line in (lines)
20  to_tell = listappend(to_tell, (prefix + line) + suffix);
21endfor
22if (this.paste_footer)
23  to_tell = listappend(to_tell, $string_utils:pronoun_sub($code_utils:verb_or_property(this, "paste_footer")));
24else
25  to_tell = listappend(to_tell, $string_utils:center(player.name, 75, "-"));
26endif
27for thing in (player.location.contents)
28  "$command_utils:suspend_if_needed(0);";
29  suspend(0);
30  thing:tell_lines(to_tell);
31endfor
32player:tell("Done @pasting.");

do_followers

Spec this none thisFlags rxdOwner #58016Definer #8855

Referenced by

Source

1"Special moveto to move followers.";
2"Set .followable = 0 to disallow people from following you.";
3"Set .follow_teleport = 1 to allow people to follow you when you move by teleportation (e.g. home or @move).";
4"@list-followers to see who's following you currently.";
5"lose <player> will delete <player> from your .followers list.";
6if (caller != this)
7  raise(E_PERM);
8endif
9{src, call} = args;
10dest = this.location;
11is_exit = 0;
12for ex in ($list_utils:slice(call))
13  if ($object_utils:isa(ex, $exit))
14    exit = ex;
15    is_exit = 1;
16  endif
17endfor
18"Check for some pathological cases: we must either be connected, or else not a player, and we must be actually going somewhere reasonable.";
19if (((((!is_player(this)) || $object_utils:connected(this)) && (!(dest in {$nothing, $limbo, src}))) && (src != $nothing)) && (!$object_utils:isa(dest, $generic_editor)))
20  for follower in (this.followers)
21    isp = is_player(follower);
22    "It's not called 'stalk', so give up when disconnected!";
23    if ((!$recycler:valid(follower)) || (isp && (!$object_utils:connected(follower))))
24      this.followers = setremove(this.followers, follower);
25    elseif (follower in src.contents)
26      "Chase me! Chase me!";
27      if (is_exit)
28        fork (0)
29          "clear callers() stack for paranoid exits.";
30          set_task_perms(follower.owner);
31          player = follower;
32          follower:tell("You follow ", this:title(), ".");
33          if (isp)
34            "Ah, the last frame should be the exit name, duplicate";
35            force_input(follower, call[$][2]);
36          else
37            exit:move(follower);
38          endif
39          if (follower.location != dest)
40            follower:tell("Looks like ", this:title(), " got away!");
41          endif
42        endfork
43      elseif (this.follow_teleport)
44        "moveto was called by another verb (e.g. home)";
45        fork (0)
46          "again, clear callers() stack for paranoia";
47          set_task_perms(follower.owner);
48          player = follower;
49          follower:tell("You follow ", this:title(), ".");
50          loc = follower.location;
51          follower.location:announce_all_but({follower}, follower:titlec(), " follows ", this:title(), ".");
52          follower:moveto(this.location);
53          if (follower.location == this.location)
54            this:tell(follower:titlec(), " follows you.");
55            follower.location:announce_all_but({follower, this}, follower:titlec(), " follows ", this:title(), ".");
56          elseif (follower.location == loc)
57            follower:tell("Looks like ", this:title(), " got away!");
58            loc:announce_all_but({follower, this}, follower:titlec(), " looks bemused.");
59          endif
60        endfork
61      endif
62      $command_utils:suspend_if_needed(1);
63    endif
64  endfor
65endif

moveto(old)

Spec this none thisFlags rxdOwner #3685Definer #8855

Referenced by

none

Source

1"Copied from Player Class hacked with eval that does substitutions and assorted stuff (#8855):moveto by Doug (#3685) Tue Feb 16 09:06:32 1999 PST";
2"Special moveto to move followers.";
3"Set .followable = 0 to disallow people from following you.";
4"Set .follow_teleport = 1 to allow people to follow you when you move by teleportation (e.g. home or @move).";
5"@list-followers to see who's following you currently.";
6"lose <player> will delete <player> from your .followers list.";
7src = this.location;
8retval = pass(@args);
9if (this.followable && this.followers)
10  call = callers();
11  fork (1)
12    dest = this.location;
13    is_exit = 0;
14    for ex in ($list_utils:slice(call))
15      if ($object_utils:isa(ex, $exit))
16        exit = ex;
17        is_exit = 1;
18      endif
19    endfor
20    connected_players = connected_players();
21    "Check for some pathological cases: we must either be connected, or else not a player, and we must be actually going somewhere reasonable.";
22    if (((((!is_player(this)) || (this in connected_players)) && (!(dest in {#-1, $limbo, src}))) && (src != #-1)) && (!$object_utils:isa(dest, $generic_editor)))
23      for follower in (this.followers)
24        "It's not called 'stalk', so give up when disconnected!";
25        if ((!valid(follower)) || (is_player(follower) && (!(follower in connected_players))))
26          this.followers = setremove(this.followers, follower);
27        elseif (follower in src.contents)
28          "Chase me! Chase me!";
29          if ((!is_player(follower)) || (follower in connected_players))
30            if (is_exit)
31              follower:tell("You follow ", this:title(), ".");
32              exit:move(follower);
33            elseif (this.follow_teleport)
34              "moveto was called by another verb (e.g. home)";
35              follower:tell("You follow ", this:title(), ".");
36              loc = follower.location;
37              follower.location:announce_all_but({follower}, follower:titlec(), " follows ", this:title(), ".");
38              follower:moveto(this.location);
39              if (follower.location == this.location)
40                this:tell(follower:titlec(), " follows you.");
41                follower.location:announce_all_but({follower, this}, follower:titlec(), " follows ", this:title(), ".");
42              elseif (follower.location == loc)
43                loc:announce_all_but({follower, this}, follower:titlec(), " looks bemused.");
44              endif
45            endif
46          endif
47          if (follower.location != dest)
48            follower:tell("Looks like ", this:title(), " got away!");
49          endif
50          $command_utils:suspend_if_needed(1);
51        endif
52      endfor
53    endif
54  endfork
55endif
56return retval;