Useful Utilities for Programmers #113
Aliases: Useful Utilities for Programmers
6 verbs · 34 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
@vloc @findverb @vfind | any any any | rxd | #113 | 39 |
_megasubsub | this none this | rxd | #113 | 21 |
@megasub*stitute | any any any | rxd | #113 | 46 |
@leaves | any any any | rxd | #113 | 15 |
@ | any none none | rxd | #113 | 16 |
@nnlist | any none none | rxd | #113 | 13 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
warehouse | #68 | r | #29 | <clear> |
help_msg | #68 | rc | #29 | <clear> |
feature_verbs | #68 | r | #29 | {} |
feature_ok | #68 | r | #29 | <clear> |
handed | #5 | rc | #29 | <clear> |
wield_msg | #5 | rc | #29 | <clear> |
unwield_msg | #5 | rc | #29 | <clear> |
size | #5 | rc | #29 | <clear> |
look_place_msg | #5 | rc | #29 | <clear> |
value | #5 | rc | #29 | <clear> |
get_msg | #5 | rc | #29 | <clear> |
drop_msg | #5 | rc | #29 | <clear> |
get_fail_msg | #5 | rc | #29 | <clear> |
junk_ok | #5 | rc | #29 | <clear> |
floats | #5 | rc | #29 | <clear> |
long_name_msg | #5 | rc | #29 | <clear> |
article | #5 | rc | #29 | <clear> |
setup_list | #5 | rc | #29 | <clear> |
health | #5 | rc | #29 | <clear> |
health_max | #5 | rc | #29 | <clear> |
min_skill | #5 | rc | #29 | <clear> |
skill | #5 | rc | #29 | <clear> |
recipe_for | #5 | rc | #29 | <clear> |
carried_msg | #5 | rc | #29 | <clear> |
aliases | #1 | rc | #29 | {"Useful Utilities for Programmers"} |
description | #1 | rc | #29 | <clear> |
object_size | #1 | r | #29 | {4166, 1298433815} |
hidden_verbs | #1 | rc | #29 | <clear> |
phelp_msg | #1 | rc | #29 | <clear> |
weight | #1 | rc | #29 | <clear> |
owner_verbs | #1 | rc | #29 | <clear> |
plural_name | #1 | rc | #29 | <clear> |
client_image | #1 | rc | #29 | <clear> |
listening | #1 | rc | #29 | <clear> |
Ancestry
Ancestors (nearest first): #68 Generic Feature Object → #5 generic thing → #1 root
Children: none
Call graph
Source
@vloc @findverb @vfind
Referenced by
none
Source
1"@vloc <verbname> [on <player>]"; 2"Scans for all occurances of the specified verb on the specified player"; 3"If no player is specified, the caller is assumed."; 4if (dobj == $nothing) 5player:tell("Usage: `@vloc <verbname>'"); 6return; 7endif 8if (iobj == $nothing) 9who = player; 10else 11who = $string_utils:match_player(iobjstr); 12if ((who == $failed_match) || (who == $ambiguous_match)) 13player:tell("`", iobjstr, "' is not a valid or unique player."); 14return; 15endif 16endif 17vname = $string_utils:trim(dobjstr); 18pfobjs = {@$ou:ancestors(who), @$rpg.features_for_everyone, @$rpg.features_for_programmers, @who.features}; 19if (is_a(who.location, $room)) 20pfobjs = {@$ou:ancestors(who.location), who.location, @pfobjs}; 21endif 22pfobjs = listinsert(pfobjs, who); 23final = {}; 24for pcheck in (pfobjs) 25$command_utils:suspend_if_needed(1); 26vcheck = $code_utils:find_verb_named(pcheck, vname); 27if (vcheck != 0) 28msg = tostr($string_utils:nn(pcheck)); 29final = {@final, msg}; 30endif 31endfor 32if (length(final) < 1) 33final = {"[No matches found]"}; 34endif 35header = tostr($string_utils:center(tostr((("@vloc run for `" + vname) + "'") + $string_utils:nn(who)), 65, "-")); 36final = listinsert(final, header); 37footer = tostr($string_utils:center(tostr(("End of @vloc run: " + tostr(length(pfobjs))) + " Objects Checked"), 65, "-")); 38final = {@final, footer}; 39player:tell_lines(final);
_megasubsub
Referenced by
- #113:_megasubsub line 8:
this:_megasubsub - #113:@megasub*stitute line 29:
this:_megasubsub
Source
1{find, repl, original} = args; 2didsub = 0; 3type = typeof(original); 4if (type == LIST) 5result = original; 6for i in [1..length(original)] 7yield; 8{didsubsub, sub_result} = this:_megasubsub(find, repl, original[i]); 9if (didsubsub) 10didsub = 1; 11result[i] = sub_result; 12endif 13endfor 14if (didsub) 15return {1, result}; 16endif 17elseif (type == STR) 18result = $su:subst(original, {{find, repl}}); 19return {result != original, result}; 20endif 21return {0, 0};
@megasub*stitute
Referenced by
none
Source
1args = $su:explode(argstr, "/"); 2if (length(args) != 3) 3player:tell("Usage: @megasub one thing/another thing/#12345"); 4return; 5endif 6target = toobj(args[3]); 7if (tostr(target) != args[3]) 8player:tell("'", args[3], "' is not an object."); 9return; 10endif 11if (!valid(target)) 12player:tell(target, " is invalid."); 13return; 14endif 15if ((target.owner != player) && (!player.wizard)) 16player:tell("No write permission on ", target, " (must be owner or a wizard.)"); 17return; 18endif 19find = args[1]; 20repl = args[2]; 21to_change = {}; 22for p in ($ou:all_properties(target)) 23yield; 24original = target.(p); 25if (typeof(original) == HASH) 26player:tell("@megasub: skipping .", p, " - it's a hash"); 27continue; 28endif 29{didsub, result} = this:_megasubsub(find, repl, original); 30if (didsub) 31player:tell("@megasub: .", p); 32player:tell(" old: ", toliteral(original)); 33player:tell(" new: ", toliteral(result)); 34to_change = {@to_change, {p, result}}; 35endif 36endfor 37if (!$cu:yes_or_no("@megasub: Commit changes?")) 38player:tell("Aborted."); 39return; 40endif 41for change in (to_change) 42{p, newvalue} = change; 43target.(p) = newvalue; 44yield; 45endfor 46player:tell("Complete.");
@leaves
Referenced by
none
Source
1dobj = $su:match_object(dobjstr, player.location); 2if (!valid(dobj)) 3player:tell("@leaves what?"); 4return; 5endif 6"if (dobj in {#1, $thing, $actor, $creature, $living, $body, $decal, $exit, $room})"; 7" player:tell(\"I don't think you actually meant to do that. So no.\");"; 8" return;"; 9"endif"; 10player:tell($ansi.bold_on + "Showing all leaves of ", $su:nn(dobj), "..." + $ansi.reset); 11for x in ($ou:leaves_suspended(dobj)) 12player:tell($su:left($su:nn(x), -35), $ansi.reset, " ", $su:left(tostr(x), -10), $ansi.reset, " ", $ansi.yellow, $su:left($su:nn(x.location), -30), $ansi.reset); 13$cu:sin(3); 14endfor 15player:tell("Done.");
@
Referenced by
none
Source
1if (!dobjstr) 2dobj = player; 3elseif (valid(o = $su:literal_object(dobjstr))) 4dobj = o; 5elseif (valid(o = $su:match_player(dobjstr))) 6dobj = o; 7else 8return player:tell("Couldn't match `", dobjstr, "'."); 9endif 10location = dobj.location; 11if (!valid(location)) 12return player:tell(dobj:dname(), " is in an invalid location."); 13else 14location:look_self(); 15(((!is_a(location, $room)) || (location != player.location)) && has_callable_verb(location, "list_exits")) && location:list_exits(player, 1); 16endif
@nnlist
Referenced by
none
Source
1prop = $code_utils:parse_propref(dobjstr); 2if (!prop) 3return player:tell("That's not a property, or if it is, you typed it wrong, or something."); 4elseif (({name, vname} = prop) && (!$command_utils:object_match_failed(dobj = player:my_match_object(name), name))) 5try 6(caller_perms() == $code_utils:verb_perms()) ? property_info(dobj, vname) | $no_one:eval(tostr("property_info(", dobj, ",\"", vname, "\");")); 7except (E_PERM) 8return player:tell("This property is not readable."); 9except (E_PROPNF) 10return player:tell($string_utils:nn(dobj), " doesn't seem to have a property named `", vname, "'."); 11endtry 12(typeof(stuff = dobj.(vname)) in {OBJ, LIST}) ? player:tell($string_utils:nn(stuff)) | player:tell("This property is not suitable for use with this verb. (Needs to be a list of objects)"); 13endif