d82 @verb #8756:"@prog*ram" any any any ro #8756 @program #8756:"@prog*ram" any any any "Copied from Generic Programmer (#14):@prog by Slacker (#55)Mar 15 20:05:41 2001" "This version of @program deals with multiple verbs having the same name." "... @program : picks the right one." if (player != caller) return endif set_task_perms(player) "..." "...catch usage errors first..." "..." punt = "...set punt to 0 only if everything works out..." if (!player.programmer) return player:tell("Sorry, programmers only.") elseif (!(args && (spec = $code_utils:parse_verbref(args[1])))) player:notify(tostr("Usage: ", verb, " <object>:<verb> [<dobj> <prep> <iobj>]")) elseif ($command_utils:object_match_failed(object = player:my_match_object(spec[1]), spec[1])) "...bogus object..." elseif (typeof(argspec = $code_utils:parse_argspec(@listdelete(args, 1))) != $LIST) player:notify(tostr(argspec)) elseif (argspec[2]) player:notify($string_utils:from_list(argspec[2], " ") + "??") elseif (length(argspec = argspec[1]) in {1, 2}) player:notify({"Missing preposition", "Missing iobj specification"}[length(argspec)]) else punt = 0 if (`verb_info(object, spec[2]) ! E_VERBNF') verbname = spec[2] elseif (match(spec[2], "^[0-9]+$")) verbname = toint(spec[2]) else return player:tell("Verb not found, ", object, ":", spec[2], ".") endif if (index(verbname, "*") > 1) verbname = strsub(verbname, "*", "") endif endif "..." "...if we have an argspec, we'll need to reset verbname..." "..." if (punt) elseif (argspec) if (!(argspec[2] in {"none", "any"})) argspec[2] = $code_utils:full_prep(argspec[2]) endif loc = $code_utils:find_verb_named(object, verbname) while (loc > 0 && verb_args(object, loc) != argspec) loc = $code_utils:find_verb_named(object, verbname, loc + 1) endwhile if (loc < 0) punt = "...can't find it...." player:notify("That object has no verb matching that name + args.") else verbname = loc endif else loc = -1 endif "..." "...get verb info..." "..." if (punt || !(punt = "...reset punt to TRUE...")) elseif (`info = verb_info(object, verbname) ! ANY' == E_VERBNF) player:notify("That object does not have that verb definition.") elseif (typeof(info) == $ERR) player:notify(tostr(info)) else punt = 0 aliases = info[3] if (loc < 0) loc = aliases in (verbs(object) || {}) endif endif "..." "...read the code..." "..." if (punt) player:notify(tostr("Now ignoring code for ", args ? args[1] | "nothing in particular", ".")) $command_utils:read_lines() player:notify("Verb code ignored.") else player:notify(tostr("Now programming ", object.name, ":", aliases, "(", loc < 0 ? "??" | loc, ").")) try lines = $command_utils:read_lines() except (E_INVARG) "User disconnected, don't harass em with a TB mail" return endtry if (result = set_verb_code(object, verbname, lines)) player:notify(result) player:notify(tostr(length(result), " error(s).")) player:notify("Verb not programmed.") elseif (typeof(result) == $ERR) player:notify(tostr(result)) player:notify("Verb not programmed.") else player:notify("0 errors.") player:notify("Verb programmed.") endif endif "Last modified by Dax (#789) on Wed May 4 06:46:05 2005 MDT." . 0