View/Edit #13:_list_verb

Switch to edit mode.

Name(s): _list_verb
1:   "@list <obj>:<verb> [<dobj> <prep> <iobj>] [with(out) parens|numbers] [ranges]"
2:   if (caller != this)
3:     raise(E_PERM)
4:   elseif (!this:isa($guardian))
5:     "Allow guardians to see all -r verbs."
6:     set_task_perms(this)
7:   endif
8:   {object, spec, args} = args
9:   pflag = 0
10:  nflag = 1
11:  argspec = {}
12:  range = {}
13:  while (args)
14:    if (args[1] && (index("without", args[1]) == 1 || args[1] == "wo"))
15:      "...w,wi,wit,with => 1; wo,witho,withou,without => 0..."
16:      fval = !index(args[1], "o")
17:      if (index("parentheses", args[2]) == 1)
18:        pflag = fval
19:        args = args[3..length(args)]
20:      elseif (index("numbers", args[2]) == 1)
21:        nflag = fval
22:        args = args[3..length(args)]
23:      else
24:        this:notify(tostr(args[1], " WHAT?"))
25:        args = E_INVARG
26:      endif
27:    elseif (index("0123456789", args[1][1]) || index(args[1], "..") == 1)
28:      if (E_INVARG == (s = $seq_utils:from_string(args[1])))
29:        this:notify(tostr("Garbled range:  ", args[1]))
30:        args = E_INVARG
31:      else
32:        range = $seq_utils:union(range, s)
33:        args = listdelete(args, 1)
34:      endif
35:    elseif (argspec)
36:      "... second argspec?  Not likely ..."
37:      this:notify(tostr(args[1], " unexpected."))
38:      args = E_INVARG
39:    elseif (typeof(pas = $code_utils:parse_argspec(@args)) == $LIST)
40:      argspec = pas[1]
41:      argspec[2] = $code_utils:full_prep(argspec[2]) || argspec[2]
42:      args = pas[2]
43:    else
44:      "... argspec is bogus ..."
45:      this:notify(tostr(pas))
46:      args = E_INVARG
47:    endif
48:  endwhile
49:  if (args == E_INVARG)
50:    this:notify(tostr("Usage:  #&lt;object&gt;:&lt;verb&gt; [player] [&lt;dobj&gt; &lt;prep&gt; &lt;iobj&gt;] [with|without parentheses|numbers] [ranges]"))
51:    return
52:  endif
53:  what = object
54:  if (argspec)
55:    vnum = $code_utils:find_verb_named(what, spec, 1)
56:    while (vnum < 0 ? valid(what = parent(what)) | verb_args(what, vname = vnum) != argspec)
57:      vnum = $code_utils:find_verb_named(what, spec, max(vnum + 1, 1))
58:    endwhile
59:    code = vnum < 0 ? E_VERBNF | verb_code(what, vname, pflag)
60:  else
61:    vname = spec
62:    if (toint(vname) > 0 && (code = `verb_code(what, toint(vname), pflag) ! ANY') != E_VERBNF)
63:      vname = toint(vname)
64:    else
65:      while (valid(what) && (code = `verb_code(what, vname, pflag) ! ANY') == E_VERBNF)
66:        what = parent(what)
67:      endwhile
68:    endif
69:  endif
70:  inf = `verb_info(what, vname) ! ANY'
71:  if (code == E_VERBNF && toint(vname) != 0)
72:    inf = `verb_info(what, toint(vname)) ! ANY'
73:  endif
74:  if (code == E_VERBNF)
75:    this:notify(tostr("That object does not define that verb", argspec ? " with those args." | "."))
76:  elseif (typeof(code) == $ERR)
77:    this:notify(tostr(code))
78:  elseif (code == {})
79:    this:notify("That verb has not been programmed.")
80:  else
81:    if (what != object)
82:      this:notify(tostr("Object ", object, " does not define that verb", argspec ? " with those args" | "", ", but its ancestor ", what, " does."))
83:    endif
84:    lineseq = {1, length(code) + 1}
85:    range && (lineseq = $seq_utils:intersection(range, lineseq))
86:    if (!lineseq)
87:      this:notify("No lines in that range.")
88:      return
89:    endif
90:    info = verb_info(what, vname)
91:    vargs = verb_args(what, vname)
92:    if (index(vargs[2], "/"))
93:      vargs[2] = tostr("(", vargs[2], ")")
94:    endif
95:    text = {tostr(what, ":", toliteral(info[3]), "   ", $string_utils:from_list(vargs, " "))}
96:    for k in [1..length(lineseq) / 2]
97:      for i in [lineseq[2 * k - 1]..lineseq[2 * k] - 1]
98:        if ("syntax_color" in player.display_options)
99:          code[i] = tostr(@$compile_utils:tokens2html($compile_utils:code2tokens(code[i])))
100:       else
101:         code[i] = $html_utils:literal_text(code[i])
102:       endif
103:       text = {@text, nflag ? tostr(" "[1..i < 10], i, ":  ", code[i]) | code[i]}
104:       $command_utils:suspend_if_needed()
105:     endfor
106:   endfor
107:   player:tell_suspended(text)
108: endif
109: "Last modified by whiz (#3135) on Sun Jan 13 00:57:29 2008 EST."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

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