View/Edit #2168!@verbsearch

File name: @verbsearch
@verbsearch
any
any
any
#2168
rdo
"Copied from Dizzy_Devil (#9299):@verbsearch Jun 17 23:00:06 1999";
"Copied from cocacola (#2444):@verbsearch Jun 16 19:19:51 1999";
"Copied from chase (#1281):@verbsearch May  8 16:25:23 1999";
"Copied from HannaH (#9579):@verbsearch May  7 17:58:05 1999";
"Copied from Wanderer (#1057):@verbsearch Mar 20 13:39:00 1999";
"@searchdump version 2.0 -- coded by Wanderer (#1057).";
"Searches for a keyword in every verb accessible to the player on the entire MOO.";
"Runs fast and efficiently, and uses try so no traceback occurs.";
"Players are allowed to freely @copy this verb however please do not modify it without";
"Wanderer's expressed permission.";
if (player != this)
  return player:tell("Please use @copy to copy this verb to yourself so you can use it.");
endif
if ($object_utils:has_property(player, "search_dump"))
  player:tell("You have a property of .search_dump.  Would you like the search to dump to this property instead of filling your screen?");
  ch = $cmd_utils:yes_or_no("Dump to property instead of screen? ");
  dump_yn = ch;
else
  player:tell("If you wish to be able to dump to a property instead of the search results filling your screen, please add a .search_dump property to yourself.");
  dump_yn = 0;
endif
if (dump_yn)
  player.search_dump = {};
endif
player:tell("Searching for \"", argstr, "\"...  Type @kill all to kill this task!");
tally = 0;
for x in [#0..#9999]
  y = toobj(x);
  try
    z = verbs(y);
    $command_utils:suspend_if_needed();
    for abc in (z)
      black = index(abc, " ");
      white = index(abc, "*");
      if (!black && !white)
        quack = abc;
      elseif (black > white && !white)
        quack = abc[1..black - 1];
      elseif (white > black && !black)
        quack = abc[1..white - 1];
      elseif (black > white)
        quack = abc[1..white - 1];
      elseif (white > black)
        quack = abc[1..black - 1];
      endif
      for cat in (verb_code(y, quack))
        if (index(cat, argstr))
          if (dump_yn)
            player.search_dump = {@player.search_dump, tostr("## FOUND: ", y, ":", abc, " line ", cat in verb_code(y, quack))};
          else
            player:tell("## FOUND: ", y, ":", abc, " line ", cat in verb_code(y, quack));
          endif
          tally = tally + 1;
        endif
        $command_utils:suspend_if_needed();
      endfor
    endfor
  except (ANY)
    "Didn't work.  Damn.";
  endtry
endfor
player:tell("Search complete; ", tally, " matches found.");
if (dump_yn)
  player.search_dump = {@player.search_dump, tostr("Matches found: ", tally)};
  player:tell("Search results have been dumped to your .search_dump property.");
endif

http://files.moo.ca:8081/2/1/6/8/@verbsearch
Size: 2,686 bytes.
File perms: Readable


You are not logged in.

[home | help | who | search | setup | code]