View/Edit #9579:@verbsearch

Switch to edit mode.

Name(s): @verbsearch
1:  "Copied from Wanderer (#1057):@verbsearch Mar 20 13:39:00 1999"
2:  "@searchdump version 2.0 -- coded by Wanderer (#1057)."
3:  "Searches for a keyword in every verb accessible to the player on the entire MOO."
4:  "Runs fast and efficiently, and uses try so no traceback occurs."
5:  "Players are allowed to freely @copy this verb however please do not modify it without"
6:  "Wanderer's expressed permission."
7:  if (player != this)
8:    return player:tell("Please use @copy to copy this verb to yourself so you can use it.")
9:  endif
10: if ($object_utils:has_property(player, "search_dump"))
11:   player:tell("You have a property of .search_dump.  Would you like the search to dump to this property instead of filling your screen?")
12:   ch = $cmd_utils:yes_or_no("Dump to property instead of screen? ")
13:   dump_yn = ch
14: else
15:   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.")
16:   dump_yn = 0
17: endif
18: if (dump_yn)
19:   player.search_dump = {}
20: endif
21: player:tell("Searching for \"", argstr, "\"...  Type @kill all to kill this task!")
22: tally = 0
23: for x in [#0..#9999]
24:   y = toobj(x)
25:   try
26:     z = verbs(y)
27:     $command_utils:suspend_if_needed()
28:     for abc in (z)
29:       black = index(abc, " ")
30:       white = index(abc, "*")
31:       if (!black && !white)
32:         quack = abc
33:       elseif (black > white && !white)
34:         quack = abc[1..black - 1]
35:       elseif (white > black && !black)
36:         quack = abc[1..white - 1]
37:       elseif (black > white)
38:         quack = abc[1..white - 1]
39:       elseif (white > black)
40:         quack = abc[1..black - 1]
41:       endif
42:       for cat in (verb_code(y, quack))
43:         if (index(cat, argstr))
44:           if (dump_yn)
45:             player.search_dump = {@player.search_dump, tostr("## FOUND: ", y, ":", abc, " line ", cat in verb_code(y, quack))}
46:           else
47:             player:tell("## FOUND: ", y, ":", abc, " line ", cat in verb_code(y, quack))
48:           endif
49:           tally = tally + 1
50:         endif
51:         $command_utils:suspend_if_needed()
52:       endfor
53:     endfor
54:   except (ANY)
55:     "Didn't work.  Damn."
56:   endtry
57: endfor
58: player:tell("Search complete; ", tally, " matches found.")
59: if (dump_yn)
60:   player.search_dump = {@player.search_dump, tostr("Matches found: ", tally)}
61:   player:tell("Search results have been dumped to your .search_dump property.")
62: endif

Verb arguments: any any any
Verb perms: Readable NOT-Debug
Verb owned by: TriNitY (#9579)

You are not logged in.

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