string utilities #20
Aliases: string, utils
134 verbs · 21 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
space | this none this | rxd | #20 | 30 |
left | this none this | rxd | #20 | 16 |
right | this none this | rxd | #20 | 13 |
centre center | this none this | rxd | #20 | 13 |
columnize columnise | this none this | rxd | #20 | 18 |
from_list | this none this | rxd | #20 | 14 |
english_list | this none this | rxd | #20 | 24 |
names_of | this none this | rxd | #20 | 8 |
from_seconds | this none this | rxd | #20 | 30 |
trim | this none this | rxd | #20 | 6 |
triml | this none this | rxd | #20 | 6 |
trimr | this none this | rxd | #20 | 5 |
strip_chars | this none this | rxd | #20 | 6 |
strip_all_but | this none this | rxd | #20 | 11 |
uppercase lowercase | this none this | rxd | #20 | 13 |
capitalize capitalise | this none this | rxd | #20 | 17 |
literal_object | this none this | rxd | #20 | 27 |
match | this none this | rxd | #20 | 38 |
match_str*ing | this none this | rxd | #20 | 40 |
match_object | this none this | rxd | #20 | 20 |
match_player | this none this | rxd | #20 | 34 |
match_player_or_object | this none this | rxd | #20 | 24 |
find_prefix | this none this | rxd | #20 | 13 |
index_d*elimited | this none this | rxd | #20 | 3 |
is_integer is_numeric | this none this | rxd | #20 | 18 |
ordinal | this none this | rxd | #20 | 8 |
group_number gn | this none this | rxd | #20 | 26 |
english_number | this none this | rxd | #20 | 28 |
english_ordinal | this none this | rxd | #20 | 19 |
english_ones | this none this | rxd | #20 | 3 |
english_tens | this none this | rxd | #20 | 10 |
subst*itute | this none this | rxd | #20 | 48 |
substitute_d*elimited | none none none | rxd | #20 | 44 |
_cap_property | this none this | rxd | #20 | 30 |
pronoun_sub ps | this none this | rxd | #20 | 121 |
pronoun_sub_secure | this none this | rxd | #20 | 9 |
pronoun_quote | this none this | rxd | #20 | 23 |
alt_pronoun_sub | none none none | rxd | #20 | 76 |
explode | this none this | rxd | #20 | 14 |
words | this none this | rxd | #20 | 34 |
word_start | this none this | rxd | #20 | 28 |
to_value | this none this | rxd | #20 | 20 |
prefix_to_value | this none this | rxd | #20 | 23 |
_tolist | this none this | rxd | #20 | 35 |
_unquote | this none this | rxd | #20 | 15 |
_toscalar | this none this | rxd | #20 | 21 |
parse_command | this none this | rxd | #20 | 40 |
from_value | this none this | rxd | #20 | 36 |
print print_suspended | this none this | rxd | #20 | 21 |
reverse | this none this | rxd | #20 | 13 |
char_list | this none this | rxd | #20 | 11 |
regexp_quote | this none this | rxd | #20 | 9 |
connection_hostname_bsd | this none this | rxd | #20 | 3 |
connection_hostname | this none this | rxd | #20 | 2 |
from_value_suspended | this none this | rxd | #20 | 40 |
end_expression | this none this | rxd | #20 | 42 |
first_word | this none this | rxd | #20 | 30 |
common | this none this | rxd | #20 | 13 |
title_list*c list_title*c | this none this | rxd | #20 | 14 |
name_and_number nn name_and_number_list nn_list | this none this | rx | #20 | 14 |
columnize_suspended columnise_suspended | this none this | rxd | #20 | 18 |
a_or_an | this none this | rxd | #20 | 25 |
index_all | this none this | rxd | #20 | 16 |
match_stringlist match_string_list | this none this | rx | #20 | 38 |
from_ASCII | this none this | rxd | #20 | 5 |
to_ASCII | this none this | rxd | #20 | 4 |
abbreviated_value | this none this | rxd | #20 | 14 |
_abbreviated_value | this none this | rxd | #20 | 69 |
match_suspended | this none this | rxd | #20 | 40 |
incr_alpha | this none this | rxd | #20 | 12 |
is_float | this none this | rxd | #20 | 4 |
inside_quotes | this none this | rx | #20 | 13 |
strip_all_but_seq | this none this | rxd | #20 | 10 |
ps_backup | this none this | rxd | #20 | 78 |
mel_match | this none this | rxd | #20 | 55 |
match_backup_spunky | this none this | rxd | #20 | 40 |
match_aliases | this none this | rxd | #20 | 56 |
escape | this none this | rxd | #20 | 7 |
match_aliases_ambiguous | this none this | rxd | #20 | 33 |
plural | this none this | rxd | #20 | 75 |
aggregate_number | this none this | rxd | #20 | 12 |
msg | this none this | rxd | #20 | 4 |
nn_c | this none this | rxd | #20 | 15 |
message_db | this none this | rxd | #20 | 25 |
english_weight | this none this | rxd | #20 | 6 |
english_weight_short | this none this | rxd | #20 | 6 |
plural_deprecated | this none this | rxd | #20 | 17 |
strip_article | this none this | rxd | #20 | 5 |
random_word | this none this | rxd | #20 | 26 |
nn_tb | this none this | rxd | #20 | 4 |
strip_binary | this none this | rxd | #20 | 12 |
last_word_start | this none this | rxd | #20 | 21 |
gibberish | this none this | rxd | #20 | 11 |
merge | this none this | rxd | #20 | 13 |
make_table | this none this | rxd | #20 | 40 |
word_wrap | this none this | rxd | #20 | 50 |
_splitwords | this none this | rxd | #20 | 21 |
colorize colourize c | this none this | rxd | #20 | 31 |
highlight_words | this none this | rxd | #20 | 19 |
fast_words | this none this | rxd | #20 | 19 |
re_sub*stitute | this none this | rxd | #20 | 20 |
smart_abbrev | this none this | rxd | #20 | 35 |
metaphone | this none this | rxd | #20 | 153 |
properties_like | this none this | rxd | #20 | 26 |
index_any | this none this | rxd | #20 | 10 |
_smart_abbrev_1 | this none this | rxd | #20 | 1 |
_smart_abbrev_2 | this none this | rxd | #20 | 57 |
_smart_abbrev_3 | this none this | rxd | #20 | 1 |
_smart_abbrev_4 | this none this | rxd | #20 | 1 |
english_list_bold | this none this | rxd | #20 | 33 |
repeat | this none this | rxd | #20 | 9 |
uncapitalize | this none this | rxd | #20 | 18 |
encrypt decrypt | this none this | rxd | #20 | 7 |
_tohash | this none this | rxd | #20 | 70 |
crapsum | this none this | rxd | #20 | 17 |
new_encrypt new_decrypt | this none this | rxd | #20 | 29 |
format_bytesize | this none this | rxd | #20 | 23 |
crypto | this none this | rxd | #20 | 24 |
columnize_horiz*ontal | this none this | rxd | #20 | 28 |
reverse_nn rev_nn | this none this | rxd | #20 | 2 |
spr*intf pr*intf | this none this | rxd | #20 | 109 |
capitalize_words | this none this | rxd | #20 | 20 |
superview sv | this none this | rxd | #20 | 31 |
widen | this none this | rxd | #20 | 8 |
bonus_num | this none this | rxd | #20 | 12 |
trim_binary | this none this | rxd | #20 | 19 |
short_num | this none this | rxd | #20 | 11 |
random_string | this none this | rxd | #20 | 6 |
silence | this none this | rxd | #20 | 16 |
scramble | this none this | rxd | #20 | 16 |
silence_words | this none this | rxd | #20 | 37 |
to_hex | this none this | rxd | #20 | 10 |
to_hex2 | this none this | rxd | #20 | 9 |
match_aliases_generics | this none this | rxd | #20 | 34 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
digits | #20 | rc | #361 | "0123456789" |
ascii | #20 | rc | #361 | " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" |
alphabet | #20 | rc | #361 | "abcdefghijklmnopqrstuvwxyz" |
use_article_a | #20 | r | #29 | {"unit", "unix", "one", "once", "utility", "UNIX", "UNIX book"} |
use_article_an | #20 | r | #29 | {} |
tab | #20 | rc | #361 | "\t" |
color_subs | #20 | rc | #361 | list of 15{{"red", "/r", "~1b[31m"}, {"green", "/g", "~1b[32m"}, {"blue", "/b", "~1b[34m"}, {"yellow", "/y", "~1b[33m"}, {"magenta", "/m", "~1b[35m"}, {"cyan", "/c", "~1b[36m"}, {"white", "/w", "~1b[0m~1b[37m"}, {"brightred", "/R", "~1b[1m~1b[31m"}, {"brightgreen", "/G", "~1b[1m~1b[32m"}, {"brightblue", "/B", "~1b[1m~1b[34m"}, {"brightyellow", "/Y", "~1b[1m~1b[33m"}, {"brightmagenta", "/M", "~1b[1m~1b[35m"}, {"brightcyan", "/C", "~1b[1m~1b[36m"}, {"black", "/K", "~1b[1m~1b[30m"}, {"brightwhite", "/W", "~1b[1m~1b[37m"}} |
proplikecache | #20 | rc | #361 | list of 337{#530, 518, {"KMBT", "combat"}, {"HSTR", "history"}, {"STNK", "setting"}, {"MN", "money"}, {"T0", "death"}, {"RLS", "rules"}, {"MNRS", "manners"}, {"SKLS", "skills"}, {"MRTR", "murder"}, {"MFMNT", "movement"}, {"ETKT", "etiquette"}, {"OPXNS", "options"}, {"ALTS", "alts"}, {"KRNTNK", "grinding"}, {"KRFNK", "griefing"}, {"BKS", "bugs"}, {"STRS", "stress"}, {"RMRS", "rumors"}, {"PRNNS", "pronouns"}, {"ETTNK", "e-dating"}, {"RSK", "rescue"}, {"FNT", "feint"}, {"PBLK", "public"}, {"KLM", "climb"}, {"KKNS", "cocoons"}, {"ARMR", "armor"}, {"PRYR", "prayer"}, {"SKS", "sex"}, {"FT", "food"}, {"KRFT", "craft"}, {"WPNRPR", "weapon-repair"}, {"SKRT", "security"}, {"TRNNK", "training"}, {"XL", "chill"}, {"HL0", "health"}, {"FXNK", "fishing"}, {"WPNS", "weapons"}, {"TRFL", "travel"}, {"PRSR", "parser"}, {"ALS", "allows"}, {"FRNS", "friends"}, {"AJ", "age"}, {"MPS", "maps"}, {"KRM", "crime"}, {"RP", "rape"}, {"RPR", "repair"}, {"FK", "fuck"}, {"MTXNS", "mutations"}, {"RNT", "rent"}, {"JL", "jail"}, {"KRB", "grab"}, {"RSTRN", "restrain"}, {"SRX", "search"}, {"SKFNJ", "scavenge"}, {"FKPT", "fcpd"}, {"IP", "ip"}, {"PSWRT", "password"}, {"IMPRFMNT", "improvement"}, {"SP", "xp"}, {"EKSPRNS", "experience"}, {"KLN", "clone"}, {"KLNNK", "cloning"}, {"EMTS", "emotes"}, {"PS", "pose"}, {"KMNKXN", "communication"}, {"TL", "tell"}, {"PJ", "page"}, {"TLKNK", "talking"}, {"KKN", "cocoon"}, {"JM", "gym"}, {"PRFS", "prefs"}, {"HNJR", "hunger"}, {"PPL", "paypal"}, {"FRNS", "frenzy"}, {"MTT", "mutate"}, {"STTS", "status"}, {"HLP", "help"}, {"ITMS", "items"}, {"PRKTS", "practice"}, {"IMPLNTS", "implants"}, {"S", "say"}, {"APRTMNTS", "apartments"}, {"HM", "home"}, {"NTS", "nets"}, {"XTNT", "chatnet"}, {"STNT", "zotnet"}, {"TM", "time"}, {"RT", "radio"}, {"FTXS", "fetishes"}, {"LNJ", "lunge"}, {"FS", "phase"}, {"0RST", "thirst"}, {"WTR", "water"}, {"FKTSTL", "fightstyle"}, {"AKRSF", "aggressive"}, {"BRSRK", "berserk"}, {"PSFST", "pacifist"}, {"KXS", "cautious"}, {"STNS", "stance"}, {"NRML", "normal"}, {"UPTT", "update"}, {"SKS", "sx"}, {"KPS", "cops"}, {"NT", "@nude"}, {"PRT", "party"}, {"JRNLS", "journals"}, {"KSTS", "quests"}, {"AXFMNTS", "achievements"}, {"FKTNK", "fighting"}, {"TRNK", "drink"}, {"HW0NHNT", "hewithonhand"}, {"HP", "hp"}, {"KBHTL", "cube_hotel"}, {"EKSPLSFS", "explosives"}, {"TRNKNK", "drinking"}, {"STTS", "stats"}, {"KRPS", "corps"}, {"KRP", "corp"}, {"KNTRKTS", "contracts"}, {"FTBK", "feedback"}, {"SK", "sc"}, {"SKR", "score"}, {"APT", "apt"}, {"HRN", "horny"}, {"NB", "newbie"}, {"XRJN", "chargen"}, {"KL", "kill"}, {"ATK", "attack"}, {"KMBTPXNS", "combatoptions"}, {"PWRTK", "powerattack"}, {"TJ", "dodge"}, {"PR", "parry"}, {"KMNS", "commands"}, {"PRSN", "prison"}, {"FKT", "fight"}, {"JR", "gear"}, {"FL", "follow"}, {"RRLNK", "rerolling"}, {"KRTTS", "credits"}, {"FKSNK", "fixing"}, {"XNLS", "channels"}, {"TMPRTR", "temperature"}, {"HT", "heat"}, {"KLT", "cold"}, {"TRKS", "drugs"}, {"KRFTNK", "crafting"}, {"PNS", "penis"}, {"LK", "look"}, {"PRFRNSS", "preferences"}, {"STRS", "stars"}, {"KL0NK", "clothing"}, {"WR", "wear"}, {"SLT", "slut"}, {"HMBRJRS", "hamburgers"}, {"AM", "aim"}, {"ML", "mail"}, {"TLT", "delete"}, {"KNK", "king"}, {"BS", "biz"}, {"FNTL", "fondle"}, {"MSTRBT", "masturbate"}, {"WNK", "wank"}, {"SNS", "science"}, {"ETPS", "edps"}, {"KTNK", "quitting"}, {"IMPRFS", "improvise"}, {"JSS", "Jesus"}, {"TJ", "dj"}, {"TJNT", "djnet"}, {"TJB0", "djbooth"}, {"MSK", "music"}, {"KKNK", "cooking"}, {"TNT", "donate"}, {"TNTNK", "donating"}, {"TNXN", "donation"}, {"KMNKXNS", "communications"}, {"EKSMN", "examine"}, {"LKT", "logout"}, {"FR", "fire"}, {"RT", "ready"}, {"RJKT", "ragequit"}, {"WMN", "women"}, {"STP", "stop"}, {"WMN", "woman"}, {"STNKS", "settings"}, {"KMPN", "company"}, {"BSNS", "business"}, {"ILNS", "illness"}, {"SKNS", "sickness"}, {"TSSS", "diseases"}, {"TNK", "@doing"}, {"KMPTR", "computer"}, {"BRN", "brown"}, {"M", "me"}, {"TSKRB", "@describe"}, {"ATMNS", "admins"}, {"SMKL", "smuggle"}, {"BLPRNT", "blueprint"}, {"MSM", "museum"}, {"FRPL", "foreplay"}, {"LMP", "lmap"}, {"LKS", "locks"}, {"BNRS", "boners"}, {"NPKS", "npcs"}, {"KNFRSXN", "conversation"}, {"STR", "store"}, {"BYNK", "buying"}, {"MK", "make"}, {"HSNK", "housing"}, {"HLT", "hold"}, {"LRNNK", "learning"}, {"PPSKNK", "poopsocking"}, {"PRKNNS", "pregnancy"}, {"KT", "@quit"}, {"TSNK", "dozing"}, {"WLT", "wield"}, {"SST", "suicide"}, {"RTXN", "radiation"}, {"ORFN", "orphan"}, {"KMP", "gmap"}, {"KL0S", "clothes"}, {"NS", "news"}, {"TRS", "DRS"}, {"ABRXN", "abortion"}, {"SPLRS", "spoilers"}, {"JBS", "jobs"}, {"SKL", "<skill>"}, {"TPK", "<topic>"}, {"JKT", "joyquit"}, {"BNTS", "bounties"}, {"BNT", "bounty"}, {"PLNT", "playnet"}, {"KSNS", "coccoons"}, {"PSWRT", "@password"}, {"MLTPL", "multiplay"}, {"MLTPL", "multi-play"}, {"PRKNNT", "pregnant"}, {"KRM", "karma"}, {"ITS", "ideas"}, {"RLPLYNK", "roleplaying"}, {"ML", "mail2"}, {"MNNK", "mining"}, {"MKP", "mcp"}, {"HLFLFLP", "help help help"}, {"TKS", "tags"}, {"TK", "tag"}, {"RMTK", "rmtag"}, {"TLTK", "deltag"}, {"PRFS", "@prefs"}, {"KNKSKNS", "gangsigns"}, {"RNTM", "@random"}, {"STLNK", "stealing"}, {"KRPRXNS", "corporations"}, {"NTSNT", "nudesnet"}, {"INFXNS", "invasions"}, {"INFXN", "invasion"}, {"SKRPTNK", "scripting"}, {"TRKRS", "triggers"}, {"TMRS", "timers"}, {"SKRPTS", "scripts"}, {"IFFLNNTKNTJTP", "I've_fallen_and_I_can't_get_up"}, {"TNTSKTMNSTHLPYXT", "dontaskadminstohelpyoucheat"}, {"B", "B)"}, {"RBR", "robbery"}, {"SKM", "scam"}, {"JLMR", "gilmore"}, {"SKMNK", "scamming"}, {"BTMNS", "badmins"}, {"NKN0RP", "necanthrope"}, {"RSPS", "recipes"}, {"TNK", "doing"}, {"PSWRTS", "passwords"}, {"ENM", "enema"}, {"KRPXT", "corpchat"}, {"MSRF", "mservo"}, {"FKTSTLS", "fight_styles"}, {"FKTNKSTL", "fightingstyle"}, {"STL", "style"}, {"FKTNKSTL", "fighting_style"}, {"STLS", "styles"}, {"FKTSTLS", "fightstyles"}, {"FKTNKSTLS", "fightingstyles"}, {"AMNK", "aiming"}, {"LKPKNK", "lockpicking"}, {"PK", "pick"}, {"TXRS", "teachers"}, {"ORL", "oral"}, {"BLJBS", "blowjobs"}, {"SMLS", "smells"}, {"WSLST", "wizlist"}, {"WSRTS", "wizards"}, {"WNTT", "wanted"}, {"TTNK", "dating"}, {"IMK", "im_gay"}, {"JF", "give"}, {"KNFKRXN", "configuration"}, {"RJ", "rage"}, {"HNTS", "hints"}, {"URNXN", "urination"}, {"PS", "piss"}, {"PNK", "peeing"}, {"PJNK", "paging"}, {"BRJ", "barge"}, {"IMPRF", "improv"}, {"LSTS", "lists"}, {"PWP", "pwipe"}, {"XRKTRJNRXN", "character_generation"}, {"PBK", "pubic"}, {"PLS", "police"}, {"ARSTT", "arrested"}, {"TLT", "tilde"}, {"", "~"}, {"HLP", "he;lp"}, {"", "@"}, {"STFTHTFR", "stuffed_whatever"}, {"RP", "rp"}, {"TKN", "dagon"}, {"SNTKS", "syntax"}, {"HKLNK", "haggling"}, {"HKL", "haggle"}, {"BRKT", "barcode"}, {"BRKT", "bar_code"}, {"RPTR", "rupture"}, {"BLNT", "blind"}, {"RRL", "reroll"}, {"TPK", "topic"}, {"EMT", "emote"}, {"PFP", "pvp"}, {"OLTLTS", "old_alts"}, {"OTL", "outlaw"}, {"OTLS", "outlaws"}, {"XLNJS", "challenges"}, {"XLNJ", "challenge"}, {"HRTKR", "hardcore"}, {"ASNXN", "ascension"}} |
lettersnumbers | #20 | rc | #361 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" |
line_noise | #20 | rc | #361 | "#$%^&*_/><|{}[]`()-+.=" |
help_msg | #72 | rc | #361 | list of 122{"*** NOTE: for more help on any verb, do 'help $su:verbname'.", "", " Conversion routines:", ":from_list (list [,sep]) => \"foo1foo2foo3\"", ":english_list (str-list[,none-str[,and-str[, sep]]]) => \"foo1, foo2, and foo3\"", ":title_list*c (obj-list[,none-str[,and-str[, sep]]]) => \"foo1, foo2, and foo3\"", " or => \"Foo1, foo2, and foo3\"", ":from_value (value [,quoteflag [,maxlistdepth]]) => \"{foo1, foo2, foo3}\"", ":print (value) => value in string", ":abbreviated_value (value, options) => short value in string", "", ":to_value (string) => {success?, value or error message}", ":prefix_to_value(string) => {rest of string, value} or {0, error message}", "", " Object information:", ":nn(obj [,sep]) => \"ObjectName (#obj)\"", ":nn(obj-list, [,sep]) => \"One (#o1), Two (#o2) and Three (#o3)\"", ":nn_c(obj, [, sep]) => same as above, but with pointless colors", ":nn_tb(obj) => \"ObjectName #obj\", returns 0 if !valid", "", " English language:", ":english_number(42) => \"forty-two\"", ":english_ordinal(42) => \"forty-second\"", ":ordinal(42) => \"42nd\"", ":group_number(42135 [,sep]) => \"42,135\"", ":from_ASCII(65) => \"A\"", ":to_ASCII(\"A\") => 65", ":from_seconds(number) => string of rough time passed in large increments", "", ":plural(\"matrix\") => \"matrices\" (plurals for nouns)", ":aggregate_number(17) => \"lots of\" (vague numbers)", ":english_weight(2000) => \"2 kilograms\" (grams -> english)", ":english_weight_short(2000) => \"2kg\" (grams -> short form)", ":strip_article(\"an apple\") => \"apple\" (remove 'the', 'a', 'an')", ":random_word() => \"buttons\" (random from whole db)", ":gibberish(string) => random words, about as many as string", ":merge(paragraph1, paragraph2, join-string)", " => new paragraph (list of strings)", ":smart_abbrev(string or list [,eachbelow [,totalbelow]])", " => string or list, shortened to meet requirements", "", " Message handling:", ":msg(list or string) => single string picked at random", ":message_db(obj-list, prop) => { {objs1, msg1}, {objs2, msg2} ... }", "", " Type checking:", ":is_integer (string) => return true if string is composed entirely of digits", ":is_float (string) => return true if string holds just a floating point", "", " Parsing:", ":explode (string,char) -- string => list of words delimited by char", ":words (string) -- string => list of words (as with command line parser)", ":word_start (string) -- string => list of start-end pairs.", ":first_word (string) -- string => list {first word, rest of string} or {}", ":char_list (string) -- string => list of characters in string", ":parse_command (cmd_line [,player] => mimics action of builtin parser", ":fast_words (string [,char]) => word-list -- like :explode", "", " Matching:", ":find_prefix (prefix, string-list)=>list index of element starting with prefix", ":index_delimited(string,target[,case]) =>index of delimited string occurrence", ":index_all (string, target string) => list of all matched positions", ":common (first string, second string) => length of longest common prefix", ":match (string, [obj-list, prop-name]+) => matching object", ":match_player (string-list[,me-object]) => list of matching players", ":match_object (string, location) => default object match...", ":match_player_or_object (string, location) => object then player matching", ":literal_object (string) => match against #xxx, $foo", ":match_stringlist (string, targets) => match against static strings", ":match_string (string, wildcard target,options)=> match against a wildcard", ":match_aliases (string, obj-list) => match against names and aliases.", ":metaphone (string) => metaphone code for a word (try it)", "", " Pretty printing:", ":s/pr[intf] ([OBJ,]STR, *, *, ...) => formatted string (see documentation)", ":space (n/string[,filler]) => n spaces", ":left (string,width[,filler]) => left justified string in field ", ":right (string,width[,filler]) => right justified string in field", ":center/re (string,width[,lfiller[,rfiller]]) => centered string in field", ":columnize/se (list,n[,width]) => list of strings in n columns", ":widen (string[,n]) => string with 1 (or n) spaces between chars", "", ":make_table (header-colors, headers, row-colors, rows, row-widths)", " => a pretty-printed table using the given colors, widths", ":word_wrap (list of strings, linelength [,color])", " => list of strings, none longer than linelength", ":colorize (string [, ok-colors])", " => uses special escape codes to color text, like \"/r\" for red.", ":highlight (string, highlight-words)", " => string with each of highlight-words bolded", "", " Substitutions", ":substitute (string,subst_list [,case]) -- general substitutions.", ":substitute_delimited (string,subst_list [,case])", " -- like subst, but uses index_delim", ":re_sub (string, subst_list, [,case]) -- like subst, with regexes.", ":pronoun_sub (string/list[,who[,thing[,location]]])", " -- pronoun substitutions.", ":pronoun_sub_secure (string[,who[,thing[,location]]],default)", " -- substitute and check for names.", ":pronoun_quote (string/list/subst_list) -- quoting for pronoun substitutions.", "", " Miscellaneous string munging:", ":trim (string) => string with outside whitespace removed.", ":triml (string) => string with leading whitespace removed.", ":trimr (string) => string with trailing whitespace removed.", ":strip_chars (string,chars) => string with all chars in `chars' removed.", ":strip_all_but(string,chars) => string with all chars not in `chars' removed.", ":capitalize/se(string) => string with first letter capitalized.", ":uppercase/lowercase(string) => string with all letters upper or lowercase.", ":names_of (list of OBJ) => string with names and object numbers of items.", ":a_or_an (word) => \"a\" or \"an\" as appropriate for that word.", ":reverse (string) => \"gnirts\"", ":incr_alpha (string) => \"increments\" the string alphabetically", ":escape (string) => escapes tildes in a string properly.", ":strip_binary (string) => string without any binary characters", "", " A useful property:", "alphabet => \"abcdefghijklmnopqrstuvwxyz\"", "", "Suspended versions (with _suspended at end of name) for", " :print :from_value :columnize/se :match"} |
aliases | #1 | rc | #361 | {"string", "utils"} |
description | #1 | rc | #361 | {"This is the string utilities utility package. See `help $string_utils' for more details."} |
object_size | #1 | r | #29 | {151193, 1298433815} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #72 Generic Utilities Package → #1 root
Children: none
Call graph
Showing 48 of 114 verbs; 66 not shown.
Source
space
Referenced by
- #2:tell_mytree line 33:
$su:space - #6:gear line 112:
$su:space - #15:prepositions line 3:
$string_utils:space - #17:show_netwho_listing line 50:
su:space - #17:show_netwho_listing line 53:
su:space - #20:left line 13:
this:space - #20:right line 10:
this:space - #20:centre line 10:
this:space - #20:centre line 10:
this:space - #20:to_value line 10:
$string_utils:space - #20:widen line 4:
$su:space - #20:random_string line 2:
this:space - #38:display_seq_headers line 23:
$su:space - #38:display_message_improved line 62:
$su:space - #43:description line 27:
$string_utils:space - #48:read_lines line 13:
$string_utils:space - #48:read_lines line 18:
$string_utils:space - #49:@guests line 47:
su:space - #49:@guests line 50:
su:space - #51:show_who_listing line 70:
su:space - #51:show_who_listing line 73:
su:space - #51:show_who_listing line 94:
su:space - #51:verb_usage line 20:
$string_utils:space - #51:callers_text line 17:
su:space - #52:index_list line 2:
$string_utils:space - #57:watch_tell line 41:
$su:space - #62:show line 48:
$string_utils:space - #90:who_html line 75:
su:space - #90:who_html line 78:
su:space - #90:who_html line 99:
su:space - #103:health_bar line 10:
$su:space - #103:health_bar line 15:
$su:space - #103:health_bar line 19:
$su:space - #103:health_bar line 25:
$su:space - #103:health_bar line 25:
$su:space - #103:bar line 12:
$su:space - #103:bar line 17:
$su:space - #103:bar line 21:
$su:space - #103:bar line 27:
$su:space - #103:bar line 27:
$su:space - #103:health_meter line 11:
$su:space - #103:health_meter line 16:
$su:space - #103:health_meter line 20:
$su:space - #103:health_meter line 26:
$su:space - #103:health_meter line 26:
$su:space - #107:show_score_full line 130:
$su:space - #107:show_score_full line 138:
$su:space - #107:show_score_full line 141:
$su:space - #263:_tell_body line 4:
$su:space - #263:tell_screen line 6:
$su:space - #293:display_top_seq line 41:
$su:space - #293:display_top_allfolders line 44:
$su:space - #317:@aspy line 14:
$su:space - #317:@aspy line 43:
$su:space - #317:@aspy line 49:
$su:space - #317:@rspy line 15:
$su:space - #317:@rspy line 46:
$su:space - #317:@rspy line 53:
$su:space - #317:@uspy line 6:
$su:space - #317:@uspy line 36:
$su:space - #317:@uspy line 43:
$su:space
Source
1"space(len,fill) returns a string of length abs(len) consisting of copies of fill. If len is negative, fill is anchored on the right instead of the left. fill must be 10 or fewer characters long."; 2{n, ?fill = " "} = args; 3if (typeof(n) == STR) 4n = length(n); 5endif 6if (n > 1000) 7"Prevent someone from crashing the moo with $string_utils:space($maxint)"; 8return E_INVARG; 9endif 10if (" " != fill) 11if (length(fill) > 10) 12raise(E_INVARG); 13endif 14fill = fill + fill; 15fill = fill + fill; 16fill = fill + fill; 17elseif ((n = abs(n)) < 70) 18return " "[1..n]; 19else 20fill = " "; 21endif 22m = (n - 1) / length(fill); 23while (m) 24if (length(fill) > 500) 25raise(E_QUOTA); 26endif 27fill = fill + fill; 28m = m / 2; 29endwhile 30return (n > 0) ? fill[1..n] | fill[($ + 1) + n..$];
left
Referenced by
- #2:@check-chp*arent line 18:
su:left - #2:@check-chp*arent line 19:
su:left - #2:@check-chp*arent line 21:
su:left - #2:tell_tree line 18:
$su:left - #2:tell_tree line 19:
$su:left - #2:@features line 35:
$string_utils:left - #2:@features line 41:
$string_utils:left - #2:@features line 47:
$string_utils:left - #2:@features line 53:
$string_utils:left - #2:@features line 60:
$string_utils:left - #2:@ch*eck-full line 25:
$string_utils:left - #2:@ch*eck-full line 25:
$string_utils:left - #2:@ch*eck-full line 25:
$string_utils:left - #2:tell_mytree line 28:
$su:left - #2:tell_mytree line 30:
$su:left - #2:tell_mytree line 32:
$su:left - #2:@d*isplay line 157:
$string_utils:left - #2:@d*isplay line 161:
$string_utils:left - #2:@d*isplay line 167:
$string_utils:left - #2:@d*isplay line 187:
$string_utils:left - #2:@d*isplay line 192:
$string_utils:left - #2:@d*isplay line 200:
$string_utils:left - #2:@d*isplay line 200:
$string_utils:left - #6:@mess*ages line 52:
$su:left - #6:worn line 5:
$su:left - #6:worn line 14:
$su:left - #6:worn line 15:
$su:left - #6:worn line 16:
$su:left - #6:worn line 17:
$su:left - #6:new_tell_contents line 54:
$su:left - #6:new_tell_contents line 110:
$su:left - #6:new_tell_contents line 117:
$su:left - #6:new_tell_contents line 117:
$su:left - #6:journal*s line 51:
$su:left - #6:journal*s line 51:
$su:left - #6:journal*s line 53:
$su:left - #6:gear line 40:
$su:left - #6:gear line 47:
$su:left - #6:gear line 50:
$su:left - #6:gear line 98:
$su:left - #6:gear line 100:
$su:left - #6:gear line 102:
$su:left - #6:gear line 103:
$su:left - #6:gear line 108:
$su:left - #6:gear line 112:
$su:left - #6:gear line 118:
$su:left - #6:gear line 119:
$su:left - #6:gear line 120:
$su:left - #6:gear line 121:
$su:left - #6:gear line 126:
$su:left - #6:teach line 20:
$su:left - #6:teach line 20:
$su:left - #6:tell_item_list line 11:
$su:left - #6:tell_item_list line 11:
$su:left - #6:tell_wanted line 13:
$su:left - #6:lm*ap line 48:
$su:left - #6:job*s line 23:
$su:left - #6:job*s line 24:
$su:left - #6:job*s line 32:
$su:left - #6:job*s line 38:
$su:left - #6:hints line 7:
$su:left - #6:hints line 8:
$su:left - #6:blind_gear line 51:
$su:left - #6:blind_gear line 92:
$su:left - #6:blind_gear line 93:
$su:left - #6:blind_gear line 94:
$su:left - #6:blind_gear line 99:
$su:left - #6:blind_gear line 103:
$su:left - #6:blind_gear line 113:
$su:left - #6:blind_gear line 114:
$su:left - #6:blind_gear line 115:
$su:left - #6:blind_gear line 116:
$su:left - #6:blind_gear line 121:
$su:left - #12:msg_summary_line line 3:
$string_utils:left - #12:msg_summary_line line 9:
$string_utils:left - #15:errors line 3:
$string_utils:left - #17:show_netwho_listing line 52:
su:left - #17:show_netwho_listing line 53:
su:left - #17:show_netwho_listing line 61:
su:left - #20:columnize line 13:
this:left - #20:columnize_suspended line 14:
this:left - #20:make_table line 22:
$su:left - #20:make_table line 34:
$su:left - #20:columnize_horiz*ontal line 21:
this:left - #21:object_audit_string line 92:
$string_utils:left - #21:do_audit line 42:
$string_utils:left - #23:display_seq_headers line 8:
$string_utils:left - #23:display_seq_headers line 16:
$string_utils:left - #33:@rn line 40:
$string_utils:left - #33:@mail-all-new*-mail line 16:
$string_utils:left - #33:@mail-all-new*-mail line 25:
$string_utils:left - #33:@read-all-new*-mail line 21:
$string_utils:left - #33:@read-all-new*-mail line 38:
$string_utils:left - #38:make_message line 32:
$su:left - #38:display_seq_headers line 22:
$su:left - #38:display_seq_headers line 25:
$su:left - #38:msg_summary_line line 20:
$string_utils:left - #38:display_message_improved line 26:
$su:left - #43:description line 14:
$string_utils:left - #43:description line 22:
$string_utils:left - #44:match_nth line 31:
$su:left - #44:match_nth line 34:
$su:left - #44:match_nth line 56:
$su:left - #44:match_nth line 59:
$su:left - #49:@players line 106:
su:left - #49:@players line 110:
su:left - #49:@players line 111:
su:left - #49:@players line 112:
su:left - #49:@players line 113:
su:left - #49:@guests line 49:
su:left - #49:@guests line 50:
su:left - #49:@guests line 59:
su:left - #49:@prog-check line 40:
$su:left - #49:@prog-check line 40:
$su:left - #49:@prog-check line 45:
$su:left - #49:@prog-check line 49:
$su:left - #49:@prog-check line 49:
$su:left - #49:@prog-check line 54:
$su:left - #49:@core line 38:
$su:left - #50:@forked line 31:
su:left - #50:@forked line 33:
su:left - #50:@forked line 33:
su:left - #50:@forked line 37:
su:left - #50:@d*isplay line 157:
$string_utils:left - #50:@d*isplay line 161:
$string_utils:left - #50:@d*isplay line 167:
$string_utils:left - #50:@d*isplay line 187:
$string_utils:left - #50:@d*isplay line 192:
$string_utils:left - #50:@d*isplay line 200:
$string_utils:left - #50:@d*isplay line 200:
$string_utils:left - #50:@forked-v*erbose line 31:
su:left - #50:@forked-v*erbose line 33:
su:left - #50:@forked-v*erbose line 33:
su:left - #50:@forked-v*erbose line 37:
su:left - #50:whodo line 27:
$su:left - #50:whodo line 28:
$su:left - #50:whodo line 29:
$su:left - #50:whodo line 30:
$su:left - #50:@current-daily-gain line 10:
$su:left - #50:@current-daily-gain line 14:
$su:left - #50:@rhistory line 30:
$su:left - #50:!* line 8:
$su:left - #50:@task*s line 83:
$su:left - #50:@task*s line 202:
$su:left - #50:seccheck line 69:
$su:left - #50:seccheck line 70:
$su:left - #50:seccheck line 77:
$su:left - #50:seccheck line 79:
$su:left - #50:seccheck line 82:
$su:left - #51:show_who_listing line 72:
su:left - #51:show_who_listing line 73:
su:left - #51:show_who_listing line 99:
su:left - #51:callers_text line 16:
su:left - #51:callers_text line 27:
su:left - #52:index_list line 6:
$string_utils:left - #52:index_list line 14:
$string_utils:left - #52:wizard_list line 14:
su:left - #52:wizard_list line 14:
su:left - #57:watch_tell line 36:
$su:left - #57:watch_tell line 37:
$su:left - #57:watch_tell line 38:
$su:left - #57:watch_tell line 39:
$su:left - #57:watch_tell line 44:
$su:left - #57:watch_tell line 45:
$su:left - #57:watch_tell line 47:
$su:left - #57:watch_tell line 49:
$su:left - #57:do_player_watch line 11:
$su:left - #57:do_player_watch line 14:
$su:left - #62:show line 46:
$string_utils:left - #65:cleanup_list line 22:
$string_utils:left - #65:cleanup_list line 22:
$string_utils:left - #65:cleanup_list line 24:
$string_utils:left - #65:cleanup_list line 24:
$string_utils:left - #65:cleanup_list line 24:
$string_utils:left - #69:display_cache line 9:
$string_utils:left - #90:who_html line 77:
su:left - #90:who_html line 78:
su:left - #90:who_html line 106:
su:left - #95:@setup line 6:
$su:left - #95:@setup line 6:
$su:left - #95:tree_tag line 16:
$su:left - #96:report_daily_gain line 7:
$su:left - #96:report_daily_gain line 11:
$su:left - #103:render_error line 30:
$su:left - #103:render_error line 37:
$su:left - #103:handle_aborted_task line 35:
$su:left - #107:show_score_full line 89:
$su:left - #107:show_score_full line 91:
$su:left - #107:show_score_full line 111:
$su:left - #107:show_score_full line 149:
$su:left - #107:show_score_full line 151:
$su:left - #107:show_score_full line 159:
$su:left - #107:show_score_full line 161:
$su:left - #113:@leaves line 12:
$su:left - #113:@leaves line 12:
$su:left - #113:@leaves line 12:
$su:left - #114:@list-costs line 8:
$su:left - #114:@list-costs line 10:
$su:left - #118:tree_tag line 2:
$su:left - #130:_do_check line 8:
$su:left - #130:_do_check line 10:
$su:left - #130:_do_check line 13:
$su:left - #134:tree_tag line 1:
$su:left - #145:tell_components line 10:
$su:left - #145:tell_components line 12:
$su:left - #145:tell_components line 14:
$su:left - #150:@h-areas line 7:
$su:left - #150:@h-areas line 22:
$su:left - #150:@show-analysis line 3:
$su:left - #150:@show-analysis line 9:
$su:left - #167:tree_tag line 3:
$su:left - #167:tell_info line 8:
$su:left - #167:biz_employees line 12:
$su:left - #167:biz_employees line 12:
$su:left - #167:biz_listperms line 11:
$su:left - #167:biz_listperms line 20:
$su:left - #216:_tell_standings line 23:
$su:left - #246:@test line 6:
$su:left - #246:@test line 8:
$su:left - #256:tree_tag line 24:
$su:left - #261:@mem line 6:
$su:left - #261:@mem line 8:
$su:left - #261:@mem line 11:
$su:left - #263:_tell_body line 6:
$su:left - #263:tell_screen line 7:
$su:left - #263:tell_screen line 12:
$su:left - #283:look_self line 23:
$su:left - #293:msg_full_text line 6:
$su:left - #293:msg_full_text line 6:
$su:left - #293:txt_log line 14:
$su:left - #293:txt_log line 16:
$su:left - #293:txt_log line 26:
$su:left - #293:txt_log line 28:
$su:left - #293:msg_summary_line line 38:
$su:left - #293:msg_summary_line line 38:
$su:left - #293:msg_summary_line line 38:
$su:left - #293:msg_summary_line line 42:
$su:left - #293:extra_headers line 13:
$su:left - #293:extra_headers line 13:
$su:left - #293:extra_headers line 14:
$su:left - #293:extra_headers line 14:
$su:left - #293:extra_text line 35:
$su:left - #293:extra_text line 37:
$su:left - #293:msg_summary_line_colored line 20:
$string_utils:left - #293:msg_summary_line_colored line 20:
$su:left - #293:msg_summary_line_colored line 20:
$su:left - #293:display_top_seq line 40:
$su:left - #293:display_top_seq line 44:
$su:left - #293:display_top_allfolders line 46:
$su:left - #293:display_top_allfolders line 49:
$su:left - #293:old_txt_log line 13:
$su:left - #293:old_txt_log line 15:
$su:left - #306:look_self line 3:
$su:left - #317:@countweapons line 50:
$su:left - #317:@whohas line 18:
$su:left - #317:@whohas line 160:
$su:left - #317:@whohas line 167:
$su:left - #317:@allitems line 107:
$su:left - #317:@allitems line 116:
$su:left - #317:@countarmor line 39:
$su:left - #317:@countarmor line 54:
$su:left - #317:@monsters line 27:
$su:left - #317:@monsters line 70:
$su:left - #317:@monsters line 82:
$su:left - #317:@positions line 21:
$su:left - #317:@monsters-xp line 30:
$su:left - #317:@monsters-xp line 42:
$su:left - #317:@monsters-new line 33:
$su:left - #317:@monsters-new line 37:
$su:left - #317:@aspy line 14:
$su:left - #317:@aspy line 32:
$su:left - #317:@aspy line 32:
$su:left - #317:@aspy line 33:
$su:left - #317:@aspy line 34:
$su:left - #317:@aspy line 35:
$su:left - #317:@aspy line 43:
$su:left - #317:@aspy line 44:
$su:left - #317:@aspy line 45:
$su:left - #317:@aspy line 46:
$su:left - #317:@aspy line 49:
$su:left - #317:@aspy line 50:
$su:left - #317:@aspy line 51:
$su:left - #317:@aspy line 52:
$su:left - #317:@rspy line 15:
$su:left - #317:@rspy line 33:
$su:left - #317:@rspy line 33:
$su:left - #317:@rspy line 34:
$su:left - #317:@rspy line 35:
$su:left - #317:@rspy line 36:
$su:left - #317:@rspy line 46:
$su:left - #317:@rspy line 47:
$su:left - #317:@rspy line 48:
$su:left - #317:@rspy line 49:
$su:left - #317:@rspy line 53:
$su:left - #317:@rspy line 54:
$su:left - #317:@rspy line 55:
$su:left - #317:@rspy line 56:
$su:left - #317:@uspy line 6:
$su:left - #317:@uspy line 24:
$su:left - #317:@uspy line 24:
$su:left - #317:@uspy line 25:
$su:left - #317:@uspy line 26:
$su:left - #317:@uspy line 27:
$su:left - #317:@uspy line 36:
$su:left - #317:@uspy line 37:
$su:left - #317:@uspy line 38:
$su:left - #317:@uspy line 39:
$su:left - #317:@uspy line 43:
$su:left - #317:@uspy line 44:
$su:left - #317:@uspy line 45:
$su:left - #317:@uspy line 46:
$su:left - #317:@ofind line 15:
$su:left - #317:@ofind line 15:
$su:left - #317:@my line 28:
$su:left - #317:@my line 28:
$su:left - #317:do_scope line 17:
$su:left - #317:do_scope line 17:
$su:left - #317:do_scope line 21:
$su:left - #317:tell_for_ex line 13:
$su:left - #317:@shopgrep line 14:
$su:left - #317:@shopgrep line 14:
$su:left - #317:@dropgrep line 14:
$su:left - #317:@dropgrep line 14:
$su:left - #317:@ff line 33:
$su:left - #317:@ff line 33:
$su:left - #318:_who line 62:
$su:left - #318:_who line 101:
$su:left - #318:_who line 126:
$su:left - #334:invoice line 3:
$su:left - #334:invoice line 3:
$su:left - #334:invoice line 3:
$su:left - #334:invoice line 7:
$su:left - #334:@list-costs line 10:
$su:left - #334:@list-costs line 12:
$su:left
Source
1"Copied from string utilities (#20):_left by Hacker (#36) Fri Oct 29 15:46:29 2010 CDT"; 2"Copied from string utilities (#20):left by Hacker (#36) Fri Oct 29 15:46:04 2010 CDT"; 3"$string_utils:left(string,width[,filler])"; 4""; 5"Assures that <string> is at least <width> characters wide. Returns <string> if it is at least that long, or else <string> followed by enough filler to make it that wide. If <width> is negative and the length of <string> is greater than the absolute value of <width>, then the <string> is cut off at <width>."; 6""; 7"The <filler> is optional and defaults to \" \"; it controls what is used to fill the resulting string when it is too short. The <filler> is replicated as many times as is necessary to fill the space in question."; 8{text, len, ?fill = " "} = args; 9abslen = abs(len); 10out = tostr(text); 11ansilen = length(out) - length($ansi:strip(out)); 12if ((ln = length($ansi:strip(out))) < abslen) 13return out + this:space(ln - abslen, fill); 14else 15return (len > 0) ? out | out[1..abslen + ansilen]; 16endif
right
Referenced by
- #2:tell_tree line 45:
$su:right - #2:tell_mytree line 52:
$su:right - #2:@d*isplay line 157:
$string_utils:right - #3:tree_tag line 1:
$su:right - #5:tree_tag line 5:
$su:right - #6:new_tell_contents line 35:
$su:right - #6:new_tell_contents line 91:
$su:right - #6:tell_standings line 16:
$su:right - #9:display_seq_headers line 22:
$string_utils:right - #9:list_rmm line 26:
$string_utils:right - #17:show_missing_help line 9:
$string_utils:right - #17:show_missing_help line 9:
$string_utils:right - #20:spr*intf line 81:
$su:right - #21:object_audit_string line 5:
$string_utils:right - #21:object_audit_string line 22:
$string_utils:right - #21:object_audit_string line 92:
$string_utils:right - #21:size_string line 7:
$string_utils:right - #21:size_string line 9:
$string_utils:right - #23:display_seq_headers line 10:
$string_utils:right - #23:display_seq_headers line 15:
$su:right - #35:time_sub line 79:
$string_utils:right - #38:display_seq_headers line 21:
$string_utils:right - #38:expunge_rmm line 35:
$string_utils:right - #43:list_line line 3:
$string_utils:right - #43:description line 27:
$string_utils:right - #49:@players line 106:
su:right - #49:@players line 106:
su:right - #49:@players line 106:
su:right - #49:@players line 106:
su:right - #49:@players line 106:
su:right - #49:@players line 106:
su:right - #49:@players line 110:
su:right - #49:@players line 110:
su:right - #49:@players line 110:
su:right - #49:@players line 110:
su:right - #49:@players line 110:
su:right - #49:@players line 110:
su:right - #49:@players line 111:
su:right - #49:@players line 111:
su:right - #49:@players line 111:
su:right - #49:@players line 111:
su:right - #49:@players line 111:
su:right - #49:@players line 111:
su:right - #49:@players line 112:
su:right - #49:@players line 112:
su:right - #49:@players line 112:
su:right - #49:@players line 113:
su:right - #49:@players line 113:
su:right - #49:@players line 113:
su:right - #49:@prog-check line 40:
$su:right - #49:@prog-check line 40:
$su:right - #49:@prog-check line 45:
$su:right - #49:@prog-check line 45:
$su:right - #49:@prog-check line 49:
$su:right - #49:@prog-check line 49:
$su:right - #49:@prog-check line 54:
$su:right - #49:@prog-check line 54:
$su:right - #50:_kill_task_message line 3:
$string_utils:right - #50:@d*isplay line 157:
$string_utils:right - #50:paramedic line 110:
$su:right - #50:paramedic line 118:
$su:right - #50:debug_tell line 8:
$su:right - #50:@task*s line 200:
$su:right - #50:seccheck line 75:
$su:right - #57:watch_tell line 40:
$su:right - #69:display_cache line 10:
$string_utils:right - #69:display_cache line 23:
$string_utils:right - #89:tree_tag line 7:
$su:right - #95:tree_tag line 16:
$su:right - #103:render_error line 32:
$su:right - #103:render_error line 40:
$su:right - #107:show_score_full line 107:
$su:right - #107:show_score_full line 109:
$su:right - #107:show_score_full line 111:
$su:right - #107:show_score_full line 126:
$su:right - #107:show_score_full line 128:
$su:right - #107:show_score_full line 134:
$su:right - #107:show_score_full line 136:
$su:right - #107:show_score_full line 144:
$su:right - #107:show_score_full line 146:
$su:right - #107:show_score_stats line 12:
$su:right - #107:show_score_stats line 14:
$su:right - #107:show_score_stats line 18:
$su:right - #111:tree_tag line 6:
$su:right - #114:@list-costs line 8:
$su:right - #114:@list-costs line 10:
$su:right - #125:tree_tag line 2:
$su:right - #145:tell_components line 10:
$su:right - #145:tell_components line 12:
$su:right - #145:tell_components line 14:
$su:right - #203:tree_tag line 2:
$su:right - #216:_tell_standings line 23:
$su:right - #216:tree_tag line 1:
$su:right - #216:tree_tag line 2:
$su:right - #216:tree_tag line 3:
$su:right - #216:tree_tag line 4:
$su:right - #216:tree_tag line 5:
$su:right - #216:tree_tag line 6:
$su:right - #222:render line 7:
$su:right - #261:@mem line 6:
$su:right - #261:@mem line 6:
$su:right - #261:@mem line 8:
$su:right - #261:@mem line 11:
$su:right - #263:tell_screen line 14:
$su:right - #283:look_self line 23:
$su:right - #283:look_self line 23:
$su:right - #283:look_self line 23:
$su:right - #283:look_self line 23:
$su:right - #293:txt_vote line 6:
$su:right - #293:txt_vote line 11:
$su:right - #293:msg_summary_line line 38:
$su:right - #293:msg_summary_line line 38:
$su:right - #293:display_top_seq line 39:
$string_utils:right - #293:display_top_allfolders line 42:
$su:right - #293:display_top_allfolders line 43:
$string_utils:right - #317:@topvalue line 16:
$su:right - #317:@topvalue line 17:
$su:right - #317:@topvalue line 30:
$su:right - #317:@whohas line 175:
$su:right - #317:@monsters line 70:
$su:right - #317:@monsters line 70:
$su:right - #317:@monsters line 70:
$su:right - #317:@monsters line 70:
$su:right - #317:@monsters line 70:
$su:right - #317:@monsters line 82:
$su:right - #317:@monsters line 82:
$su:right - #317:@monsters line 82:
$su:right - #317:@monsters line 82:
$su:right - #317:@monsters line 82:
$su:right - #317:@positions line 21:
$su:right - #317:@monsters-xp line 30:
$su:right - #317:@monsters-xp line 30:
$su:right - #317:@monsters-xp line 30:
$su:right - #317:@monsters-xp line 30:
$su:right - #317:@monsters-xp line 30:
$su:right - #317:@monsters-xp line 42:
$su:right - #317:@monsters-xp line 42:
$su:right - #317:@monsters-xp line 42:
$su:right - #317:@monsters-xp line 42:
$su:right - #317:@monsters-xp line 42:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 33:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@monsters-new line 37:
$su:right - #317:@aspy line 36:
$su:right - #317:@aspy line 47:
$su:right - #317:@aspy line 53:
$su:right - #317:@rspy line 38:
$su:right - #317:@rspy line 50:
$su:right - #317:@rspy line 57:
$su:right - #317:@uspy line 28:
$su:right - #317:@uspy line 40:
$su:right - #317:@uspy line 47:
$su:right - #317:_bigtree line 5:
$su:right - #317:_bigtree line 5:
$su:right - #317:_bigtree line 5:
$su:right - #317:_bigtree line 31:
$su:right - #317:_bigtree line 31:
$su:right - #317:@compare line 21:
$su:right - #318:_who line 147:
$su:right - #318:_who line 150:
$su:right - #318:_who line 155:
$su:right - #324:from64 line 17:
$string_utils:right - #334:invoice line 7:
$su:right - #334:invoice line 11:
$su:right - #334:@list-costs line 10:
$su:right - #334:@list-costs line 12:
$su:right
Source
1"$string_utils:right(string,width[,filler])"; 2""; 3"Assures that <string> is at least <width> characters wide. Returns <string> if it is at least that long, or else <string> preceded by enough filler to make it that wide. If <width> is negative and the length of <string> is greater than the absolute value of <width>, then <string> is cut off at <width> from the right."; 4""; 5"The <filler> is optional and defaults to \" \"; it controls what is used to fill the resulting string when it is too short. The <filler> is replicated as many times as is necessary to fill the space in question."; 6{text, len, ?fill = " "} = args; 7abslen = abs(len); 8out = tostr(text); 9if ((lenout = length($ansi:strip(out))) < abslen) 10return this:space(abslen - lenout, fill) + out; 11else 12return (len > 0) ? out | out[($ - abslen) + 1..$]; 13endif
centre center
Referenced by
- #2:@d*isplay line 209:
$string_utils:centre - #2:@d*isplay line 211:
$string_utils:centre - #50:@d*isplay line 209:
$string_utils:centre - #50:@d*isplay line 211:
$string_utils:centre - #50:@task*s line 254:
$su:center - #84:@paste line 17:
$string_utils:center - #84:@paste line 22:
$string_utils:center - #84:@pasteto line 16:
$string_utils:center - #84:@pasteto line 20:
$string_utils:center - #113:@vloc line 35:
$string_utils:center - #113:@vloc line 37:
$string_utils:center - #334:invoice line 3:
$su:center
Source
1"$string_utils:center(string,width[,lfiller[,rfiller]])"; 2""; 3"Assures that <string> is at least <width> characters wide. Returns <string> if it is at least that long, or else <string> preceded and followed by enough filler to make it that wide. If <width> is negative and the length of <string> is greater than the absolute value of <width>, then the <string> is cut off at <width>."; 4""; 5"The <lfiller> is optional and defaults to \" \"; it controls what is used to fill the left part of the resulting string when it is too short. The <rfiller> is optional and defaults to the value of <lfiller>; it controls what is used to fill the right part of the resulting string when it is too short. In both cases, the filler is replicated as many times as is necessary to fill the space in question."; 6{text, len, ?lfill = " ", ?rfill = lfill} = args; 7out = tostr(text); 8abslen = abs(len); 9if ((ln = length($ansi:strip(out))) < abslen) 10return (this:space((abslen - ln) / 2, lfill) + out) + this:space(((abslen - ln) + 1) / -2, rfill); 11else 12return (len > 0) ? out | out[1..abslen]; 13endif
columnize columnise
Referenced by
- #6:tell_contents_backup line 22:
$string_utils:columnize - #49:display_list line 27:
$string_utils:columnize - #50:@canedit line 10:
$su:columnize - #50:@canedit line 23:
$su:columnize - #50:@canedit line 27:
$su:columnize - #90:get_help_topic line 20:
$string_utils:columnize - #120:tell_index line 18:
$su:columnize - #261:@mem line 12:
$su:columnize
Source
1"columnize (items, n [, width[, hard]]) - Turn a one-column list of items into an n-column list. 'width' is the last character position that may be occupied; it defaults to a standard screen width. Example: To tell the player a list of numbers in three columns, do 'player:tell_lines ($string_utils:columnize ({1, 2, 3, 4, 5, 6, 7}, 3));'."; 2{items, n, ?width = 79, ?hard = 0} = args; 3height = ((length(items) + n) - 1) / n; 4items = {@items, @$list_utils:make((height * n) - length(items), "")}; 5colwidths = {}; 6for col in [1..n - 1] 7colwidths = listappend(colwidths, 1 - (((width + 1) * col) / n)); 8endfor 9result = {}; 10for row in [1..height] 11line = tostr(items[row]); 12for col in [1..n - 1] 13line = tostr(this:left(line, colwidths[col]), " ", items[row + (col * height)]); 14endfor 15diff = length(line) - length($ansi:strip(line)); 16result = listappend(result, line[1..min(length(line), width + diff)]); 17endfor 18return result;
from_list
Referenced by
- #2:@create line 15:
$su:from_list - #2:@create line 16:
$su:from_list - #2:@recreate line 18:
$string_utils:from_list - #2:@recreate line 19:
$string_utils:from_list - #2:@digg line 8:
$string_utils:from_list - #2:@check-chp*arent line 21:
su:from_list - #2:@measure line 13:
$string_utils:from_list - #2:@measure line 29:
$string_utils:from_list - #2:@measure line 39:
$string_utils:from_list - #2:@measure line 75:
$string_utils:from_list - #2:@measure line 97:
$string_utils:from_list - #2:@addalias*# line 60:
$string_utils:from_list - #2:@rmalias*# line 48:
$string_utils:from_list - #2:@d*isplay line 167:
$string_utils:from_list - #3:yell line 1:
$su:from_list - #3:list_description line 71:
$su:from_list - #3:look_self_verybrief line 14:
$su:from_list - #3:prog_info line 5:
$su:from_list - #4:MSSP-REQUEST line 13:
$su:from_list - #6:@mess*ages line 33:
$su:from_list - #6:newtell line 2:
$su:from_list - #6:systell line 4:
$su:from_list - #6:@attach line 7:
$su:from_list - #6:_page line 4:
$su:from_list - #17:check_player_request line 48:
$string_utils:from_list - #17:do_register line 7:
$string_utils:from_list - #17:newt_player line 24:
$string_utils:from_list - #17:do_make_player line 5:
$string_utils:from_list - #20:parse_command line 25:
$string_utils:from_list - #20:parse_command line 26:
$string_utils:from_list - #20:parse_command line 29:
$string_utils:from_list - #20:gibberish line 11:
$su:from_list - #20:silence_words line 37:
$su:from_list - #24:index line 6:
su:from_list - #33:parse_folder_spec line 19:
$string_utils:from_list - #33:parse_mailread_cmd line 28:
$string_utils:from_list - #33:@unrmm*ail line 6:
$string_utils:from_list - #33:@@sendmail line 77:
$string_utils:from_list - #35:longdate line 11:
$su:from_list - #35:longdate line 14:
$su:from_list - #37:look_self line 3:
$string_utils:from_list - #39:send line 27:
$string_utils:from_list - #41:com*pile line 19:
$string_utils:from_list - #41:com*pile line 39:
$string_utils:from_list - #41:com*pile line 45:
$string_utils:from_list - #41:working_on line 7:
$string_utils:from_list - #41:parse_invoke line 13:
$string_utils:from_list - #41:verb_args line 8:
$string_utils:from_list - #43:m*ove line 12:
$string_utils:from_list - #43:parse_range line 60:
$string_utils:from_list - #49:@toad line 53:
$string_utils:from_list - #49:parse_templist_duration line 25:
$string_utils:from_list - #50:@args*# line 29:
$string_utils:from_list - #50:@rmverb*# line 9:
$string_utils:from_list - #50:@rmverb*# line 42:
$string_utils:from_list - #50:@prog*ram line 31:
$string_utils:from_list - #50:@d*isplay line 167:
$string_utils:from_list - #50:@check-p*roperty line 12:
$string_utils:from_list - #50:@list*# line 113:
$string_utils:from_list - #50:debug_tell line 8:
$su:from_list - #50:@port line 12:
$su:from_list - #50:_@prog line 31:
$string_utils:from_list - #50:@functions line 23:
$su:from_list - #50:@adderror line 8:
$su:from_list - #51:dump_preamble line 10:
$string_utils:from_list - #53:_parse line 10:
$string_utils:from_list - #54:count line 49:
$su:from_list - #57:_handle_bad_garbage line 32:
$su:from_list - #59:show_@mail line 2:
$string_utils:from_list - #59:show_@mail line 5:
$string_utils:from_list - #59:parse_news line 4:
$string_utils:from_list - #62:parse line 29:
$string_utils:from_list - #70:show_verb_args line 2:
$string_utils:from_list - #70:parse_verb_args line 11:
$string_utils:from_list - #71:parse_create_flags line 10:
$string_utils:from_list - #71:parse_dig_room line 4:
$string_utils:from_list - #89:tell line 5:
$su:from_list - #90:login_html line 5:
$string_utils:from_list - #90:log line 5:
$string_utils:from_list - #92:jumpstart line 7:
$su:from_list - #104:tree_tag line 8:
$su:from_list - #106:match_convo line 4:
$su:from_list - #107:count line 45:
$su:from_list - #107:think line 14:
$su:from_list - #107:_whisper line 2:
$su:from_list - #107:@qp line 15:
$su:from_list - #107:_think line 1:
$su:from_list - #118:dino_sub line 12:
$su:from_list - #120:hilite_topic line 62:
$su:from_list - #130:_page line 4:
$su:from_list - #135:tree_tag line 4:
$su:from_list - #150:check line 3:
$su:from_list - #167:log line 1:
$su:from_list - #167:announce line 2:
$su:from_list - #167:announce line 4:
$su:from_list - #167:biz_motd line 3:
$su:from_list - #167:biz_jingle line 3:
$su:from_list - #167:biz_contracts line 7:
$su:from_list - #167:biz_contracts line 18:
$su:from_list - #167:biz_hire line 3:
$su:from_list - #167:biz_fire line 3:
$su:from_list - #167:biz_promote line 3:
$su:from_list - #167:biz_demote line 3:
$su:from_list - #167:biz_voteout line 48:
$su:from_list - #198:tree_tag line 2:
$su:from_list - #214:change_random_pressure line 24:
$su:from_list - #251:_do_add_verb line 3:
$su:from_list - #251:_describe_add_verb line 2:
$su:from_list - #251:_describe_add_verb line 2:
$su:from_list - #256:tree_tag line 26:
$su:from_list - #269:tree_tag line 1:
$su:from_list - #290:parse line 8:
$su:from_list - #290:parse_to_hash line 8:
$su:from_list - #293:msg_summary_line line 25:
$su:from_list - #293:_@comment line 12:
$su:from_list - #293:_@type line 9:
$su:from_list - #293:_@assign line 9:
$su:from_list - #293:comment_msg_seq line 9:
$su:from_list - #293:_@retitle line 9:
$su:from_list - #293:_@annotate line 8:
$su:from_list - #293:_@mailban line 9:
$su:from_list - #293:_@commentban line 11:
$su:from_list - #297:report_from_issuelists line 19:
$su:from_list - #317:quickbar line 15:
$su:from_list - #327:_invoke line 9:
$su:from_list - #334:ren*ame line 10:
$su:from_list - #334:ren*ame line 12:
$su:from_list - #334:mess*ages line 40:
$su:from_list - #334:bpname line 9:
$su:from_list - #334:bpname line 11:
$su:from_list - #336:@* line 11:
$string_utils:from_list - #336:@* line 12:
$string_utils:from_list
Source
1"$string_utils:from_list(list [, separator])"; 2"Return a string being the concatenation of the string representations of the elements of LIST, each pair separated by the string SEPARATOR, which defaults to the empty string."; 3{thelist, ?separator = ""} = args; 4if (separator == "") 5return tostr(@thelist); 6elseif (thelist) 7result = tostr(thelist[1]); 8for elt in (listdelete(thelist, 1)) 9result = tostr(result, separator, elt); 10endfor 11return result; 12else 13return ""; 14endif
english_list
Referenced by
- #1:examine_names line 9:
$su:english_list - #2:@create line 53:
$su:english_list - #2:@recreate line 43:
$string_utils:english_list - #2:home line 14:
$su:english_list - #2:@addalias*# line 57:
$string_utils:english_list - #2:@addalias*# line 63:
$string_utils:english_list - #2:@addalias*# line 92:
$string_utils:english_list - #2:@addalias*# line 96:
$string_utils:english_list - #2:@rmalias*# line 45:
$string_utils:english_list - #2:@rmalias*# line 51:
$string_utils:english_list - #2:@rmalias*# line 82:
$string_utils:english_list - #2:@rmalias*# line 86:
$string_utils:english_list - #2:@d*isplay line 209:
$string_utils:english_list - #2:@add-feature line 31:
$string_utils:english_list - #3:player_integration_msg_backup line 45:
$su:english_list - #3:users_msg line 67:
$su:english_list - #3:look_sky line 22:
$su:english_list - #3:distant_figures line 27:
$su:english_list - #3:smell line 21:
$su:english_list - #3:extra_exit_desc line 12:
$su:english_list - #3:tell_nearby_lights line 16:
$su:english_list - #3:tell_nearby_lights line 19:
$su:english_list - #3:tell_nearby_lights line 22:
$su:english_list - #3:_descriptive_map line 59:
$su:english_list - #4:? line 17:
$string_utils:english_list - #6:friend*s line 7:
$su:english_list - #6:friend*s line 15:
$su:english_list - #6:allow line 3:
$su:english_list - #6:allows line 29:
$su:english_list - #6:allows line 32:
$su:english_list - #6:journal*s line 34:
$su:english_list - #6:journal*s line 67:
$su:english_list - #6:enemy line 2:
$su:english_list - #6:@nude line 6:
$su:english_list - #6:hints line 14:
$su:english_list - #9:from_msg_seq line 27:
$string_utils:english_list - #9:%from_msg_seq line 29:
$string_utils:english_list - #9:to_msg_seq line 28:
$string_utils:english_list - #9:%to_msg_seq line 29:
$string_utils:english_list - #20:_cap_property line 13:
$string_utils:english_list - #20:title_list*c line 14:
$string_utils:english_list - #20:name_and_number line 14:
this:english_list - #20:nn_c line 15:
this:english_list - #23:from_msg_seq line 24:
$string_utils:english_list - #23:to_msg_seq line 23:
$string_utils:english_list - #23:%to_msg_seq line 24:
$string_utils:english_list - #32:why_bad_name line 9:
$string_utils:english_list - #33:notify_mail line 15:
$string_utils:english_list - #33:notify_mail line 22:
$string_utils:english_list - #33:@unsub*scribe line 43:
$string_utils:english_list - #35:english_time line 40:
$string_utils:english_list - #38:resolve_addr line 37:
$string_utils:english_list - #38:match_failed line 9:
$string_utils:english_list - #38:name_list line 1:
$string_utils:english_list - #38:from_msg_seq line 23:
$string_utils:english_list - #38:%from_msg_seq line 25:
$string_utils:english_list - #38:to_msg_seq line 24:
$string_utils:english_list - #38:%to_msg_seq line 25:
$string_utils:english_list - #39:who line 16:
$string_utils:english_list - #39:subsc*ribe line 25:
$string_utils:english_list - #39:unsubsc*ribe line 23:
$string_utils:english_list - #41:uncomment line 27:
$string_utils:english_list - #44:object_match_failed line 26:
$string_utils:english_list - #48:player_match_result line 38:
$string_utils:english_list - #48:read_lines_escape line 12:
$string_utils:english_list - #49:@blacklist line 57:
$string_utils:english_list - #49:@blacklist line 74:
$string_utils:english_list - #49:@blacklist line 88:
$string_utils:english_list - #49:@blacklist line 106:
$string_utils:english_list - #49:@blacklist line 132:
$string_utils:english_list - #49:@blacklist line 147:
$string_utils:english_list - #49:@blacklist line 170:
$string_utils:english_list - #50:@d*isplay line 209:
$string_utils:english_list - #50:@gethelp line 31:
$string_utils:english_list - #50:@exam*ine line 16:
$string_utils:english_list - #50:@who-solved line 8:
$su:english_list - #50:examine_names line 10:
$su:english_list - #50:@add-feature line 30:
$string_utils:english_list - #50:find_help line 9:
$string_utils:english_list - #54:tell_contents_backup line 8:
$su:english_list - #56:_player_integration_msg line 52:
$su:english_list - #62:set line 39:
$string_utils:english_list - #62:desc_type line 16:
$string_utils:english_list - #62:parsechoice line 6:
$string_utils:english_list - #68:help_msg line 18:
$string_utils:english_list - #76:help_msg line 18:
$string_utils:english_list - #95:@setup line 20:
$su:english_list - #95:description line 9:
$su:english_list - #96:description line 5:
$su:english_list - #98:aggregate_names line 14:
$su:english_list - #100:help line 31:
$su:english_list - #100:help line 34:
$su:english_list - #104:cut line 11:
$su:english_list - #107:tell_holding line 24:
$su:english_list - #107:clear_hands line 53:
$su:english_list - #107:tell_wearing line 27:
$su:english_list - #107:_get_many line 19:
$su:english_list - #107:_get_many line 21:
$su:english_list - #107:tell_carrying line 29:
$su:english_list - #111:@setup line 10:
$su:english_list - #111:@setup line 14:
$su:english_list - #111:@setup line 21:
$su:english_list - #119:look_self line 36:
$su:english_list - #126:description line 9:
$su:english_list - #134:look_self line 29:
$su:english_list - #137:users_msg line 67:
$su:english_list - #138:smell line 29:
$su:english_list - #138:tell_appraise line 14:
$su:english_list - #142:_brainscan line 3:
$su:english_list - #142:_brainscan line 25:
$su:english_list - #143:_brainscan line 10:
$su:english_list - #145:look_self line 37:
$su:english_list - #147:tell_contents_old line 23:
$su:english_list - #148:search line 8:
$su:english_list - #151:switch line 11:
$su:english_list - #151:_finish line 8:
$su:english_list - #156:invite line 7:
$su:english_list - #167:tell_employees line 3:
$su:english_list - #167:biz_chatcolor line 35:
$su:english_list - #167:biz_chatcolor line 66:
$su:english_list - #167:biz_chatcolor line 82:
$su:english_list - #167:do_fire line 24:
$su:english_list - #167:summary line 26:
$su:english_list - #167:summary line 30:
$su:english_list - #167:summary line 38:
$su:english_list - #167:summary line 49:
$su:english_list - #167:summary line 54:
$su:english_list - #167:biz_access line 5:
$su:english_list - #167:biz_access line 19:
$su:english_list - #167:biz_listperms line 10:
$su:english_list - #167:biz_listperms line 20:
$su:english_list - #167:biz_inactives line 20:
$su:english_list - #184:_start line 74:
$su:english_list - #184:_start line 76:
$su:english_list - #184:_finish line 94:
$su:english_list - #184:_finish line 96:
$su:english_list - #223:press line 24:
$su:english_list - #257:smell line 27:
$su:english_list - #270:_start line 73:
$su:english_list - #270:_start line 75:
$su:english_list - #270:_finish line 74:
$su:english_list - #270:_finish line 76:
$su:english_list - #270:_abort line 29:
$su:english_list - #270:_abort line 31:
$su:english_list - #317:@whohas line 137:
$string_utils:english_list - #317:@whohas line 141:
$string_utils:english_list - #317:@allitems line 91:
$string_utils:english_list - #317:@allitems line 95:
$string_utils:english_list - #318:wh*o line 34:
$su:english_list - #318:wh*o line 60:
$su:english_list - #334:del*ete line 31:
$su:english_list - #334:bury line 50:
$su:english_list - #338:tell_contents line 26:
$su:english_list - #338:smell line 11:
$su:english_list
Source
1"Prints the argument (must be a list) as an english list, e.g. {1, 2, 3} is printed as \"1, 2, and 3\", and {1, 2} is printed as \"1 and 2\"."; 2"Optional arguments are treated as follows:"; 3" Second argument is the string to use when the empty list is given. The default is \"nothing\"."; 4" Third argument is the string to use in place of \" and \". A typical application might be to use \" or \" instead."; 5" Fourth argument is the string to use instead of a comma (and space). Gary_Severn's deranged mind actually came up with an application for this. You can ask him."; 6" Fifth argument is a string to use after the penultimate element before the \" and \". The default is to have a comma without a space."; 7{things, ?nothingstr = "nothing", ?andstr = " and ", ?commastr = ", ", ?finalcommastr = ","} = args; 8nthings = length(things); 9if (nthings == 0) 10return nothingstr; 11elseif (nthings == 1) 12return tostr(things[1]); 13elseif (nthings == 2) 14return tostr(things[1], andstr, things[2]); 15else 16ret = ""; 17for k in [1..nthings - 1] 18if (k == (nthings - 1)) 19commastr = finalcommastr; 20endif 21ret = tostr(ret, things[k], commastr); 22endfor 23return tostr(ret, andstr, things[nthings]); 24endif
names_of
Referenced by
- #2:@kids line 11:
$string_utils:names_of - #2:@c*ontents line 17:
$string_utils:names_of - #2:@par*ents line 11:
$string_utils:names_of - #2:@location*s line 9:
$string_utils:names_of - #43:lis*t line 11:
$string_utils:names_of - #75:measurement_task_body line 59:
$string_utils:names_of - #75:measurement_task_body line 67:
$string_utils:names_of - #127:tree_tag line 1:
$su:names_of
Source
1"Return a string of the names and object numbers of the objects in a list."; 2line = ""; 3for item in (args[1]) 4if ((typeof(item) == OBJ) && valid(item)) 5line = (((line + `item:name() ! E_VERBNF => item.name') + "(") + tostr(item)) + ") "; 6endif 7endfor 8return $string_utils:trimr(line);
from_seconds
Referenced by
- #2:@measure line 18:
$string_utils:from_seconds - #6:@age line 19:
$string_utils:from_seconds - #6:@age line 30:
$string_utils:from_seconds - #25:boot line 5:
$string_utils:from_seconds - #49:@guests line 29:
su:from_seconds - #49:@guests line 29:
su:from_seconds - #49:@deprog*rammer line 34:
$string_utils:from_seconds - #51:show_who_listing line 87:
su:from_seconds - #51:show_who_listing line 87:
su:from_seconds - #75:do_summary line 6:
$string_utils:from_seconds - #90:who_html line 92:
su:from_seconds - #90:who_html line 92:
su:from_seconds
Source
1":from_seconds(number of seconds) => returns a string containing the rough increment of days, or hours if less than a day, or minutes if less than an hour, or lastly in seconds."; 2":from_seconds(86400) => \"a day\""; 3":from_seconds(7200) => \"two hours\""; 4minute = 60; 5hour = 60 * minute; 6day = 24 * hour; 7secs = args[1]; 8if (secs > day) 9count = secs / day; 10unit = "day"; 11article = "a"; 12elseif (secs > hour) 13count = secs / hour; 14unit = "hour"; 15article = "an"; 16elseif (secs > minute) 17count = secs / minute; 18unit = "minute"; 19article = "a"; 20else 21count = secs; 22unit = "second"; 23article = "a"; 24endif 25if (count == 1) 26time = tostr(article, " ", unit); 27else 28time = tostr(count, " ", unit, "s"); 29endif 30return time;
trim
Referenced by
- #2:@set*prop line 20:
$string_utils:trim - #3:player_integration_msg line 34:
$su:trim - #3:player_integration_msg_backup line 47:
$su:trim - #3:users_msg line 69:
$su:trim - #3:look_self_NEW line 86:
$su:trim - #3:look_self_NEW line 87:
$su:trim - #3:look_self_NEW line 88:
$su:trim - #3:look_self_NEW line 89:
$su:trim - #3:look_self_NEW line 90:
$su:trim - #3:look_self_backup line 110:
$su:trim - #3:look_self_backup line 111:
$su:trim - #3:look_self_backup line 112:
$su:trim - #3:look_self_backup line 113:
$su:trim - #3:look_self_backup line 114:
$su:trim - #3:look_self_backup2 line 116:
$su:trim - #3:look_self_backup2 line 117:
$su:trim - #3:look_self_backup2 line 118:
$su:trim - #3:look_self_backup2 line 119:
$su:trim - #3:look_self_backup2 line 120:
$su:trim - #3:look_self_old line 99:
$su:trim - #3:look_self_old line 100:
$su:trim - #3:look_self_old line 101:
$su:trim - #3:look_self_old line 102:
$su:trim - #3:look_self_old line 103:
$su:trim - #3:player_integration_msg_old line 29:
$su:trim - #3:_look_self_furniture line 9:
$su:trim - #3:_look_self_exits line 15:
$su:trim - #3:_look_self_creatures line 27:
$su:trim - #3:_look_self_others line 14:
$su:trim - #6:parse_command line 57:
$su:trim - #6:parse_command line 58:
$su:trim - #6:parse_command line 75:
$su:trim - #6:parse_command line 76:
$su:trim - #6:@nude line 22:
$su:trim - #33:@@sendmail line 34:
$string_utils:trim - #33:@@sendmail line 41:
$string_utils:trim - #33:@quick*send line 25:
$string_utils:trim - #35:time_sub line 43:
$string_utils:trim - #35:time_sub line 47:
$string_utils:trim - #35:time_sub line 51:
$string_utils:trim - #35:time_sub line 65:
$string_utils:trim - #39:local_editing_info line 1:
$string_utils:trim - #43:lis*t line 40:
$string_utils:trim - #43:ins*ert line 7:
$string_utils:trim - #48:read line 12:
$string_utils:trim - #48:yes_or_no line 9:
$string_utils:trim - #50:@assume-form line 2:
$su:trim - #56:_player_integration_msg line 54:
$su:trim - #89:_morph line 7:
$su:trim - #107:do_command line 24:
$su:trim - #107:do_command line 25:
$su:trim - #107:parse_command line 57:
$su:trim - #107:parse_command line 58:
$su:trim - #107:parse_command line 66:
$su:trim - #107:parse_command line 67:
$su:trim - #107:tell_health line 20:
$su:trim - #113:@vloc line 17:
$string_utils:trim - #137:old_users_msg line 53:
$string_utils:trim - #137:users_msg line 69:
$su:trim - #141:tree_tag line 8:
$su:trim - #142:tree_tag line 2:
$su:trim - #167:parse_color line 5:
$su:trim - #290:strip_whitespace line 11:
$su:trim - #290:parse_element_to_hash line 32:
$su:trim - #317:@addex line 43:
$su:trim - #317:@addex line 44:
$su:trim - #317:@addex line 56:
$su:trim - #317:@addex line 58:
$su:trim
Source
1":trim (string [, space]) -- remove leading and trailing spaces"; 2""; 3"`space' should be a character (single-character string); it defaults to \" \". Returns a copy of string with all leading and trailing copies of that character removed. For example, $string_utils:trim(\"***foo***\", \"*\") => \"foo\"."; 4{string, ?space = " "} = args; 5m = match(string, tostr("[^", space, "]%(.*[^", space, "]%)?%|$")); 6return string[m[1]..m[2]];
triml
Referenced by
- #6:parse_command line 4:
$su:triml - #20:words line 7:
$string_utils:triml - #20:prefix_to_value line 4:
this:triml - #20:_tolist line 2:
this:triml - #20:_tolist line 31:
this:triml - #20:_tohash line 2:
this:triml - #20:_tohash line 42:
this:triml - #20:_tohash line 60:
this:triml - #20:_tohash line 66:
this:triml - #38:__convert_new line 28:
$string_utils:triml - #38:__convert_new line 33:
$string_utils:triml - #38:__convert_new line 35:
$string_utils:triml - #39:parse_msg_headers(slow) line 17:
$string_utils:triml - #107:parse_command line 4:
$su:triml
Source
1":triml(string [, space]) -- remove leading spaces"; 2""; 3"`space' should be a character (single-character string); it defaults to \" \". Returns a copy of string with all leading copies of that character removed. For example, $string_utils:triml(\"***foo***\", \"*\") => \"foo***\"."; 4{string, ?what = " "} = args; 5m = match(string, tostr("[^", what, "]%|$")); 6return string[m[1]..$];
trimr
Referenced by
- #2:?* line 5:
$string_utils:trimr - #2:?* line 7:
$string_utils:trimr - #20:names_of line 8:
$string_utils:trimr - #48:read_lines_escape line 23:
$string_utils:trimr - #51:callers_text line 29:
su:trimr
Source
1":trimr(string [, space]) -- remove trailing spaces"; 2""; 3"`space' should be a character (single-character string); it defaults to \" \". Returns a copy of string with all trailing copies of that character removed. For example, $string_utils:trimr(\"***foo***\", \"*\") => \"***foo\"."; 4{string, ?what = " "} = args; 5return string[1..rmatch(string, tostr("[^", what, "]%|^"))[2]];
strip_chars
Referenced by
- #20:random_word line 21:
$su:strip_chars - #20:highlight_words line 9:
$su:strip_chars - #27:from_string line 5:
su:strip_chars - #106:hear_say_to line 3:
$su:strip_chars - #120:hilite_topic line 16:
$su:strip_chars - #142:_compile line 18:
$su:strip_chars - #310:parse_pose_args line 9:
$string_utils:strip_chars
Source
1":strip_chars(string,chars) => string with chars removed"; 2{subject, stripped} = args; 3for i in [1..length(stripped)] 4subject = strsub(subject, stripped[i], ""); 5endfor 6return subject;
strip_all_but
Referenced by
none
Source
1":strip_all_but(string,keep) => string with chars not in `keep' removed."; 2"`keep' is used in match() so if it includes ], ^, or -,"; 3"] should be first, ^ should be other from first, and - should be last."; 4string = args[1]; 5wanted = ("[" + args[2]) + "]+"; 6output = ""; 7while (m = match(string, wanted)) 8output = output + string[m[1]..m[2]]; 9string = string[m[2] + 1..$]; 10endwhile 11return output;
uppercase lowercase
Referenced by
- #3:_yell line 5:
$su:uppercase - #4:? line 11:
$string_utils:uppercase - #6:tard_sub line 14:
$su:uppercase - #6:leet_sub line 7:
$su:uppercase - #6:suck_sub line 7:
$su:uppercase - #6:lush_sub line 25:
$su:uppercase - #20:random_word line 22:
$su:lowercase - #20:merge line 11:
$su:lowercase - #20:re_sub*stitute line 9:
$su:uppercase - #20:re_sub*stitute line 10:
$su:uppercase - #53:to_text line 5:
$string_utils:uppercase - #81:_is_funky_case line 2:
$string_utils:uppercase - #81:_is_funky_case line 4:
$string_utils:lowercase - #98:jerk_name line 18:
$su:uppercase - #167:parse_color line 5:
$su:lowercase - #223:press line 6:
$su:lowercase - #293:_@commentban line 23:
$su:uppercase - #307:forge_name line 43:
$su:lowercase - #325:parse line 13:
$su:lowercase - #325:parse line 13:
$su:lowercase - #325:parse line 15:
$su:lowercase - #325:parse_boolean line 7:
$su:lowercase - #325:parse_boolean line 9:
$su:lowercase - #325:parse_null line 7:
$su:lowercase
Source
1"lowercase(string) -- returns a lowercase version of the string."; 2"uppercase(string) -- returns the uppercase version of the string."; 3string = args[1]; 4from = caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 5to = lower = "abcdefghijklmnopqrstuvwxyz"; 6if (verb == "uppercase") 7from = lower; 8to = caps; 9endif 10for i in [1..26] 11string = strsub(string, from[i], to[i], 1); 12endfor 13return string;
capitalize capitalise
Referenced by
- #1:dnamec line 1:
$su:capitalize - #1:inamec line 1:
$su:capitalize - #1:_www line 5:
$su:capitalize - #3:player_integration_msg line 32:
$su:capitalize - #3:player_integration_msg_backup line 45:
$su:capitalize - #3:users_msg line 67:
$su:capitalize - #3:render_contents line 8:
$su:capitalize - #3:player_integration_msg_old line 27:
$su:capitalize - #6:friend*s line 15:
$su:capitalize - #6:job*s line 127:
$su:capitalize - #20:pronoun_sub line 98:
$su:capitalize - #20:title_list*c line 9:
$string_utils:capitalize - #34:get_conj*ugation line 35:
$string_utils:capitalize - #49:@toad line 53:
$string_utils:capitalize - #56:_player_integration_msg line 52:
$su:capitalize - #59:check_replyto line 6:
$string_utils:capitalize - #62:set line 33:
$string_utils:capitalize - #95:description line 5:
$su:capitalize - #95:description line 7:
$su:capitalize - #96:level_desc_for line 6:
$su:capitalize - #96:description line 5:
$su:capitalize - #98:jerk line 16:
$su:capitalize - #98:jerk_name line 18:
$su:capitalize - #98:superjerk line 10:
$su:capitalize - #98:superjerk line 11:
$su:capitalize - #98:superjerk line 12:
$su:capitalize - #98:superjerk line 13:
$su:capitalize - #98:superjerkname line 13:
$su:capitalize - #98:superjerkname line 14:
$su:capitalize - #98:superjerkname line 15:
$su:capitalize - #98:superjerkname line 16:
$su:capitalize - #102:bleed line 8:
$su:capitalize - #103:reach line 14:
$su:capitalize - #104:get_as_it_once_was line 19:
$su:capitalize - #107:hand_to line 8:
$su:capitalize - #107:tell_holding line 19:
$su:capitalize - #107:bolt line 5:
$su:capitalize - #114:dnamec line 2:
$su:capitalize - #114:_www line 3:
$su:capitalize - #120:tell_topic line 2:
$su:capitalize - #120:tell_skill line 2:
$su:capitalize - #134:look_self line 29:
$su:capitalize - #137:users_msg line 67:
$su:capitalize - #141:look_place_msg line 14:
$su:capitalize - #141:look_place_msg line 22:
$su:capitalize - #146:lock line 2:
$su:capitalize - #148:search line 2:
$su:capitalize - #167:do_fire line 24:
$su:capitalize - #167:summary line 28:
$su:capitalize - #167:group_access line 10:
$su:capitalize - #167:group_access line 23:
$su:capitalize - #167:biz_listperms line 10:
$su:capitalize - #167:biz_listperms line 11:
$su:capitalize - #167:biz_listperms line 20:
$su:capitalize - #167:biz_inactives line 22:
$su:capitalize - #222:_finish line 58:
$su:capitalize - #222:_finish line 69:
$su:capitalize - #256:_increase line 17:
$su:capitalize - #256:_increase line 27:
$su:capitalize - #256:_flow_through line 24:
$su:capitalize - #256:_decrease line 25:
$su:capitalize - #256:look_place_msg line 11:
$su:capitalize
Source
1"capitalizes its argument."; 2if (string = args[1]) 3ansi = 0; 4for i in [1..length(string)] 5if (string[i] == "~") 6ansi = 1; 7elseif (ansi && (string[i] == "m")) 8ansi = 0; 9elseif (!ansi) 10if (testi = index("abcdefghijklmnopqrstuvwxyz", string[i], 0)) 11string[i] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[testi]; 12return string; 13endif 14endif 15endfor 16endif 17return string;
literal_object
Referenced by
- #4:_match_player line 5:
$string_utils:literal_object - #20:match_object line 6:
this:literal_object - #20:match_player line 27:
$string_utils:literal_object - #24:objectdoc line 2:
$string_utils:literal_object - #33:last_huh line 7:
$string_utils:literal_object - #33:last_huh line 9:
$string_utils:literal_object - #38:match line 8:
$string_utils:literal_object - #38:_parse_from line 17:
$string_utils:literal_object - #39:not-to*: line 19:
$string_utils:literal_object - #44:match line 17:
$string_utils:literal_object - #44:match_ambiguous line 17:
$string_utils:literal_object - #44:match_generics line 18:
$string_utils:literal_object - #50:@disown line 11:
$string_utils:literal_object - #50:@pardon line 6:
$su:literal_object - #50:@changelog line 11:
$su:literal_object - #50:@canedit line 30:
$su:literal_object - #89:last_huh line 6:
$string_utils:literal_object - #89:last_huh line 8:
$string_utils:literal_object - #90:find_object line 1:
$string_utils:literal_object - #113:@ line 3:
$su:literal_object - #293:_parse_to line 18:
$string_utils:literal_object - #317:match_for_spawn line 13:
$su:literal_object - #317:@ofind+ line 18:
$su:literal_object - #317:@bigtree line 8:
$su:literal_object - #317:@compare line 20:
$su:literal_object - #317:@shopgrep line 1:
$su:literal_object - #317:@dropgrep line 1:
$su:literal_object - #317:@ff line 13:
$su:literal_object - #317:@ff line 17:
$su:literal_object
Source
1"Matches args[1] against literal objects: #xxxxx, $variables, *mailing-lists, and username. Returns the object if successful, $failed_match else."; 2string = args[1]; 3if (!string) 4return $nothing; 5elseif ((string[1] == "#") && (E_TYPE != (object = $code_utils:toobj(string)))) 6return object; 7elseif (string[1] == "~") 8return this:match_player(string[2..$], #0); 9elseif ((string[1] == "*") && (length(string) > 1)) 10return $mail_agent:match_recipient(string); 11elseif (string[1] == "$") 12string[1..1] = ""; 13object = #0; 14while (pn = string[1..(dot = index(string, ".")) ? dot - 1 | $]) 15if ((!$object_utils:has_property(object, pn)) || (typeof(object = object.(pn)) != OBJ)) 16return $failed_match; 17endif 18string = string[length(pn) + 2..$]; 19endwhile 20if ((object == #0) || (typeof(object) == ERR)) 21return $failed_match; 22else 23return object; 24endif 25else 26return $failed_match; 27endif
match
Referenced by
- #3:match line 2:
$su:match - #33:my_match_recipient line 10:
$string_utils:match - #39:not-to*: line 24:
$string_utils:match - #39:not-to*: line 25:
$string_utils:match - #39:not-to*: line 26:
$string_utils:match - #50:@disown line 17:
$string_utils:match - #50:@remove-feature line 9:
$string_utils:match - #114:@weather-compile line 5:
$su:match - #129:get line 11:
$su:match - #150:@h-areas line 4:
$su:match
Source
1"$string_utils:match(string [, obj-list, prop-name]*)"; 2"Each obj-list should be a list of objects or a single object, which is treated as if it were a list of that object. Each prop-name should be string naming a property on every object in the corresponding obj-list. The value of that property in each case should be either a string or a list of strings."; 3"The argument string is matched against all of the strings in the property values."; 4"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 5"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 6"Finally, if there are no exact or partial matches, then $failed_match is returned."; 7subject = args[1]; 8if (subject == "") 9return $nothing; 10endif 11no_exact_match = no_partial_match = 1; 12for i in [1..length(args) / 2] 13prop_name = args[(2 * i) + 1]; 14for object in ((typeof(olist = args[2 * i]) == LIST) ? olist | {olist}) 15if (valid(object)) 16if (typeof(str_list = `object.(prop_name) ! E_PERM, E_PROPNF => {}') != LIST) 17str_list = {str_list}; 18endif 19if (subject in str_list) 20if (no_exact_match) 21no_exact_match = object; 22elseif (no_exact_match != object) 23return $ambiguous_match; 24endif 25else 26for string in (str_list) 27if (index(string, subject) != 1) 28elseif (no_partial_match) 29no_partial_match = object; 30elseif (no_partial_match != object) 31no_partial_match = $ambiguous_match; 32endif 33endfor 34endif 35endif 36endfor 37endfor 38return no_exact_match && (no_partial_match && $failed_match);
match_str*ing
Referenced by
none
Source
1"* wildcard matching. Returns a list of what the *s actually matched. Won't cath every match, if there are several ways to parse it."; 2"Example: $string_utils:match_string(\"Jack waves to Jill\",\"* waves to *\") returns {\"Jack\", \"Jill\"}"; 3"Optional arguments: numbers are interpreted as case-sensitivity, strings as alternative wildcards."; 4{what, targ, @rest} = args; 5wild = "*"; 6case = ret = {}; 7what = what + "&^%$"; 8targ = targ + "&^%$"; 9for y in (rest) 10if (typeof(y) == STR) 11wild = y; 12elseif (typeof(y) == INT) 13case = {y}; 14endif 15endfor 16while (targ != "") 17if (z = index(targ, wild)) 18part = targ[1..z - 1]; 19else 20z = length(targ); 21part = targ; 22endif 23n = (part == "") ? 1 | index(what, part, @case); 24if (n) 25ret = listappend(ret, what[1..n - 1]); 26what = what[(z + n) - 1..$]; 27targ = targ[z + 1..$]; 28else 29return 0; 30endif 31endwhile 32if (ret == {}) 33return what == ""; 34elseif (ret == {""}) 35return 1; 36elseif (ret[1] == "") 37return ret[2..$]; 38else 39return 0; 40endif
match_object
Referenced by
- #1:match_object line 3:
$string_utils:match_object - #13:get_topic line 5:
$string_utils:match_object - #13:dump_topic line 4:
$string_utils:match_object - #20:parse_command line 27:
$string_utils:match_object - #20:parse_command line 33:
$string_utils:match_object - #24:verbdoc line 3:
$string_utils:match_object - #50:@exam*ine line 11:
$string_utils:match_object - #50:find_help line 10:
$string_utils:match_object - #50:find_help line 19:
$string_utils:match_object - #52:get_topic line 2:
$string_utils:match_object - #52:find_topics line 4:
$string_utils:match_object - #52:dump_topic line 1:
$string_utils:match_object - #57:request line 5:
$string_utils:match_object - #113:@leaves line 1:
$su:match_object
Source
1":match_object(string,location[,someone])"; 2"Returns the object matching the given string for someone, on the assumption that s/he is in the given location. `someone' defaults to player."; 3"This first tries :literal_object(string), \"me\"=>someone,\"here\"=>location, then player:match(string) and finally location:match(string) if location is valid."; 4"This is the default algorithm for use by room :match_object() and player :my_match_object() verbs. Player verbs that are calling this directly should probably be calling :my_match_object instead."; 5{string, here, ?who = player} = args; 6if ($failed_match != (object = this:literal_object(string))) 7return object; 8elseif (string == "me") 9return who; 10elseif (string == "here") 11return here; 12elseif ((valid(pobject = who:match(string)) && (string in {@pobject.aliases, pobject.name})) || (!valid(here))) 13"...exact match in player or room is bogus..."; 14return pobject; 15elseif ((valid(hobject = here:match(string)) && (string in {@hobject.aliases, hobject.name})) || (pobject == $failed_match)) 16"...exact match in room or match in player failed completely..."; 17return hobject; 18else 19return pobject; 20endif
match_player
Referenced by
- #2:@quota line 5:
$string_utils:match_player - #2:@audit line 3:
$string_utils:match_player - #2:@count line 3:
$string_utils:match_player - #2:@countDB line 3:
$string_utils:match_player - #2:@location*s line 5:
$string_utils:match_player - #2:@measure line 29:
$string_utils:match_player - #2:@measure line 39:
$string_utils:match_player - #2:@measure line 75:
$string_utils:match_player - #2:@features line 4:
$string_utils:match_player - #2:@ch*eck-full line 12:
$string_utils:match_player - #2:@ch*eck-full line 14:
$string_utils:match_player - #2:@w*h*o line 4:
$string_utils:match_player - #2:#* line 21:
$string_utils:match_player - #3:match_someone line 9:
$su:match_player - #3:@rmresident line 5:
$su:match_player - #3:@addresident line 8:
$su:match_player - #4:w*ho line 13:
$string_utils:match_player - #4:who(vanilla) line 6:
$string_utils:match_player - #6:page line 25:
$su:match_player - #6:friend*s line 21:
$su:match_player - #6:friend*s line 38:
$su:match_player - #6:allows line 8:
$su:match_player - #6:journal*s line 3:
$su:match_player - #6:gear line 9:
$su:match_player - #6:enemy line 7:
$su:match_player - #6:enemy line 24:
$su:match_player - #6:idle line 5:
$su:match_player - #6:@age line 6:
$string_utils:match_player - #6:job*s line 4:
$su:match_player - #6:@register-alt line 6:
$su:match_player - #6:blind_gear line 6:
$su:match_player - #17:do_register line 8:
$string_utils:match_player - #20:literal_object line 8:
this:match_player - #20:match_player_or_object line 16:
$string_utils:match_player - #33:@add-notify line 7:
$string_utils:match_player - #33:@add-notify line 20:
$string_utils:match_player - #38:match_recipient line 11:
$string_utils:match_player - #38:match_recipient line 12:
$string_utils:match_player - #39:pri*nt line 3:
$string_utils:match_player - #43:lis*t line 16:
$string_utils:match_player - #49:@chown*# line 12:
$string_utils:match_player - #49:@programmer line 2:
$string_utils:match_player - #49:@toad line 17:
$string_utils:match_player - #49:@quota line 7:
$string_utils:match_player - #49:kill_aux_wizard_parse line 18:
$string_utils:match_player - #49:@net-who line 13:
su:match_player - #49:@newt line 9:
$string_utils:match_player - #49:@unnewt line 8:
$string_utils:match_player - #49:@new-password line 6:
$string_utils:match_player - #49:@temp-newt line 3:
$string_utils:match_player - #49:@deprog*rammer line 31:
$string_utils:match_player - #49:@summon line 1:
$su:match_player - #49:@old-grant line 13:
$string_utils:match_player - #49:@commentban line 9:
$su:match_player - #50:@prop*erty line 41:
$string_utils:match_player - #50:@verb line 51:
$string_utils:match_player - #50:@forked line 17:
$string_utils:match_player - #50:@kill line 21:
$string_utils:match_player - #50:@pros*pectus line 3:
$string_utils:match_player - #50:@forked-v*erbose line 17:
$string_utils:match_player - #50:walkto line 6:
$su:match_player - #50:res*urrect line 4:
$su:match_player - #50:heal line 7:
$su:match_player - #50:@pardon line 5:
$su:match_player - #50:@chatban line 3:
$su:match_player - #50:@extract line 5:
$su:match_player - #50:@assume-form line 8:
$su:match_player - #50:@got line 2:
$su:match_player - #50:@find line 24:
$string_utils:match_player - #50:@rp-award line 6:
$su:match_player - #50:@donation line 2:
$su:match_player - #50:@chown*# line 11:
$string_utils:match_player - #84:@pasteto line 4:
$string_utils:match_player - #89:@join line 4:
$su:match_player - #89:@mjoin line 1:
$su:match_player - #89:@join_old line 11:
$string_utils:match_player - #92:qu*eue line 3:
$su:match_player - #100:sc*ore line 3:
$su:match_player - #100:st*atus line 3:
$su:match_player - #100:karma line 6:
$su:match_player - #100:birthday line 2:
$su:match_player - #113:@vloc line 11:
$string_utils:match_player - #113:@ line 5:
$su:match_player - #130:match_wristpad line 8:
$su:match_player - #130:ignore line 2:
$su:match_player - #293:_@assign line 16:
$su:match_player - #293:assigned_msg_seq line 6:
$su:match_player - #317:@spy line 1:
$su:match_player - #317:@networth line 7:
$su:match_player - #318:wh*o line 45:
$su:match_player - #324:authorise line 9:
$string_utils:match_player - #326:get_pvp_report line 1:
$su:match_player - #326:print_report line 1:
$su:match_player - #326:print_report line 17:
$su:match_player - #326:get_victim_report line 1:
$su:match_player - #326:get_griefer_report line 1:
$su:match_player - #334:authorize line 7:
$su:match_player - #334:deauthorize line 4:
$su:match_player
Source
1"match_player(name,name,...) => {obj,obj,...}"; 2"match_player(name[,meobj]) => obj"; 3"match_player({name,...}[,meobj]) => {obj,...}"; 4"objs returned are either players, $failed_match, $ambiguous_match, or $nothing in the case of an empty string."; 5"meobj (what to return for instances of `me') defaults to player; if given and isn't actually a player, `me' => $failed_match"; 6retstr = 0; 7me = player; 8if ((length(args) < 2) || (typeof(me = args[2]) == OBJ)) 9me = (valid(me) && is_player(me)) ? me | $failed_match; 10if (typeof(args[1]) == STR) 11strings = {args[1]}; 12retstr = 1; 13"return a string, not a list"; 14else 15strings = args[1]; 16endif 17else 18strings = args; 19me = player; 20endif 21found = {}; 22for astr in (strings) 23if (!astr) 24aobj = $nothing; 25elseif (astr == "me") 26aobj = me; 27elseif (valid(aobj = $string_utils:literal_object(astr)) && is_player(aobj)) 28"astr is a valid literal object number of some player, so we are done."; 29else 30aobj = $player_db:find(astr); 31endif 32found = {@found, aobj}; 33endfor 34return retstr ? found[1] | found;
match_player_or_object
Referenced by
none
Source
1"Accepts any number of strings, attempts to match those strings first against objects in the room, and if no objects by those names exist, matches against player names (and \"#xxxx\" style strings regardless of location). Returns a list of valid objects so found."; 2"Unlike $string_utils:match_player, does not include in the list the failed and ambiguous matches; instead has built-in error messages for such objects. This should probably be improved. Volunteers?"; 3if (!args) 4return; 5endif 6unknowns = {}; 7objs = {}; 8"We have to do something icky here. Parallel walk the victims and args lists. When it's a valid object, then it's a player. If it's an invalid object, try to get an object match from the room. If *that* fails, complain."; 9for i in [1..length(args)] 10if (valid(o = player.location:match_object(args[i]))) 11objs = {@objs, o}; 12else 13unknowns = {@unknowns, args[i]}; 14endif 15endfor 16victims = $string_utils:match_player(unknowns); 17for i in [1..length(victims)] 18if (!valid(victims[i])) 19player:tell("Could not find ", unknowns[i], " as either an object or a player."); 20else 21objs = {@objs, victims[i]}; 22endif 23endfor 24return objs;
find_prefix
Referenced by
- #2:@features line 15:
$string_utils:find_prefix - #34:set line 6:
$string_utils:find_prefix - #35:from_day line 8:
$string_utils:find_prefix - #35:from_month line 8:
$string_utils:find_prefix
Source
1"find_prefix(prefix, string-list) => list index of something starting with prefix, or 0 or $ambiguous_match."; 2{subject, choices} = args; 3answer = 0; 4for i in [1..length(choices)] 5if (index(choices[i], subject) == 1) 6if (answer == 0) 7answer = i; 8else 9answer = $ambiguous_match; 10endif 11endif 12endfor 13return answer;
index_d*elimited
Referenced by
none
Source
1"index_delimited(string,target[,case_matters]) is just like the corresponding call to the builtin index() but instead only matches on occurences of target delimited by word boundaries (i.e., not preceded or followed by an alphanumeric)"; 2args[2] = ("%(%W%|^%)" + $string_utils:regexp_quote(args[2])) + "%(%W%|$%)"; 3return (m = match(@args)) ? m[3][1][2] + 1 | 0;
is_integer is_numeric
Referenced by
- #4:parse_command line 13:
$string_utils:is_numeric - #27:from_string line 11:
su:is_numeric - #27:from_string line 16:
su:is_numeric - #27:from_string line 24:
su:is_numeric - #35:parse_english_time_interval line 23:
$string_utils:is_numeric - #87:_do_convert line 21:
$string_utils:is_integer
Source
1"Usage: is_numeric(string)"; 2" is_integer(string)"; 3"Is string numeric (composed of one or more digits possibly preceded by a minus sign)? This won't catch floating points."; 4"Return true or false"; 5return match(args[1], "^ *[-+]?[0-9]+ *$"); 6digits = "1234567890"; 7if (!(string = args[1])) 8return 0; 9endif 10if (string[1] == "-") 11string = string[2..length(string)]; 12endif 13for i in [1..length(string)] 14if (!index(digits, string[i])) 15return 0; 16endif 17endfor 18return 1;
ordinal
Referenced by
- #75:measurement_task line 19:
$string_utils:ordinal - #75:measurement_task_nofork line 6:
$string_utils:ordinal
Source
1":short_ordinal(1) => \"1st\",:short_ordinal(2) => \"2nd\",etc..."; 2string = tostr(n = args[1]); 3n = abs(n) % 100; 4if (((n / 10) != 1) && ((n % 10) in {1, 2, 3})) 5return string + {"st", "nd", "rd"}[n % 10]; 6else 7return string + "th"; 8endif
group_number gn
Referenced by
- #2:@count line 11:
$string_utils:group_number - #2:@measure line 17:
$string_utils:group_number - #2:@measure line 19:
$string_utils:group_number - #2:@d*isplay line 145:
$string_utils:group_number - #6:tell_age line 2:
$su:group_number - #6:@age line 37:
$su:group_number - #6:show_xp line 3:
$su:group_number - #6:show_xp line 4:
$su:group_number - #6:show_xp line 6:
$su:group_number - #21:do_audit line 42:
$string_utils:group_number - #50:@d*isplay line 145:
$string_utils:group_number - #75:display_quota line 23:
$string_utils:group_number - #75:display_quota line 23:
$string_utils:group_number - #75:display_quota_summary line 2:
$string_utils:group_number - #75:display_quota_summary line 3:
$string_utils:group_number - #75:display_quota_summary line 5:
$string_utils:group_number - #75:display_quota_summary line 7:
$string_utils:group_number - #75:do_summary line 5:
$string_utils:group_number - #114:@list-costs line 8:
$su:group_number - #114:@list-costs line 10:
$su:group_number - #130:look_self line 20:
$su:group_number - #167:tree_tag line 11:
$su:group_number - #167:summary line 10:
$su:group_number - #167:biz_employees line 12:
$su:group_number - #317:@topvalue line 13:
$su:group_number - #317:@topvalue line 16:
$su:group_number - #317:@topvalue line 17:
$su:group_number - #317:@rspy line 37:
$su:group_number - #317:@networth line 14:
$su:group_number - #317:@topitems line 12:
$su:group_number - #317:@topvalues line 13:
$su:group_number - #317:@itemreport line 31:
$su:group_number - #317:@itemreport line 32:
$su:group_number - #317:@itemreport line 33:
$su:group_number - #334:@list-costs line 10:
$su:group_number - #334:@list-costs line 12:
$su:group_number - #367:look_self line 2:
$su:gn
Source
1"$string_utils:group_number(INT n [, sep_char])"; 2"$string_utils:group_number(FLOAT n, [INT precision [, scientific [, sep_char]]])"; 3""; 4"Converts N to a string, inserting commas (or copies of SEP_CHAR, if given) every three digits, counting from the right. For example, $string_utils:group_number(1234567890) returns the string \"1,234,567,890\"."; 5"For floats, the arguements precision (defaulting to 4 in this verb) and scientific are the same as given in floatstr()."; 6if (typeof(args[1]) == INT) 7{n, ?comma = ","} = args; 8result = ""; 9sign = (n < 0) ? "-" | ""; 10n = tostr(abs(n)); 11elseif (typeof(args[1]) == FLOAT) 12{n, ?prec = 4, ?scien = 0, ?comma = ","} = args; 13sign = (n < 0.0) ? "-" | ""; 14n = floatstr(abs(n), prec, scien); 15i = index(n, "."); 16result = n[i..$]; 17n = n[1..i - 1]; 18else 19return E_INVARG; 20endif 21while ((len = length(n)) > 3) 22result = (comma + n[len - 2..len]) + result; 23n = n[1..len - 3]; 24endwhile 25return (sign + n) + result; 26"Code contributed by SunRay";
english_number
Referenced by
- #1:plural_name line 4:
$su:english_number - #3:player_integration_msg line 10:
$su:english_number - #3:player_integration_msg line 14:
$su:english_number - #3:distant_figures line 23:
$su:english_number - #3:player_integration_msg_old line 9:
$su:english_number - #3:tell_contents_terserun line 23:
$su:english_number - #6:pname line 5:
$su:english_number - #6:job*s line 120:
$su:english_number - #20:english_ordinal line 6:
this:english_number - #20:english_ordinal line 15:
this:english_number - #20:english_ordinal line 18:
this:english_number - #20:plural line 73:
$su:english_number - #20:aggregate_number line 3:
this:english_number - #54:count line 38:
$su:english_number - #54:old_count line 17:
$su:english_number - #81:help_msg line 4:
$string_utils:english_number - #81:check_length line 2:
$string_utils:english_number - #107:count line 34:
$su:english_number - #145:look_self line 3:
$su:english_number - #158:fall line 12:
$su:english_number - #335:description line 2:
$su:english_number - #335:description line 3:
$su:english_number
Source
1"$string_utils:english_number(n) -- convert the integer N into English"; 2""; 3"Produces a string containing the English phrase naming the given integer. For example, $string_utils:english_number(-1234) returns the string `negative one thousand two hundred thirty-four'."; 4numb = toint(args[1]); 5if (numb == 0) 6return "zero"; 7endif 8labels = {"", " thousand", " million", " billion"}; 9numstr = ""; 10mod = abs(numb); 11for n in [1..4] 12div = mod % 1000; 13if (div) 14hun = div / 100; 15ten = div % 100; 16outstr = this:english_tens(ten) + labels[n]; 17if (hun) 18outstr = ((this:english_ones(hun) + " hundred") + (ten ? " " | "")) + outstr; 19endif 20if (numstr) 21numstr = (outstr + " ") + numstr; 22else 23numstr = outstr; 24endif 25endif 26mod = mod / 1000; 27endfor 28return ((numb < 0) ? "negative " | "") + numstr;
english_ordinal
Referenced by
- #96:level_desc_for line 6:
$su:english_ordinal
Source
1"$string_utils:english_ordinal(n) -- convert the integer N into an english ordinal (1 => \"first\", etc...)"; 2numb = toint(args[1]); 3if (numb == 0) 4return "zeroth"; 5elseif (numb % 100) 6hundreds = (abs(numb) > 100) ? this:english_number((numb / 100) * 100) + " " | ((numb < 0) ? "negative " | ""); 7numb = abs(numb) % 100; 8specials = {1, 2, 3, 5, 8, 9, 12, 20, 30, 40, 50, 60, 70, 80, 90}; 9ordinals = {"first", "second", "third", "fifth", "eighth", "ninth", "twelfth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth"}; 10if (i = numb in specials) 11return hundreds + ordinals[i]; 12elseif ((numb > 20) && (i = (numb % 10) in specials)) 13return ((hundreds + this:english_tens((numb / 10) * 10)) + "-") + ordinals[i]; 14else 15return (hundreds + this:english_number(numb)) + "th"; 16endif 17else 18return this:english_number(numb) + "th"; 19endif
english_ones
Referenced by
- #20:english_number line 18:
this:english_ones - #20:english_tens line 5:
this:english_ones - #20:english_tens line 9:
this:english_ones
Source
1numb = args[1]; 2ones = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; 3return ones[numb + 1];
english_tens
Referenced by
- #20:english_number line 16:
this:english_tens - #20:english_ordinal line 13:
this:english_tens
Source
1numb = args[1]; 2teens = {"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}; 3others = {"twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"}; 4if (numb < 10) 5return this:english_ones(numb); 6elseif (numb < 20) 7return teens[numb - 9]; 8else 9return (others[(numb / 10) - 1] + ((numb % 10) ? "-" | "")) + this:english_ones(numb % 10); 10endif
subst*itute
Referenced by
none
Source
1"subst(string,{{redex1,repl1},{redex2,repl2},{redex3,repl3}...}[,case])"; 2" => returns string with all instances of the strings redex<n> replaced respectively by the strings repl<n>. If the optional argument `case' is given and nonzero, the search for instances of redex<n> is case sensitive."; 3" Substitutions are done in parallel, i.e., instances of redex<n> that appear in any of the replacement strings are ignored. In the event that two redexes overlap, whichever is leftmost in `string' takes precedence. For two redexes beginning at the same position, the longer one takes precedence."; 4""; 5"subst(\"hoahooaho\",{{\"ho\",\"XhooX\"},{\"hoo\",\"mama\"}}) => \"XhooXamamaaXhooX\""; 6"subst(\"Cc: banana\",{{\"a\",\"b\"},{\"b\",\"c\"},{\"c\",\"a\"}},1) => \"Ca: cbnbnb\""; 7{ostr, subs, ?case = 0} = args; 8if (typeof(ostr) != STR) 9return ostr; 10endif 11len = length(ostr); 12" - - - find the first instance of each substitution - -"; 13indices = {}; 14substs = {}; 15for s in (subs) 16if (i = index(ostr, s[1], case)) 17fi = $list_utils:find_insert(indices, i = i - len) - 1; 18while (fi && ((indices[fi] == i) && (length(substs[fi][1]) < length(s[1])))) 19"...give preference to longer redexes..."; 20fi = fi - 1; 21endwhile 22indices = listappend(indices, i, fi); 23substs = listappend(substs, s, fi); 24endif 25endfor 26"- - - - - perform substitutions - "; 27nstr = ""; 28while (substs) 29ind = len + indices[1]; 30sub = substs[1]; 31indices = listdelete(indices, 1); 32substs = listdelete(substs, 1); 33if (ind > 0) 34nstr = (nstr + ostr[1..ind - 1]) + sub[2]; 35ostr = ostr[ind + length(sub[1])..len]; 36len = length(ostr); 37endif 38if (next = index(ostr, sub[1], case)) 39fi = $list_utils:find_insert(indices, next = next - len) - 1; 40while (fi && ((indices[fi] == next) && (length(substs[fi][1]) < length(sub[1])))) 41"...give preference to longer redexes..."; 42fi = fi - 1; 43endwhile 44indices = listappend(indices, next, fi); 45substs = listappend(substs, sub, fi); 46endif 47endwhile 48return nstr + ostr;
substitute_d*elimited
Referenced by
none
Source
1"subst(string,{{redex1,repl1},{redex2,repl2},{redex3,repl3}...}[,case])"; 2"Just like :substitute() but it uses index_delimited() instead of index()"; 3{ostr, subs, ?case = 0} = args; 4if (typeof(ostr) != STR) 5return ostr; 6endif 7len = length(ostr); 8" - - - find the first instance of each substitution - -"; 9indices = {}; 10substs = {}; 11for s in (subs) 12if (i = this:index_delimited(ostr, s[1], case)) 13fi = $list_utils:find_insert(indices, i = i - len) - 1; 14while (fi && ((indices[fi] == i) && (length(substs[fi][1]) < length(s[1])))) 15"...give preference to longer redexes..."; 16fi = fi - 1; 17endwhile 18indices = listappend(indices, i, fi); 19substs = listappend(substs, s, fi); 20endif 21endfor 22"- - - - - perform substitutions - "; 23nstr = ""; 24while (substs) 25ind = len + indices[1]; 26sub = substs[1]; 27indices = listdelete(indices, 1); 28substs = listdelete(substs, 1); 29if (ind > 0) 30nstr = (nstr + ostr[1..ind - 1]) + sub[2]; 31ostr = ostr[ind + length(sub[1])..len]; 32len = length(ostr); 33endif 34if (next = this:index_delimited(ostr, sub[1], case)) 35fi = $list_utils:find_insert(indices, next = next - len) - 1; 36while (fi && ((indices[fi] == next) && (length(substs[fi][1]) < length(sub[1])))) 37"...give preference to longer redexes..."; 38fi = fi - 1; 39endwhile 40indices = listappend(indices, next, fi); 41substs = listappend(substs, sub, fi); 42endif 43endwhile 44return nstr + ostr;
_cap_property
Referenced by
- #20:_cap_property line 11:
this:_cap_property - #20:pronoun_sub line 111:
$string_utils:_cap_property - #20:alt_pronoun_sub line 71:
$string_utils:_cap_property - #20:ps_backup line 73:
$string_utils:_cap_property - #34:pronoun_sub line 49:
$string_utils:_cap_property
Source
1"cap_property(what,prop[,ucase]) returns what.(prop) but capitalized if either ucase is true or the prop name specified is capitalized."; 2"If prop is blank, returns what:title()."; 3"If prop is bogus or otherwise irretrievable, returns the error."; 4"If capitalization is indicated, we return what.(prop+\"c\") if that exists, else we capitalize what.(prop) in the usual fashion. There is a special exception for is_player(what)&&prop==\"name\" where we just return what.name if no .namec is provided --- ie., a player's .name is never capitalized in the usual fashion."; 5"If args[1] is a list, calls itself on each element of the list and returns $string_utils:english_list(those results)."; 6{what, prop, ?ucase = 0} = args; 7set_task_perms(caller_perms()); 8if (typeof(what) == LIST) 9result = {}; 10for who in (what) 11result = {@result, this:_cap_property(who, prop, ucase)}; 12endfor 13return $string_utils:english_list(result); 14endif 15ucase = (prop && (strcmp(prop, "a") < 0)) || ucase; 16if (!prop) 17return valid(what) ? ucase ? what:titlec() | what:title() | ((ucase ? "N" | "n") + "othing"); 18elseif ((!ucase) || (typeof(s = `what.(prop + "c") ! ANY') == ERR)) 19if (prop == "name") 20s = valid(what) ? what.name | "nothing"; 21ucase = ucase && (!is_player(what)); 22else 23s = `$object_utils:has_property(what, prop) ? what.(prop) | $player.(prop) ! ANY'; 24endif 25(s && (typeof(s) == LIST)) && (s = s[random($)]); 26if (ucase && (s && ((typeof(s) == STR) && (((z = index(this.alphabet, s[1], 1)) < 27) && (z > 0))))) 27s[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[z]; 28endif 29endif 30return (typeof(s) == ERR) ? s | tostr(s);
pronoun_sub ps
Referenced by
- #0:bf_recycle line 8:
$string_utils:pronoun_sub - #1:look_place_msg line 2:
$su:ps - #3:emote line 4:
$su:ps - #3:who_location_msg line 1:
$string_utils:pronoun_sub - #3:do_sit line 14:
$string_utils:pronoun_sub - #3:do_sit line 17:
$string_utils:pronoun_sub - #3:do_sit line 23:
$string_utils:pronoun_sub - #3:do_sit line 24:
$string_utils:pronoun_sub - #3:do_sit line 27:
$string_utils:pronoun_sub - #3:do_sit line 28:
$string_utils:pronoun_sub - #3:do_recline line 13:
$string_utils:pronoun_sub - #3:do_recline line 16:
$string_utils:pronoun_sub - #3:do_recline line 21:
$string_utils:pronoun_sub - #3:do_recline line 22:
$string_utils:pronoun_sub - #3:do_recline line 25:
$string_utils:pronoun_sub - #3:do_recline line 26:
$string_utils:pronoun_sub - #3:do_stand line 4:
$string_utils:pronoun_sub - #3:do_stand line 8:
$string_utils:pronoun_sub - #3:do_stand line 9:
$string_utils:pronoun_sub - #3:fall_into line 21:
$su:ps - #3:fall_into line 47:
$su:ps - #5:_eat line 10:
$su:ps - #6:page_origin_msg line 2:
$string_utils:pronoun_sub - #6:@gender line 4:
$string_utils:pronoun_sub - #6:@gender line 34:
$string_utils:pronoun_sub - #6:teach line 35:
$su:ps - #6:@age line 34:
$string_utils:pronoun_sub - #6:pee line 18:
$su:ps - #6:learn line 8:
$su:ps - #6:_page line 21:
$su:ps - #8:oclose_msg line 1:
$string_utils:pronoun_sub - #20:pronoun_sub_secure line 8:
this:pronoun_sub - #20:pronoun_sub_secure line 9:
this:pronoun_sub - #25:disfunc line 11:
$string_utils:pronoun_sub - #25:disfunc line 13:
$string_utils:pronoun_sub - #25:extra_confunc_msg line 1:
$string_utils:pronoun_sub - #33:mail_forward line 2:
$string_utils:pronoun_sub - #37:mail_forward line 4:
$string_utils:pronoun_sub - #37:moderator_forward line 2:
$string_utils:pronoun_sub - #43:done line 17:
$su:ps - #43:suck_in line 13:
$su:ps - #43:who_location_msg line 8:
$string_utils:pronoun_sub - #49:@programmer line 8:
$string_utils:pronoun_sub - #49:toad_msg line 10:
$string_utils:pronoun_sub - #49:toad_msg line 12:
$string_utils:pronoun_sub - #49:toad_msg line 14:
$string_utils:pronoun_sub - #50:murder line 18:
$su:ps - #50:murder line 26:
$su:ps - #50:heal line 19:
$su:ps - #50:heal line 23:
$su:ps - #50:@revert-form line 13:
$su:ps - #54:open line 2:
$su:ps - #54:open line 12:
$su:ps - #54:close line 12:
$su:ps - #54:description line 3:
$su:ps - #54:tell_contents_backup line 5:
$su:ps - #54:tell_contents_backup line 9:
$su:ps - #54:clean line 11:
$su:ps - #54:clean line 12:
$su:ps - #54:clean line 14:
$su:ps - #54:clean line 15:
$su:ps - #54:peek line 10:
$su:ps - #55:arrive_msg line 1:
$su:ps - #55:look_self line 3:
$su:ps - #55:try_me line 9:
$su:ps - #55:try_me line 14:
$su:ps - #55:move line 9:
$su:ps - #55:move line 19:
$su:ps - #55:move line 23:
$su:ps - #55:description line 3:
$su:ps - #55:leave_msg line 2:
$su:ps - #55:leave_msg line 11:
$su:ps - #55:throw_through line 7:
$su:ps - #55:_push line 43:
$su:ps - #57:request line 23:
$string_utils:pronoun_sub - #65:look_self line 2:
$string_utils:pronoun_sub - #65:take_away_msg line 1:
$string_utils:pronoun_sub - #84:|* line 12:
$su:ps - #89:msg_sub line 4:
$string_utils:pronoun_sub - #89:die line 19:
$su:ps - #89:@mjoin line 7:
$su:ps - #89:@mjoin line 21:
$su:ps - #89:_teleport line 22:
$su:ps - #89:_teleport line 26:
$su:ps - #89:_teleport line 32:
$su:ps - #89:@join_old line 42:
$string_utils:pronoun_sub - #93:doing_msg line 7:
$su:ps - #93:doing_msg line 15:
$su:ps - #93:_abort line 4:
$su:ps - #95:inflict_damage line 49:
$su:ps - #95:start_attack line 9:
$su:ps - #95:suicide_attack line 2:
$su:ps - #95:_brandish line 9:
$su:ps - #96:improve line 24:
$su:ps - #96:learn line 8:
$su:ps - #100:tell_appraise line 5:
$su:ps - #102:bleed line 8:
$su:ps - #103:reach line 6:
$su:ps - #103:reach line 20:
$su:ps - #104:rot line 6:
$su:ps - #104:_eat line 7:
$su:ps - #104:setup_for line 16:
$su:ps - #106:hear_say_to line 8:
$su:ps - #106:greet line 4:
$su:ps - #106:head_to line 15:
$su:ps - #106:suggest_teacher line 14:
$su:ps - #107:_wield line 11:
$su:ps - #107:_wield line 33:
$string_utils:pronoun_sub - #107:_unwield line 14:
$string_utils:pronoun_sub - #107:take_damage line 50:
$su:ps - #107:die line 45:
$su:ps - #107:die line 168:
$su:ps - #107:die line 170:
$su:ps - #107:say line 26:
$su:ps - #107:say line 38:
$su:ps - #107:_get line 13:
$su:ps - #107:_get line 22:
$su:ps - #107:_drop line 8:
$su:ps - #107:tell_health line 13:
$su:ps - #107:tell_health line 20:
$su:ps - #107:_wake line 26:
$su:ps - #107:respawn line 24:
$su:ps - #107:tell_wearing line 16:
$su:ps - #107:tell_wearing line 49:
$su:ps - #107:_resist line 41:
$su:ps - #107:_get_from_container line 11:
$su:ps - #107:_learn line 12:
$su:ps - #107:_learn line 18:
$su:ps - #107:_learn line 19:
$su:ps - #107:_learn line 21:
$su:ps - #107:_learn line 22:
$su:ps - #107:_learn line 24:
$su:ps - #107:_learn line 26:
$su:ps - #107:_learn line 27:
$su:ps - #107:_learn line 28:
$su:ps - #107:_learn line 42:
$su:ps - #107:_block line 5:
$su:ps - #107:tell_carrying line 21:
$su:ps - #107:tell_carrying line 25:
$su:ps - #111:deteriorate line 6:
$su:ps - #111:disintegrate line 3:
$su:ps - #111:tell_health line 13:
$su:ps - #111:tease line 4:
$su:ps - #111:tease line 7:
$su:ps - #115:fix line 4:
$su:ps - #115:turn line 7:
$su:ps - #115:turn line 15:
$su:ps - #115:_break line 4:
$su:ps - #115:description line 20:
$su:ps - #119:look_self line 5:
$su:ps - #119:look_self line 10:
$su:ps - #119:look_self line 14:
$su:ps - #119:look_self line 19:
$su:ps - #119:look_self line 31:
$su:ps - #119:look_self line 33:
$su:ps - #119:_open line 35:
$su:ps - #119:try_open line 9:
$su:ps - #119:try_open line 17:
$su:ps - #119:try_close line 6:
$su:ps - #119:_close line 28:
$su:ps - #119:_knock line 8:
$su:ps - #119:_bash line 7:
$su:ps - #119:_bash line 8:
$su:ps - #119:squeal_msg line 20:
$su:ps - #119:squeal_msg line 22:
$su:ps - #124:_unlock line 21:
$su:ps - #124:_unlock line 35:
$su:ps - #124:try_unlock line 8:
$su:ps - #124:_lock line 18:
$su:ps - #124:_lock line 18:
$su:ps - #124:_lock line 20:
$su:ps - #124:_lock line 20:
$su:ps - #124:_lock line 26:
$su:ps - #124:try_lock line 10:
$su:ps - #124:hear_close line 3:
$su:ps - #124:_unlock_otherside line 2:
$su:ps - #124:_lock_otherside line 2:
$su:ps - #125:effect line 10:
$su:ps - #125:reup line 5:
$su:ps - #125:reup line 8:
$su:ps - #125:onset line 3:
$su:ps - #125:onset line 6:
$su:ps - #125:overdose line 3:
$su:ps - #125:remove_from line 24:
$su:ps - #125:recover line 3:
$su:ps - #125:tell_diagnosis line 9:
$su:ps - #125:effect_description line 4:
$su:ps - #125:effect_description line 6:
$su:ps - #128:use_finish line 15:
$su:ps - #128:use_finish line 17:
$su:ps - #129:get line 2:
$su:ps - #129:do_get line 13:
$su:ps - #129:do_get line 14:
$su:ps - #129:put line 5:
$su:ps - #129:do_put line 9:
$su:ps - #129:do_put line 10:
$su:ps - #130:_page line 32:
$su:ps - #130:switch line 10:
$su:ps - #130:radio line 28:
$su:ps - #130:radio line 30:
$su:ps - #133:read line 11:
$su:ps - #133:read line 13:
$su:ps - #133:read line 34:
$su:ps - #134:heartbeat line 7:
$su:ps - #134:_turn_on line 2:
$su:ps - #134:_turn_off line 2:
$su:ps - #134:start line 7:
$su:ps - #134:start line 11:
$su:ps - #135:_explode line 20:
$su:ps - #135:_pull line 22:
$su:ps - #137:do_sit line 13:
$string_utils:pronoun_sub - #137:do_sit line 16:
$string_utils:pronoun_sub - #137:do_sit line 22:
$string_utils:pronoun_sub - #137:do_sit line 23:
$string_utils:pronoun_sub - #137:do_sit line 27:
$string_utils:pronoun_sub - #137:do_sit line 28:
$string_utils:pronoun_sub - #137:do_stand line 5:
$string_utils:pronoun_sub - #137:do_stand line 10:
$string_utils:pronoun_sub - #137:do_stand line 11:
$string_utils:pronoun_sub - #137:do_recline line 18:
$string_utils:pronoun_sub - #137:do_recline line 21:
$string_utils:pronoun_sub - #137:do_recline line 27:
$string_utils:pronoun_sub - #137:do_recline line 28:
$string_utils:pronoun_sub - #137:do_recline line 32:
$string_utils:pronoun_sub - #137:do_recline line 33:
$string_utils:pronoun_sub - #137:old_users_msg line 23:
$string_utils:pronoun_sub - #137:old_users_msg line 26:
$string_utils:pronoun_sub - #137:old_users_msg line 45:
$string_utils:pronoun_sub - #137:old_users_msg line 48:
$string_utils:pronoun_sub - #137:old_users_msg line 51:
$string_utils:pronoun_sub - #137:old_users_msg line 54:
$string_utils:pronoun_sub - #138:eat line 2:
$su:ps - #138:_eat line 11:
$su:ps - #138:_rot line 2:
$su:ps - #138:look_self line 9:
$su:ps - #138:look_self line 21:
$su:ps - #138:burn_up line 1:
$su:ps - #141:_disperse line 4:
$su:ps - #141:tell_person line 8:
$su:ps - #141:wipe line 20:
$su:ps - #141:wipe line 22:
$su:ps - #141:lick line 7:
$su:ps - #141:lick line 13:
$su:ps - #141:lick line 15:
$su:ps - #143:hear_event_pick line 4:
$su:ps - #143:hear_event_pick line 5:
$su:ps - #144:hang line 11:
$su:ps - #144:hang line 12:
$su:ps - #144:hang line 16:
$su:ps - #144:odetach_msg line 4:
$su:ps - #146:_announce line 6:
$su:ps - #146:_open line 5:
$su:ps - #146:_close line 3:
$su:ps - #146:die line 9:
$su:ps - #146:look_self line 3:
$su:ps - #147:do_put line 3:
$su:ps - #147:do_put line 8:
$su:ps - #147:do_put line 9:
$su:ps - #147:do_put line 11:
$su:ps - #147:do_get line 3:
$su:ps - #147:do_get line 8:
$su:ps - #147:do_get line 9:
$su:ps - #147:do_get line 11:
$su:ps - #147:do_get line 12:
$su:ps - #147:make_old line 7:
$su:ps - #147:do_make line 76:
$su:ps - #147:do_make line 77:
$su:ps - #147:do_make line 81:
$su:ps - #147:do_make line 82:
$su:ps - #147:skill_check_failed line 7:
$su:pronoun_sub - #147:skill_check_failed line 8:
$su:pronoun_sub - #148:_eat line 8:
$su:ps - #148:explode line 18:
$su:ps - #149:_do_social line 110:
$su:ps - #151:switch line 9:
$su:ps - #151:tell_setting line 1:
$su:ps - #151:_finish line 6:
$su:ps - #151:_finish line 13:
$su:ps - #154:popmon line 44:
$su:ps - #158:try_me line 6:
$su:ps - #158:try_me line 12:
$su:ps - #158:try_me line 13:
$su:ps - #158:move line 13:
$su:ps - #158:move line 18:
$su:ps - #158:detach line 9:
$su:ps - #158:jump line 6:
$su:ps - #158:jump line 9:
$su:ps - #158:jump line 15:
$su:ps - #158:look_place_msg line 1:
$su:ps - #158:_force_invoke line 8:
$su:ps - #158:_force_invoke line 11:
$su:ps - #158:_force_invoke line 13:
$su:ps - #167:record_shop_sale line 2:
$su:ps - #167:record_shop_stock line 2:
$su:ps - #167:record_shop_removal line 2:
$su:ps - #167:record_shop_reprice line 2:
$su:ps - #181:look_place_msg line 6:
$su:ps - #181:open line 6:
$su:ps - #181:open line 12:
$su:ps - #181:close line 6:
$su:ps - #181:close line 12:
$su:ps - #184:_finish line 103:
$su:ps - #184:_finish line 106:
$su:ps - #198:_eat line 3:
$su:ps - #198:eat line 4:
$su:ps - #201:turn line 10:
$su:ps - #201:turn line 17:
$su:ps - #201:look_place_msg line 3:
$su:ps - #201:look_place_msg line 5:
$su:ps - #203:look_self line 4:
$su:ps - #203:look_self line 6:
$su:ps - #203:look_self line 8:
$su:ps - #203:look_self line 11:
$su:ps - #208:_break line 2:
$su:ps - #214:drift_clouds line 29:
$su:ps - #214:drift_clouds line 32:
$su:ps - #214:drift_clouds line 45:
$su:ps - #214:drift_clouds line 48:
$su:ps - #215:upgrade line 14:
$su:ps - #222:_finish line 21:
$su:ps - #222:_finish line 58:
$su:ps - #222:doing_msg line 3:
$su:ps - #222:doing_msg line 5:
$su:ps - #223:calculate line 7:
$su:ps - #223:press line 27:
$su:ps - #223:press line 28:
$su:ps - #223:press line 30:
$su:ps - #223:press line 33:
$su:ps - #223:set_chip line 10:
$su:ps - #223:read line 16:
$su:ps - #223:read line 17:
$su:ps - #225:drink line 4:
$su:ps - #247:at line 30:
$su:ps - #247:at line 33:
$su:ps - #247:at line 41:
$su:ps - #247:at line 42:
$su:ps - #247:at line 44:
$su:ps - #255:_break line 4:
$su:ps - #255:_break line 5:
$su:ps - #255:_break line 7:
$su:ps - #255:_break line 10:
$su:ps - #256:_flow_through line 26:
$su:ps - #267:do_spring line 2:
$su:ps - #267:do_spring line 7:
$su:ps - #267:do_strike line 2:
$su:ps - #267:do_notice line 2:
$su:ps - #267:do_notice line 5:
$su:ps - #267:do_notice line 7:
$su:ps - #267:install line 16:
$su:ps - #267:look_place_msg line 2:
$su:ps - #267:do_disarm line 5:
$su:ps - #270:_finish line 83:
$su:ps - #270:_finish line 86:
$su:ps - #283:reset line 14:
$su:ps - #283:reset line 29:
$su:ps - #283:turn line 20:
$su:ps - #283:turn line 30:
$su:ps - #305:on_reset line 8:
$su:ps - #335:do_use_start line 18:
$su:ps - #335:do_use_start line 24:
$su:ps - #335:do_use_start line 28:
$su:ps - #335:do_use_finish line 10:
$su:ps - #335:use_finish line 8:
$su:ps - #335:use_finish line 10:
$su:ps - #338:fill line 40:
$su:ps - #338:_start_drink line 15:
$su:ps - #338:dump line 8:
$su:ps - #338:do_wash line 28:
$su:ps - #342:copy line 6:
$su:ps - #342:_copy line 5:
$su:ps - #349:move line 14:
$su:ps - #350:doing_msg line 4:
$su:ps - #364:doing_msg line 7:
$su:ps - #364:doing_msg line 15:
$su:ps - #364:_abort line 4:
$su:ps - #367:view line 9:
$su:ps - #367:view line 15:
$su:ps - #367:view line 18:
$su:ps
Source
1"Pronoun (and other things) substitution. See 'help pronouns' for details."; 2"syntax: $string_utils:pronoun_sub(text[,who[,thing[,location[,dobj[,iobj]]]]])"; 3"%s,%o,%p,%q,%r => <who>'s pronouns. <who> defaults to player."; 4"%n,%d,%i,%t,%l,%% => <who>, dobj, iobj, <thing>, location and %"; 5"<thing> defaults to caller; <location> defaults to who.location"; 6"%S,%O,%P,%Q,%R, %N,%D,%I,%T,%L have corresponding capitalized substitutions."; 7" %[#n], %[#d], ... => <who>, dobj, etc.'s object number"; 8"%(foo) => <who>.foo and %(Foo) => <who>.foo capitalized. %[dfoo] => dobj.foo, etc.."; 9"%<foo> -> whatever <who> does when normal people foo. This is determined by calling :verb_sub() on the <who>."; 10"%<d:foo> -> whatever <dobj> does when normal people foo."; 11"In addition, you can have the direct or indirect article prepended to object substitutions, so that 'book' becomes 'a book' or 'the book':"; 12"%dn, %dd, %di, %dt, %dl => object:dname() ('the' object)"; 13"%in, %id, %ii, %it, %il => object:iname() ('a' object)"; 14"SOME WORDS OF WISDOM TO NEW PROGRAMMERS: Please pass arguments explicitly to this verb unless you know exactly what you are doing. Most of the time, the default trailing subs (%d and %i) are given as #-1 which is invalid and will cause tracebacks. Many irritating but minor errors can be avoided by paying attention to proper usage of $su:ps. If you do not understand anything here, please ask someone who does before wantonly putting $su:ps in your code."; 15{string, ?who = player, ?thing = caller, ?where = $nothing, ?dobject = dobj, ?iobject = iobj} = args; 16where = valid(where) ? where | (valid(who) ? who.location | where); 17if (!string) 18if (typeof(string) == LIST) 19raise(E_INVARG, "empty list given to $su:ps"); 20endif 21return ""; 22endif 23if (typeof(string) == LIST) 24string = string[random($)]; 25endif 26old = tostr(string); 27new = ""; 28objspec = "nditl"; 29objects = {who, dobject, iobject, thing, where}; 30prnspec = "sopqrSOPQR"; 31prprops = {"ps", "po", "pp", "pq", "pr", "Ps", "Po", "Pp", "Pq", "Pr"}; 32oldlen = length(old); 33while ((prcnt = index(old, "%")) && (prcnt < oldlen)) 34objects[1] = who; 35s = old[k = prcnt + 1]; 36if ((s == "<") && (gt = index(old[k + 2..$], ">"))) 37"handling %<verb> "; 38gt = (gt + k) + 1; 39vb = old[k + 1..gt - 1]; 40vbs = who; 41if ((length(vb) > 2) && (vb[2] == ":")) 42" %<d:verb>"; 43vbs = objects[index(objspec, vb[1]) || 1]; 44vb = vb[3..$]; 45endif 46vb = (valid(vbs) && has_callable_verb(vbs, "verb_sub")) ? vbs:verb_sub(vb) | this:(verb)(vb, vbs); 47new = (new + old[1..prcnt - 1]) + vb; 48k = gt; 49else 50include_direct = 0; 51include_indirect = 0; 52if (((old[k] == "d") && (k < oldlen)) && index(objspec, old[k + 1])) 53include_direct = 1; 54old = old[1..k - 1] + old[k + 1..oldlen]; 55oldlen = oldlen - 1; 56s = old[k]; 57elseif (((old[k] == "i") && (k < oldlen)) && index(objspec, old[k + 1])) 58include_indirect = 1; 59old = old[1..k - 1] + old[k + 1..oldlen]; 60oldlen = oldlen - 1; 61s = old[k]; 62endif 63if (((op = index(objspec, old[k])) && (k < oldlen)) && index(prnspec, old[k + 1])) 64objects[1] = objects[op]; 65old = old[1..k - 1] + old[k + 1..oldlen]; 66oldlen = oldlen - 1; 67s = old[k]; 68endif 69cp_args = {}; 70if (brace = index("([", s)) 71if (!(w = index(old[k + 1..oldlen], ")]"[brace]))) 72return new + old; 73else 74p = old[prcnt + 2..(k = k + w) - 1]; 75if (brace == 1) 76"%(property)"; 77cp_args = {who, p}; 78elseif (p[1] == "#") 79"%[#n] => object number"; 80s = (o = index(objspec, p[2])) ? tostr(objects[o]) | (("[" + p) + "]"); 81elseif (!(o = index(objspec, p[1]))) 82s = ("[" + p) + "]"; 83else 84" %[dproperty] "; 85cp_args = {objects[o], p[2..w - 1], strcmp(p[1], "a") < 0}; 86endif 87endif 88elseif (o = index(objspec, s)) 89if (include_direct) 90s = (strcmp(s, "a") < 0) ? objects[o]:dnamec() | objects[o]:dname(); 91elseif (include_indirect) 92s = (strcmp(s, "a") < 0) ? objects[o]:inamec() | objects[o]:iname(); 93else 94oname = objects[o]:name(); 95if (is_a(objects[o], $player)) 96s = oname; 97else 98s = (strcmp(s, "a") < 0) ? $su:capitalize(oname) | oname; 99endif 100endif 101elseif (w = index(prnspec, s, 1)) 102cp_args = {objects[1], prprops[w]}; 103elseif (s == "#") 104s = tostr(who); 105elseif (s != "%") 106s = "%" + s; 107endif 108if (!cp_args) 109new = (new + old[1..prcnt - 1]) + s; 110else 111if (typeof(sub = $string_utils:_cap_property(@cp_args)) != ERR) 112new = (new + old[1..prcnt - 1]) + sub; 113else 114new = (((new + old[1..prcnt - 1]) + "%(") + tostr(sub)) + ")"; 115endif 116endif 117endif 118old = old[k + 1..oldlen]; 119oldlen = oldlen - k; 120endwhile 121return new + old;
pronoun_sub_secure
Referenced by
- #84:@paste line 17:
$string_utils:pronoun_sub_secure - #84:@paste line 22:
$string_utils:pronoun_sub_secure
Source
1"$string_utils:pronoun_sub_secure(string[,who[,thing[,location]]], default)"; 2"Do pronoun_sub on string with the arguments given (see help"; 3"string_utils:pronoun_sub for more information). Return pronoun_subbed"; 4"<default> if the subbed string does not contain <who>.name (<who>"; 5"defaults to player)."; 6who = (length(args) > 2) ? args[2] | player; 7default = args[$]; 8result = this:pronoun_sub(@args[1..$ - 1]); 9return this:index_delimited(result, who.name) ? result | this:pronoun_sub(@{default, @args[2..$ - 1]});
pronoun_quote
Referenced by
- #89:msg_sub line 3:
$string_utils:pronoun_quote
Source
1" pronoun_quote(string) => quoted_string"; 2" pronoun_quote(list of strings) => list of quoted_strings"; 3" pronoun_quote(list of {key,string} pairs) => list of {key,quoted_string} pairs"; 4""; 5"Here `quoted' means quoted in the sense of $string_utils:pronoun_sub, i.e., given a string X, the corresponding `quoted' string Y is such that pronoun_sub(Y) => X. For example, pronoun_quote(\"--%Spam%--\") => \"--%%Spam%%--\". This is for including literal text into a string that will eventually be pronoun_sub'ed, i.e., including it in such a way that the pronoun_sub will not expand anything in the included text."; 6""; 7"The 3rd form above (with {key,string} pairs) is for use with $string_utils:substitute(). If you have your own set of substitutions to be done in parallel with the pronoun substitutions, do"; 8""; 9" msg=$string_utils:substitute(msg,$string_utils:pronoun_quote(your_substs));"; 10" msg=$string_utils:pronoun_sub(msg);"; 11if (typeof(what = args[1]) == STR) 12return strsub(what, "%", "%%"); 13else 14ret = {}; 15for w in (what) 16if (typeof(w) == LIST) 17ret = listappend(ret, listset(w, strsub(w[2], "%", "%%"), 2)); 18else 19ret = listappend(ret, strsub(w, "%", "%%")); 20endif 21endfor 22return ret; 23endif
alt_pronoun_sub
Referenced by
none
Source
1"Pronoun (and other things) substitution. See 'help pronouns' for details."; 2"syntax: $string_utils:pronoun_sub(text[,who[,thing[,location]]])"; 3"%s,%o,%p,%q,%r => <who>'s pronouns. <who> defaults to player."; 4"%n,%d,%i,%t,%l,%% => <who>, dobj, iobj, this, <who>.location and %"; 5"%S,%O,%P,%Q,%R, %N,%D,%I,%T,%L have corresponding capitalized substitutions."; 6" %[#n], %[#d], ... => <who>, dobj, etc.'s object number"; 7"%(foo) => <who>.foo and %(Foo) => <who>.foo capitalized. %[dfoo] => dobj.foo, etc.."; 8"%<foo> -> whatever <who> does when normal people foo. This is determined by calling :verb_sub() on the <who>."; 9"%<d:foo> -> whatever <dobj> does when normal people foo."; 10set_task_perms($no_one); 11{string, ?who = player, ?thing = caller, ?where = $nothing} = args; 12where = valid(who) ? who.location | where; 13if (typeof(string) == LIST) 14plines = {}; 15for line in (string) 16plines = {@plines, this:(verb)(line, who, thing, where)}; 17endfor 18return plines; 19endif 20old = tostr(string); 21new = ""; 22objspec = "nditl"; 23objects = {who, dobj, iobj, thing, where}; 24prnspec = "sopqrSOPQR"; 25prprops = {"ps", "po", "pp", "pq", "pr", "Ps", "Po", "Pp", "Pq", "Pr"}; 26oldlen = length(old); 27while ((prcnt = index(old, "%")) && (prcnt < oldlen)) 28s = old[k = prcnt + 1]; 29if ((s == "<") && (gt = index(old[k + 2..$], ">"))) 30"handling %<verb> "; 31gt = (gt + k) + 1; 32vb = old[k + 1..gt - 1]; 33vbs = who; 34if ((length(vb) > 2) && (vb[2] == ":")) 35" %<d:verb>"; 36vbs = objects[index(objspec, vb[1]) || 1]; 37vb = vb[3..$]; 38endif 39vb = $object_utils:has_verb(vbs, "verb_sub") ? vbs:verb_sub(vb) | this:(verb)(vb, vbs); 40new = (new + old[1..prcnt - 1]) + vb; 41k = gt; 42else 43cp_args = {}; 44if (brace = index("([", s)) 45if (!(w = index(old[k + 1..oldlen], ")]"[brace]))) 46return new + old; 47else 48p = old[prcnt + 2..(k = k + w) - 1]; 49if (brace == 1) 50"%(property)"; 51cp_args = {who, p}; 52elseif (p[1] == "#") 53"%[#n] => object number"; 54s = (o = index(objspec, p[2])) ? tostr(objects[o]) | (("[" + p) + "]"); 55elseif (!(o = index(objspec, p[1]))) 56s = ("[" + p) + "]"; 57else 58" %[dproperty] "; 59cp_args = {objects[o], p[2..w - 1], strcmp(p[1], "a") < 0}; 60endif 61endif 62elseif (o = index(objspec, s)) 63cp_args = {objects[o], "", strcmp(s, "a") < 0}; 64elseif (w = index(prnspec, s, 1)) 65cp_args = {who, prprops[w]}; 66elseif (s == "#") 67s = tostr(who); 68elseif (s != "%") 69s = "%" + s; 70endif 71new = (new + old[1..prcnt - 1]) + ((!cp_args) ? s | ((typeof(sub = $string_utils:_cap_property(@cp_args)) != ERR) ? sub | (("%(" + tostr(sub)) + ")"))); 72endif 73old = old[k + 1..oldlen]; 74oldlen = oldlen - k; 75endwhile 76return new + old;
explode
Referenced by
- #2:@digg line 49:
$string_utils:explode - #2:@addalias*# line 48:
$string_utils:explode - #2:@addalias*# line 50:
$string_utils:explode - #2:@addalias*# line 82:
$string_utils:explode - #2:@rmalias*# line 34:
$string_utils:explode - #2:@rmalias*# line 36:
$string_utils:explode - #2:@rmalias*# line 72:
$string_utils:explode - #4:? line 8:
$string_utils:explode - #6:hostname line 1:
$su:explode - #17:check_player_request line 48:
$string_utils:explode - #20:random_word line 12:
$su:explode - #20:colorize line 16:
$su:explode - #20:highlight_words line 8:
$su:explode - #20:silence_words line 3:
this:explode - #21:parse_names line 5:
$string_utils:explode - #21:parse_names line 8:
$string_utils:explode - #24:index line 6:
su:explode - #27:from_string line 5:
su:explode - #33:@quick*send line 15:
$string_utils:explode - #35:day line 14:
$string_utils:explode - #35:month line 14:
$string_utils:explode - #35:ampm line 11:
$string_utils:explode - #35:from_ctime line 2:
$string_utils:explode - #35:from_ctime line 7:
$string_utils:explode - #35:time_sub line 79:
$string_utils:explode - #35:time_sub line 81:
$string_utils:explode - #35:mmddyy line 10:
$string_utils:explode - #35:abbrev_ctime line 4:
$su:explode - #35:abbrev_ctime line 5:
$su:explode - #35:longdate line 7:
$su:explode - #35:daytime_to_secs line 3:
$su:explode - #35:day_number line 14:
$string_utils:explode - #35:parts line 7:
$string_utils:explode - #38:parse_message_seq line 38:
$string_utils:explode - #38:_parse_from line 15:
$string_utils:explode - #38:_parse_date line 1:
$string_utils:explode - #39:check_answer_flags line 32:
$string_utils:explode - #39:subsc*ribe line 9:
$string_utils:explode - #39:unsubsc*ribe line 7:
$string_utils:explode - #41:next line 9:
$su:explode - #43:s*ubst line 7:
$string_utils:explode - #45:verb_name line 2:
$su:explode - #50:@verb line 22:
$string_utils:explode - #50:@dump line 24:
$string_utils:explode - #50:@exam*ine line 73:
$string_utils:explode - #51:_fix_preps line 8:
$string_utils:explode - #59:parse_replyto line 3:
$string_utils:explode - #59:parse_expire line 3:
$string_utils:explode - #70:parse_verb_args line 3:
$string_utils:explode - #87:_do_value line 4:
$string_utils:explode - #90:get line 9:
$string_utils:explode - #90:post line 8:
$string_utils:explode - #90:post line 12:
$string_utils:explode - #90:get_remote line 9:
$string_utils:explode - #90:proxy line 22:
$string_utils:explode - #95:@setup line 27:
$su:explode - #103:do_setup line 6:
$su:explode - #106:com*mand line 7:
$su:explode - #106:_compile line 6:
$su:explode - #106:_compile line 11:
$su:explode - #107:do_command line 15:
$su:explode - #107:@qp line 8:
$su:explode - #111:@setup line 28:
$su:explode - #113:@megasub*stitute line 1:
$su:explode - #114:@weather-compile line 4:
$su:explode - #122:remove_tag line 19:
$su:explode - #142:_compile line 7:
$su:explode - #142:_compile line 8:
$su:explode - #142:_compile line 15:
$su:explode - #204:validate line 7:
$su:explode - #293:_parse_to line 16:
$string_utils:explode - #293:_pms line 40:
$string_utils:explode - #293:parse_message_seq line 47:
$string_utils:explode - #293:pms_old line 47:
$string_utils:explode - #297:report_from_issuelists line 16:
$su:explode - #297:report_from_issuelists line 17:
$su:explode - #307:forge_name line 8:
$su:explode - #307:forge_name line 29:
$su:explode - #317:@addex line 48:
$su:explode - #324:do_login_command line 1:
$string_utils:explode - #324:do_get line 1:
$string_utils:explode - #324:authorise line 8:
$string_utils:explode - #324:GetVariable line 2:
$string_utils:explode - #324:GetVariable line 4:
$string_utils:explode - #334:dig line 37:
$su:explode - #334:dig line 42:
$su:explode - #334:dig line 43:
$su:explode - #334:desc*ribe line 13:
$su:explode - #334:mess*ages line 39:
$su:explode
Source
1"$string_utils:explode(subject [, break])"; 2"Return a list of those substrings of subject separated by runs of break[1]."; 3"break defaults to space."; 4{subject, ?breakit = {" "}} = args; 5breakit = breakit[1]; 6subject = subject + breakit; 7parts = {}; 8while (subject) 9if ((i = index(subject, breakit)) > 1) 10parts = {@parts, subject[1..i - 1]}; 11endif 12subject = subject[i + 1..$]; 13endwhile 14return parts;
words
Referenced by
- #1:examine_verbs line 14:
$su:words - #2:@audit line 9:
$string_utils:words - #2:@newmess*age line 7:
$string_utils:words - #2:@unmess*age line 4:
$string_utils:words - #6:revert_code_name line 7:
$su:words - #6:set_code_name line 7:
$su:words - #20:parse_command line 9:
$string_utils:words - #32:load line 26:
$su:words - #35:parse_english_time_interval line 12:
$string_utils:words - #41:parse_invoke line 5:
$string_utils:words - #49:parse_templist_duration line 3:
$string_utils:words - #50:@prop*erty line 30:
$string_utils:words - #50:@pros*pectus line 7:
$string_utils:words - #51:argstr line 23:
$string_utils:words - #98:jerk_name line 4:
$su:words - #98:superjerk line 7:
$su:words - #98:superjerkname line 10:
$su:words - #106:hear_say_to line 4:
$su:words - #107:abbreviated_name line 4:
$su:words - #118:_old_render line 19:
$su:words - #118:_render_BACKUP_OLD line 16:
$su:words - #120:hilite_topic line 14:
$su:words - #120:hilite_topic line 16:
$su:words - #142:_spawn_name line 12:
$su:words - #189:abbreviated_name line 3:
$su:words - #279:fix_out_exit line 24:
$su:words - #310:pose_ex line 22:
$string_utils:words - #310:pose_ex line 44:
$string_utils:words - #310:parse_pose_args line 2:
$string_utils:words
Source
1"This breaks up the argument string into words, the resulting list being obtained exactly the way the command line parser obtains `args' from `argstr'."; 2rest = args[1]; 3"...trim leading blanks..."; 4if (0) 5rest[1..match(rest, "^ *")[2]] = ""; 6endif 7rest = $string_utils:triml(rest); 8if (!rest) 9return {}; 10endif 11quote = 0; 12toklist = {}; 13token = ""; 14pattern = " +%|\\.?%|\""; 15while (m = match(rest, pattern)) 16"... find the next occurence of a special character, either"; 17"... a block of spaces, a quote or a backslash escape sequence..."; 18char = rest[m[1]]; 19token = token + rest[1..m[1] - 1]; 20if (char == " ") 21toklist = {@toklist, token}; 22token = ""; 23elseif (char == "\"") 24"... beginning or end of quoted string..."; 25"... within a quoted string spaces aren't special..."; 26pattern = (quote = !quote) ? "\\.?%|\"" | " +%|\\.?%|\""; 27elseif (m[1] < m[2]) 28"... char has to be a backslash..."; 29"... include next char literally if there is one"; 30token = token + rest[m[2]]; 31endif 32rest[1..m[2]] = ""; 33endwhile 34return (rest || (char != " ")) ? {@toklist, token + rest} | toklist;
word_start
Referenced by
- #2:@set*prop line 19:
$string_utils:word_start - #33:@quick*send line 26:
$string_utils:word_start - #50:@prop*erty line 24:
$string_utils:word_start - #50:@gethelp line 12:
$string_utils:word_start - #51:argstr line 26:
$string_utils:word_start - #51:argstr line 30:
$string_utils:word_start
Source
1"This breaks up the argument string into words, returning a list of indices into argstr corresponding to the starting points of each of the arguments."; 2rest = args[1]; 3"... find first nonspace..."; 4wstart = match(rest, "[^ ]%|$")[1]; 5wbefore = wstart - 1; 6rest[1..wbefore] = ""; 7if (!rest) 8return {}; 9endif 10quote = 0; 11wslist = {}; 12pattern = " +%|\\.?%|\""; 13while (m = match(rest, pattern)) 14"... find the next occurence of a special character, either"; 15"... a block of spaces, a quote or a backslash escape sequence..."; 16char = rest[m[1]]; 17if (char == " ") 18wslist = {@wslist, {wstart, (wbefore + m[1]) - 1}}; 19wstart = (wbefore + m[2]) + 1; 20elseif (char == "\"") 21"... beginning or end of quoted string..."; 22"... within a quoted string spaces aren't special..."; 23pattern = (quote = !quote) ? "\\.?%|\"" | " +%|\\.?%|\""; 24endif 25rest[1..m[2]] = ""; 26wbefore = wbefore + m[2]; 27endwhile 28return (rest || (char != " ")) ? {@wslist, {wstart, wbefore + length(rest)}} | wslist;
to_value
Referenced by
- #2:@set*prop line 33:
$string_utils:to_value - #317:@addex line 59:
$su:to_value
Source
1":to_value(string) tries to parse string as a value (i.e., object, number, string, error, or list thereof)."; 2"Returns {1,value} or {0,error_message} according as the attempt was successful or not."; 3if (length(string = args[1]) > 1) 4result = this:_tohash(string[2..$]); 5if (typeof(result[2]) == HASH) 6return {1, result[2]}; 7endif 8endif 9result = this:_tolist(string + "}"); 10if (result[1] && (result[1] != $string_utils:space(result[1]))) 11return {0, tostr("after char ", length(string) - result[1], ": ", result[2])}; 12elseif (typeof(result[1]) == INT) 13return {0, "missing } or \""}; 14elseif (length(result[2]) > 1) 15return {0, "comma unexpected."}; 16elseif (result[2]) 17return {1, result[2][1]}; 18else 19return {0, "missing expression"}; 20endif
prefix_to_value
Referenced by
- #50:@prop*erty line 24:
$string_utils:prefix_to_value
Source
1":prefix_to_value(string) tries to parse string as a value (i.e., object, number, string, error, or list thereof)."; 2"Returns {rest-of-string,value} or {0,error_message} according as the attempt was successful or not."; 3alen = length(args[1]); 4slen = length(string = this:triml(args[1])); 5if (!string) 6return {0, "empty string"}; 7elseif (w = index("{[\"", string[1])) 8result = this:({"_tolist", "_tohash", "_unquote"}[w])(string[2..slen]); 9if (typeof(result[1]) != INT) 10return result; 11elseif (result[1] == 0) 12return {0, "missing } or \""}; 13else 14return {0, result[2], (alen - result[1]) + 1}; 15endif 16else 17thing = string[1..tlen = index(string + " ", " ") - 1]; 18if (typeof(s = this:_toscalar(thing)) != STR) 19return {string[tlen + 1..slen], s}; 20else 21return {0, s, (alen - slen) + 1}; 22endif 23endif
_tolist
Referenced by
- #20:to_value line 9:
this:_tolist
Source
1"_tolist(string) --- auxiliary for :to_value()"; 2rest = this:triml(args[1]); 3vlist = {}; 4if (!rest) 5return {0, {}}; 6elseif (rest[1] == "}") 7return {rest[2..$], {}}; 8endif 9while (1) 10rlen = length(rest); 11if (w = index("{[\"", rest[1])) 12result = this:({"_tolist", "_tohash", "_unquote"}[w])(rest[2..rlen]); 13if (typeof(result[1]) == INT) 14return result; 15endif 16vlist = {@vlist, result[2]}; 17rest = result[1]; 18else 19thing = rest[1..tlen = min(index(rest + ",", ","), index(rest + "}", "}")) - 1]; 20if (typeof(s = this:_toscalar(thing)) == STR) 21return {rlen, s}; 22endif 23vlist = {@vlist, s}; 24rest = rest[tlen + 1..rlen]; 25endif 26if (!rest) 27return {0, vlist}; 28elseif (rest[1] == "}") 29return {rest[2..$], vlist}; 30elseif (rest[1] == ",") 31rest = this:triml(rest[2..$]); 32else 33return {length(rest), ", or } expected"}; 34endif 35endwhile
_unquote
Referenced by
- #20:_tohash line 13:
this:_unquote
Source
1"_unquote(string) (auxiliary for :to_value())"; 2"reads string as if it were preceded by a quote, reading up to the closing quote if any, then returns the corresponding unquoted string."; 3" => {0, string unquoted} if there is no closing quote"; 4" => {original string beyond closing quote, string unquoted} otherwise"; 5rest = args[1]; 6result = ""; 7while (m = match(rest, "\\.?%|\"")) 8"Find the next special character"; 9if (rest[pos = m[1]] == "\"") 10return {rest[pos + 1..$], result + rest[1..pos - 1]}; 11endif 12result = (result + rest[1..pos - 1]) + rest[pos + 1..m[2]]; 13rest = rest[m[2] + 1..$]; 14endwhile 15return {0, result + rest};
_toscalar
Referenced by
- #20:prefix_to_value line 18:
this:_toscalar - #20:_tolist line 20:
this:_toscalar - #20:_tohash line 35:
this:_toscalar - #20:_tohash line 53:
this:_toscalar
Source
1":_toscalar(string) --- auxiliary for :tovalue"; 2" => value if string represents a number, object or error"; 3" => string error message otherwise"; 4thing = args[1]; 5if (!thing) 6return "missing value"; 7elseif (match(thing, "^#?[-+]?[0-9]+ *$")) 8return (thing[1] == "#") ? toobj(thing) | toint(thing); 9elseif (match(thing, "^[-+]?%([0-9]+%.[0-9]*%|[0-9]*%.[0-9]+%)%(e[-+]?[0-9]+%)? *$")) 10"matches 2. .2 3.2 3.2e3 .2e-3 3.e3"; 11return `tofloat(thing) ! E_INVARG => tostr("Bad floating point value: ", thing)'; 12elseif (match(thing, "^[-+]?[0-9]+e[-+]?[0-9]+ *$")) 13"matches 345e4. No decimal, but has an e so still a float"; 14return `tofloat(thing) ! E_INVARG => tostr("Bad floating point value: ", thing)'; 15elseif (thing[1] == "E") 16return (e = $code_utils:toerr(thing)) ? tostr("unknown error code `", thing, "'") | e; 17elseif (thing[1] == "#") 18return tostr("bogus objectid `", thing, "'"); 19else 20return tostr("`", thing[1], "' unexpected"); 21endif
parse_command
Referenced by
none
Source
1":parse_command(cmd_line[,player])"; 2" => {verb, {dobj, dobjstr}, {prep, prepstr}, {iobj, iobjstr}, {args, argstr},"; 3" {dobjset, prepset, iobjset}}"; 4"This mimics the action of the builtin parser, returning what the values of the builtin variables `verb', `dobj', `dobjstr', `prepstr', `iobj', `iobjstr', `args', and `argstr' would be if `player' had typed `cmd_line'. "; 5"`prep' is the shortened version of the preposition found."; 6""; 7"`dobjset' and `iobjset' are subsets of {\"any\",\"none\"} and are used to determine possible matching verbs, i.e., the matching verb must either be on `dobj' and have verb_args[1]==\"this\" or else it has verb_args[1] in `dobjset'; likewise for `iobjset' and verb_args[3]; similarly we must have verb_args[2] in `prepset'."; 8{c, ?who = player} = args; 9y = $string_utils:words(c); 10if (y == {}) 11return {}; 12endif 13vrb = y[1]; 14y = y[2..$]; 15as = (y == {}) ? "" | c[length(vrb) + 2..$]; 16n = 1; 17while ((!(gp = $code_utils:get_prep(@y[n..$]))[1]) && (n < length(y))) 18n = n + 1; 19endwhile 20"...."; 21really = player; 22player = who; 23loc = who.location; 24if (ps = gp[1]) 25ds = $string_utils:from_list(y[1..n - 1], " "); 26is = $string_utils:from_list(listdelete(gp, 1), " "); 27io = valid(loc) ? loc:match_object(is) | $string_utils:match_object(is, loc); 28else 29ds = $string_utils:from_list(y, " "); 30is = ""; 31io = $nothing; 32endif 33do = valid(loc) ? loc:match_object(ds) | $string_utils:match_object(ds, loc); 34player = really; 35"...."; 36dset = {"any", @(ds == "") ? {"none"} | {}}; 37"\"this\" must be handled manually."; 38pset = {"any", @ps ? {$code_utils:full_prep(ps)} | {"none"}}; 39iset = {"any", @(is == "") ? {"none"} | {}}; 40return {vrb, {do, ds}, {$code_utils:short_prep(ps), ps}, {io, is}, {y, as}, {dset, pset, iset}};
from_value
Referenced by
- #2:@addalias*# line 97:
$string_utils:from_value - #2:@addalias*# line 113:
$string_utils:from_value - #2:@rmalias*# line 87:
$string_utils:from_value - #2:@rmalias*# line 94:
$string_utils:from_value - #2:@prop*erties line 17:
$string_utils:from_value - #3:broadcast_event line 13:
$su:from_value - #6:@rename*# line 70:
$string_utils:from_value - #20:from_value line 7:
this:from_value - #20:from_value line 9:
this:from_value - #20:from_value_suspended line 9:
this:from_value - #20:from_value_suspended line 12:
this:from_value - #21:make_exit line 23:
$string_utils:from_value - #50:@prop*erties line 21:
$string_utils:from_value - #95:@setup line 28:
$su:from_value - #103:log_callers line 11:
$su:from_value - #107:_learn line 24:
$su:from_value - #107:_learn line 24:
$su:from_value - #107:_learn line 24:
$su:from_value - #107:_learn line 27:
$su:from_value - #107:_learn line 27:
$su:from_value - #111:@setup line 29:
$su:from_value - #155:change_plan line 7:
$su:from_value - #296:_do line 19:
$su:from_value - #296:_do line 27:
$su:from_value - #317:tostr_for_ex line 10:
$su:from_value - #317:tostr_for_ex line 13:
$su:from_value - #317:_www line 10:
$su:from_value - #317:_www line 16:
$su:from_value - #317:@compare line 88:
$su:from_value - #317:@compare line 152:
$su:from_value
Source
1"$string_utils:from_value(value [, quote_strings = 0 [, list_depth = 1]])"; 2"Print the given value into a string."; 3{value, ?quote_strings = 0, ?list_depth = 1} = args; 4if (typeof(value) == LIST) 5if (value) 6if (list_depth) 7result = "{" + this:from_value(value[1], quote_strings, list_depth - 1); 8for v in (listdelete(value, 1)) 9result = tostr(result, ", ", this:from_value(v, quote_strings, list_depth - 1)); 10endfor 11return result + "}"; 12else 13return "{...}"; 14endif 15else 16return "{}"; 17endif 18elseif (quote_strings) 19if (typeof(value) == STR) 20result = "\""; 21while (q = index(value, "\"") || index(value, "\\")) 22if (value[q] == "\"") 23q = min(q, index(value + "\\", "\\")); 24endif 25result = ((result + value[1..q - 1]) + "\\") + value[q]; 26value = value[q + 1..$]; 27endwhile 28return (result + value) + "\""; 29elseif (typeof(value) == ERR) 30return $code_utils:error_name(value); 31else 32return tostr(value); 33endif 34else 35return tostr(value); 36endif
print print_suspended
Referenced by
- #2:@set*prop line 48:
$string_utils:print - #13:dump_topic line 11:
$string_utils:print - #20:print line 7:
this:print - #20:print line 9:
this:print - #50:@proped*it line 6:
$string_utils:print - #50:@messages_old line 35:
$string_utils:print - #50:@receive-dump line 3:
$su:print - #50:@receive-dump line 14:
$su:print - #50:@receive-dump line 18:
$su:print - #51:show_property line 17:
$string_utils:print - #51:set_verb_documentation line 19:
$string_utils:print - #76:help_msg line 10:
$string_utils:print - #92:process_queue line 34:
$su:print - #155:process_queue line 23:
$su:print - #334:mess*ages line 30:
$string_utils:print
Source
1"$string_utils:print(value)"; 2"Print the given value into a string. == from_value(value,1,-1)"; 3return toliteral(args[1]); 4value = args[1]; 5if (typeof(value) == LIST) 6if (value) 7result = "{" + this:print(value[1]); 8for val in (listdelete(value, 1)) 9result = tostr(result, ", ", this:print(val)); 10endfor 11return result + "}"; 12else 13return "{}"; 14endif 15elseif (typeof(value) == STR) 16return tostr("\"", strsub(strsub(value, "\\", "\\\\"), "\"", "\\\""), $ansi.reset, "\""); 17elseif (typeof(value) == ERR) 18return $code_utils:error_name(value); 19else 20return tostr(value); 21endif
reverse
Referenced by
- #20:reverse line 5:
this:reverse - #20:reverse line 5:
this:reverse - #81:check_name line 4:
$string_utils:reverse
Source
1":reverse(string) => \"gnirts\""; 2"An example: :reverse(\"This is a test.\") => \".tset a si sihT\""; 3string = args[1]; 4if ((len = length(string)) > 50) 5return this:reverse(string[($ / 2) + 1..$]) + this:reverse(string[1..$ / 2]); 6endif 7index = len; 8result = ""; 9while (index > 0) 10result = result + string[index]; 11index = index - 1; 12endwhile 13return result;
char_list
Referenced by
- #2:@create line 46:
$su:char_list - #2:@recreate line 36:
$string_utils:char_list - #2:@digg line 27:
$string_utils:char_list - #17:set_property_flags line 7:
$string_utils:char_list - #20:char_list line 4:
this:char_list - #20:char_list line 4:
this:char_list - #20:widen line 3:
this:char_list - #21:make_exit line 14:
$string_utils:char_list - #103:get_html_icon line 3:
$su:char_list
Source
1":char_list(string) => string as a list of characters."; 2" e.g., :char_list(\"abad\") => {\"a\",\"b\",\"a\",\"d\"}"; 3if (30 < (len = length(string = args[1]))) 4return {@this:char_list(string[1..$ / 2]), @this:char_list(string[($ / 2) + 1..$])}; 5else 6l = {}; 7for c in [1..len] 8l = {@l, string[c]}; 9endfor 10return l; 11endif
regexp_quote
Referenced by
- #20:index_d*elimited line 2:
$string_utils:regexp_quote
Source
1":regexp_quote(string)"; 2" => string with all of the regular expression special characters quoted with %"; 3string = args[1]; 4quoted = ""; 5while (m = rmatch(string, "[][$^.*+?%].*")) 6quoted = ("%" + string[m[1]..m[2]]) + quoted; 7string = string[1..m[1] - 1]; 8endwhile 9return string + quoted;
connection_hostname_bsd
Referenced by
- #20:connection_hostname line 2:
this:connection_hostname_bsd
Source
1"Takes the output from connection_name() and returns just the host string portion of it. Assumes you are using bsd_network style connection names."; 2s = args[1]; 3return (m = `match(args[1], "^.* %(from%|to%) %([^, ]+%)") ! ANY') ? substitute("%2", m) | "";
connection_hostname
Referenced by
- #0:do_login_command line 10:
$string_utils:connection_hostname - #4:co*nnect line 24:
$string_utils:connection_hostname - #4:co*nnect line 35:
$string_utils:connection_hostname - #4:player_creation_enabled line 4:
$string_utils:connection_hostname - #4:record_connection line 8:
$string_utils:connection_hostname - #4:record_connection line 11:
$string_utils:connection_hostname - #4:request_character line 7:
$string_utils:connection_hostname - #4:request_password line 8:
$string_utils:connection_hostname - #4:reset_password line 12:
$string_utils:connection_hostname - #6:@registerme line 11:
$string_utils:connection_hostname - #17:show_netwho_listing line 35:
$string_utils:connection_hostname - #25:defer line 5:
$string_utils:connection_hostname - #25:connection_name_hash line 4:
$string_utils:connection_hostname - #49:@toad line 43:
$string_utils:connection_hostname - #49:@guests line 29:
$string_utils:connection_hostname - #90:get_connection_hostname line 7:
$string_utils:connection_hostname
Source
1"This is the function that should actually be called to get the host name from a connection name. The archwizard should change _bsd so as to be calling the verb appropriate for his/her network interface."; 2return this:connection_hostname_bsd(@args);
from_value_suspended
Referenced by
none
Source
1"$string_utils:from_value(value [, quote_strings = 0 [, list_depth = 1]])"; 2"Print the given value into a string."; 3"This verb suspends as necessary for large values."; 4set_task_perms(caller_perms()); 5{value, ?quote_strings = 0, ?list_depth = 1} = args; 6if (typeof(value) == LIST) 7if (value) 8if (list_depth) 9result = "{" + this:from_value(value[1], quote_strings, list_depth - 1); 10for v in (listdelete(value, 1)) 11$command_utils:suspend_if_needed(0); 12result = tostr(result, ", ", this:from_value(v, quote_strings, list_depth - 1)); 13endfor 14return result + "}"; 15else 16return "{...}"; 17endif 18else 19return "{}"; 20endif 21elseif (quote_strings) 22if (typeof(value) == STR) 23result = "\""; 24while (q = index(value, "\"") || index(value, "\\")) 25$command_utils:suspend_if_needed(0); 26if (value[q] == "\"") 27q = min(q, index(value + "\\", "\\")); 28endif 29result = ((result + value[1..q - 1]) + "\\") + value[q]; 30value = value[q + 1..$]; 31endwhile 32return (result + value) + "\""; 33elseif (typeof(value) == ERR) 34return $code_utils:error_name(value); 35else 36return tostr(value); 37endif 38else 39return tostr(value); 40endif
end_expression
Referenced by
none
Source
1":end_expression(string[,stop_at])"; 2" assumes string starts with an expression; returns the index of the last char in expression or 0 if string appears not to be an expression. Expression ends at any character from stop_at which occurs at top level."; 3{string, ?stop_at = " "} = args; 4gone = 0; 5paren_stack = ""; 6inquote = 0; 7search = top_level_search = ("[][{}()\"" + strsub(stop_at, "]", "")) + "]"; 8paren_search = "[][{}()\"]"; 9while (m = match(string, search)) 10char = string[m[1]]; 11string[1..m[2]] = ""; 12gone = gone + m[2]; 13if (char == "\"") 14"...skip over quoted string..."; 15char = "\\"; 16while (char == "\\") 17if (!(m = match(string, "%(\\.?%|\"%)"))) 18return 0; 19endif 20char = string[m[1]]; 21string[1..m[2]] = ""; 22gone = gone + m[2]; 23endwhile 24elseif (index("([{", char)) 25"... push parenthesis..."; 26paren_stack[1..0] = char; 27search = paren_search; 28elseif (i = index(")]}", char)) 29if (paren_stack && ("([{"[i] == paren_stack[1])) 30"... pop parenthesis..."; 31paren_stack[1..1] = ""; 32search = paren_stack ? paren_search | top_level_search; 33else 34"...parenthesis mismatch..."; 35return 0; 36endif 37else 38"... stop character ..."; 39return gone - 1; 40endif 41endwhile 42return (!paren_stack) && (gone + length(string));
first_word
Referenced by
- #49:@toad line 3:
$string_utils:first_word - #49:@toad line 10:
$string_utils:first_word - #49:@newt line 6:
$string_utils:first_word - #49:@unnewt line 5:
$string_utils:first_word - #49:@blacklist line 14:
$string_utils:first_word - #49:@deprog*rammer line 12:
$string_utils:first_word - #49:parse_templist_duration line 2:
$string_utils:first_word - #87:_do_convert line 12:
$string_utils:first_word
Source
1":first_word(string) => {first word, rest of string} or {}"; 2rest = args[1]; 3"...trim leading blanks..."; 4rest[1..match(rest, "^ *")[2]] = ""; 5if (!rest) 6return {}; 7endif 8quote = 0; 9token = ""; 10pattern = " +%|\\.?%|\""; 11while (m = match(rest, pattern)) 12"... find the next occurence of a special character, either"; 13"... a block of spaces, a quote or a backslash escape sequence..."; 14char = rest[m[1]]; 15token = token + rest[1..m[1] - 1]; 16if (char == " ") 17rest[1..m[2]] = ""; 18return {token, rest}; 19elseif (char == "\"") 20"... beginning or end of quoted string..."; 21"... within a quoted string spaces aren't special..."; 22pattern = (quote = !quote) ? "\\.?%|\"" | " +%|\\.?%|\""; 23elseif (m[1] < m[2]) 24"... char has to be a backslash..."; 25"... include next char literally if there is one"; 26token = token + rest[m[2]]; 27endif 28rest[1..m[2]] = ""; 29endwhile 30return {token + rest, ""};
common
Referenced by
- #30:insert line 33:
$string_utils:common - #30:insert line 58:
$string_utils:common
Source
1":common(first,second) => length of longest common prefix"; 2{first, second} = args; 3r = min(length(first), length(second)); 4l = 1; 5while (r >= l) 6h = (r + l) / 2; 7if (first[l..h] == second[l..h]) 8l = h + 1; 9else 10r = h - 1; 11endif 12endwhile 13return r;
title_list*c list_title*c
Referenced by
none
Source
1"wr_utils:title_list/title_listc(<obj-list>[, @<args>)"; 2"Creates an english list out of the titles of the objects in <obj-list>. Optional <args> are passed on to $string_utils:english_list."; 3"title_listc uses :titlec() for the first item."; 4titles = $list_utils:map_verb(args[1], "title"); 5if (verb[length(verb)] == "c") 6if (titles) 7titles[1] = args[1][1]:titlec(); 8elseif (length(args) > 1) 9args[2] = $string_utils:capitalize(args[2]); 10else 11args = listappend(args, "Nothing"); 12endif 13endif 14return $string_utils:english_list(titles, @args[2..$]);
name_and_number nn name_and_number_list nn_list
Referenced by
- #0:user_disconnected line 28:
$su:nn - #0:user_disconnected line 28:
$su:nn - #0:user_disconnected line 28:
$su:nn - #1:notify line 4:
$su:nn - #1:tell_lines line 4:
$su:nn - #1:announce*_all_but line 2:
$su:nn - #1:announce*_all_but line 5:
$su:nn - #1:_www line 1:
$su:nn - #1:_www line 5:
$su:nn - #1:tell line 2:
$su:nn - #1:tell line 5:
$su:nn - #2:@recycle line 10:
$su:nn - #2:@recycle line 11:
$su:nn - #2:@recycle line 15:
$su:nn - #2:@recycle line 15:
$su:nn - #2:@recycle line 16:
$su:nn - #2:@recycle line 21:
$su:nn - #2:@digg line 24:
$string_utils:nn - #2:@measure line 17:
$string_utils:nn - #2:@measure line 52:
$string_utils:nn - #2:@measure line 82:
$string_utils:nn - #2:@tree line 18:
$su:nn - #2:@dig line 10:
$su:nn - #2:@dig line 14:
$su:nn - #2:@dig line 20:
$su:nn - #2:@dig line 20:
$su:nn - #2:@dig line 33:
$su:nn - #2:@dig line 39:
$su:nn - #2:@dig line 44:
$su:nn - #2:@make-cliff line 6:
$su:nn - #2:@make-cliff line 10:
$su:nn - #2:@make-door line 7:
$su:nn - #2:@addalias*# line 97:
$string_utils:nn - #2:@addalias*# line 113:
$string_utils:nn - #2:@rmalias*# line 94:
$string_utils:nn - #2:@Make-stairs line 29:
$su:nn - #2:@spawn line 25:
$su:nn - #2:@spawn line 29:
$su:nn - #2:@spawn line 33:
$su:nn - #2:@spawn line 33:
$su:nn - #2:@spawn line 38:
$su:nn - #2:@spawn line 38:
$su:nn - #2:@spawn line 42:
$su:nn - #2:@spawn line 42:
$su:nn - #2:@spawn line 47:
$su:nn - #2:@spawn line 47:
$su:nn - #2:@spawn line 53:
$su:nn - #2:@spawn line 55:
$su:nn - #2:@spawn line 55:
$su:nn - #2:@setstat line 19:
$su:nn - #2:@setstat line 23:
$su:nn - #2:@move line 23:
$su:nn - #2:@move line 23:
$su:nn - #2:@move line 23:
$su:nn - #2:@move line 27:
$su:nn - #2:@move line 27:
$su:nn - #2:@move line 27:
$su:nn - #2:@make-hole line 7:
$su:nn - #2:@make-doorway line 6:
$su:nn - #2:@make-swingdoors line 6:
$su:nn - #3:recycle line 8:
$su:nn - #3:recycle line 11:
$su:nn - #3:recalc_next_hops line 4:
$su:nn - #3:recalc_next_hops line 4:
$su:nn - #3:recalc_next_hops line 7:
$su:nn - #3:recalc_next_hops line 7:
$su:nn - #3:recalc_next_hops line 10:
$su:nn - #3:recalc_next_hops line 10:
$su:nn - #3:broadcast_noise line 16:
$su:nn - #3:broadcast_noise line 19:
$su:nn - #3:set_xyz_rec line 15:
$su:nn - #3:set_xyz_rec line 18:
$su:nn - #3:set_xyz_rec line 41:
$su:nn - #3:set_xyz_rec line 41:
$su:nn - #3:debug_tell line 3:
$su:nn - #3:make_noise line 9:
$su:nn - #3:make_noise line 9:
$su:nn - #3:make_noise line 9:
$su:nn - #3:make_noise line 34:
$su:nn - #6:@mess*ages line 20:
$su:nn - #6:@registerme line 45:
$string_utils:nn - #6:@registerme line 51:
$string_utils:nn - #6:@registerme line 63:
$string_utils:nn - #6:take_damage line 4:
$su:nn - #6:moveto line 5:
$su:nn - #6:moveto line 5:
$su:nn - #6:job*s line 6:
$su:nn - #6:@register-alt line 35:
$su:nn - #10:enterfunc line 1:
$su:nn - #17:verify_owned_objects line 9:
$string_utils:nn - #17:verify_owned_objects line 9:
$string_utils:nn - #17:do_new_password line 9:
$string_utils:nn - #17:recursive_recycle line 13:
$su:nn - #17:recursive_chown line 9:
$su:nn - #17:move_prop_up line 16:
$su:nn - #17:reset_password line 10:
$string_utils:nn - #21:make_exit line 11:
$string_utils:nn - #21:object_audit_string line 46:
$su:nn - #33:@forward line 18:
$su:nn - #33:expire_old_messages line 11:
$string_utils:nn - #33:@quick*send line 20:
$su:nn - #33:@add-notify line 15:
$string_utils:nn - #33:@add-notify line 16:
$string_utils:nn - #33:@random line 19:
$su:nn - #37:convert_to_issue_list line 8:
$su:nn - #38:display_message_improved line 44:
$su:nn - #40:set_note_text line 16:
$su:nn - #40:set_note_text line 28:
$su:nn - #43:y*ank line 30:
$string_utils:nn - #43:y*ank line 65:
$string_utils:nn - #43:y*ank line 76:
$string_utils:nn - #43:do_flush line 9:
$string_utils:nn - #49:@chown*# line 60:
$su:nn - #49:@chown*# line 60:
$su:nn - #49:@chown*# line 60:
$su:nn - #49:@corify line 28:
$string_utils:nn - #49:reaper line 6:
$su:nn - #49:@recycle-recursive line 13:
$su:nn - #49:@recycle-recursive line 15:
$su:nn - #49:@recycle-recursive line 16:
$su:nn - #49:@prog-check line 45:
$su:nn - #49:@prog-check line 54:
$su:nn - #49:@old-grant line 39:
$string_utils:nn - #49:@old-grant line 67:
$string_utils:nn - #49:@core line 12:
$su:nn - #49:@core line 16:
$su:nn - #49:@core line 19:
$su:nn - #49:@core line 23:
$su:nn - #49:@core line 38:
$su:nn - #50:@forked line 33:
$su:nn - #50:@prog*ram line 89:
$string_utils:nn - #50:walkto line 12:
$su:nn - #50:walkto line 15:
$su:nn - #50:@copy-msg line 5:
$su:nn - #50:@copy-msg line 5:
$su:nn - #50:heal line 34:
$su:nn - #50:heal line 40:
$su:nn - #50:paramedic line 23:
$su:nn - #50:paramedic line 49:
$su:nn - #50:@current-daily-gain line 10:
$su:nn - #50:@current-daily-gain line 14:
$su:nn - #50:@current-daily-gain line 17:
$su:nn - #50:@current-daily-gain line 19:
$su:nn - #50:@rhistory line 18:
$su:nn - #50:@rhistory line 18:
$su:nn - #50:@port line 8:
$su:nn - #50:@assume-form line 5:
$su:nn - #50:@assume-form line 11:
$su:nn - #50:@assume-form line 24:
$su:nn - #50:!* line 6:
$su:nn - #50:_@prog line 89:
$string_utils:nn - #50:find_property line 14:
$su:nn - #50:find_property line 15:
$su:nn - #50:find_verb line 14:
$su:nn - #50:find_verb line 15:
$su:nn - #50:find_help line 12:
$string_utils:nn - #50:find_help line 14:
$string_utils:nn - #50:find_help line 20:
$string_utils:nn - #50:find_help line 33:
$string_utils:nn - #50:find_help line 36:
$string_utils:nn - #50:@pathto line 9:
$su:nn - #50:@pathto line 12:
$su:nn - #50:@pathto line 12:
$su:nn - #50:@writeprop line 13:
$su:nn - #50:@writeprop line 17:
$su:nn - #50:@writeprop line 21:
$su:nn - #50:@writeprop line 25:
$su:nn - #50:@writeprop line 37:
$su:nn - #50:@canedit line 32:
$su:nn - #50:@canedit line 47:
$su:nn - #50:@canedit line 50:
$su:nn - #50:@canedit line 54:
$su:nn - #50:@canedit line 74:
$su:nn - #50:@canedit line 76:
$su:nn - #50:@canedit line 79:
$su:nn - #50:@chown*# line 104:
$su:nn - #50:@chown*# line 107:
$su:nn - #50:@chown*# line 120:
$su:nn - #50:@chown*# line 120:
$su:nn - #50:@chown*# line 120:
$su:nn - #50:seccheck line 12:
$su:nn - #50:seccheck line 70:
$su:nn - #51:show_who_listing line 59:
$su:nn - #51:format_caller line 10:
$su:nn - #54:weight line 6:
$su:nn - #55:@pass line 3:
$su:nn - #57:gc line 8:
$su:nn - #57:gc line 8:
$su:nn - #57:gc line 24:
$su:nn - #57:_handle_bad_garbage line 8:
$su:nn - #57:_handle_bad_garbage line 11:
$su:nn - #65:replace line 47:
$string_utils:nn - #65:replace line 47:
$string_utils:nn - #65:replace line 47:
$string_utils:nn - #65:replace line 56:
$string_utils:nn - #65:replace line 56:
$string_utils:nn - #77:list line 12:
$string_utils:nn - #89:@morph line 6:
$su:nn - #92:process_queue line 43:
$su:nn - #92:process_queue line 43:
$su:nn - #92:process_queue line 49:
$su:nn - #92:process_queue line 94:
$su:nn - #92:process_queue line 107:
$su:nn - #92:process_queue line 149:
$su:nn - #92:process_queue line 150:
$su:nn - #92:queue_action line 12:
$su:nn - #92:qu*eue line 13:
$su:nn - #92:doing_msg line 10:
$su:nn - #92:jumpstart line 6:
$su:nn - #93:_start line 4:
$su:nn - #93:_finish line 5:
$su:nn - #93:doing_msg line 10:
$su:nn - #93:doing_msg line 10:
$su:nn - #95:edps line 28:
$su:nn - #96:@initialize line 2:
$string_utils:nn - #96:@initialize line 10:
$string_utils:nn - #96:@initialize line 13:
$string_utils:nn - #96:@initialize line 19:
$string_utils:nn - #96:@initialize line 20:
$string_utils:nn - #96:report_daily_gain line 7:
$su:nn - #96:report_daily_gain line 11:
$su:nn - #96:report_daily_gain line 14:
$su:nn - #96:report_daily_gain line 16:
$su:nn - #100:sc*ore line 13:
$su:nn - #100:st*atus line 10:
$su:nn - #100:st*atus line 13:
$su:nn - #103:spawn line 21:
$su:nn - #103:do_setup line 4:
$su:nn - #103:meat_reaper line 11:
$su:nn - #103:report_error line 15:
$su:nn - #103:report_error line 15:
$su:nn - #103:report_error line 40:
$su:nn - #103:report_error line 40:
$su:nn - #103:render_error line 46:
$su:nn - #103:handle_aborted_task line 30:
$su:nn - #103:handle_aborted_task line 35:
$su:nn - #103:handle_aborted_task line 35:
$su:nn - #103:handle_broken_heart line 3:
$su:nn - #103:handle_broken_area line 3:
$su:nn - #105:creature_heartbeat line 3:
$su:nn - #105:exitfunc line 9:
$su:nn - #105:exitfunc line 9:
$su:nn - #106:_walk line 23:
$su:nn - #106:_walk line 23:
$su:nn - #106:_walk line 27:
$su:nn - #106:_walk line 27:
$su:nn - #106:_walk line 27:
$su:nn - #106:_walk line 35:
$su:nn - #106:_walk line 35:
$su:nn - #106:spare_old line 1:
$su:nn - #106:spare_old line 1:
$su:nn - #106:head_to line 5:
$su:nn - #106:head_to line 5:
$su:nn - #106:head_to line 5:
$su:nn - #106:_compile line 2:
$su:nn - #107:die line 59:
$su:nn - #107:die line 113:
$su:nn - #107:die line 121:
$su:nn - #107:respawn line 20:
$su:nn - #107:respawn line 20:
$su:nn - #107:@setup line 18:
$su:nn - #107:@qp line 17:
$su:nn - #113:@vloc line 28:
$string_utils:nn - #113:@vloc line 35:
$string_utils:nn - #113:@leaves line 10:
$su:nn - #113:@leaves line 12:
$su:nn - #113:@leaves line 12:
$su:nn - #113:@nnlist line 10:
$string_utils:nn - #113:@nnlist line 12:
$string_utils:nn - #114:find_all_paths line 23:
$su:nn - #114:do_reset line 8:
$su:nn - #114:@force-reset line 6:
$su:nn - #114:@force-reset line 32:
$su:nn - #114:on_reset line 25:
$su:nn - #114:on_reset line 25:
$su:nn - #114:calculate_offset line 10:
$su:nn - #114:find_reset_listeners line 10:
$su:nn - #114:_www line 1:
$su:nn - #114:_www line 3:
$su:nn - #114:next_hop_out line 6:
$su:nn - #114:@list-costs line 8:
$su:nn - #119:become_adoor line 17:
$su:nn - #119:become_adoor line 21:
$su:nn - #119:become_adoor line 28:
$su:nn - #119:become_adoor line 34:
$su:nn - #119:become_adoor line 40:
$su:nn - #119:allows_shove line 5:
$su:nn - #119:allows_shove line 5:
$su:nn - #119:action_doing_msg line 9:
$su:nn - #119:action_doing_msg line 9:
$su:nn - #120:tell_object_help line 8:
$su:nn - #121:compile line 14:
$su:nn - #121:select line 33:
$su:nn - #124:action_doing_msg line 11:
$su:nn - #124:action_doing_msg line 11:
$su:nn - #134:heartbeat line 24:
$su:nn - #134:heartbeat line 24:
$su:nn - #134:tree_tag line 1:
$su:nn - #138:transfer_disease line 5:
$su:nn - #141:tree_tag line 6:
$su:nn - #142:_compile line 3:
$su:nn - #142:award_species_quest line 18:
$su:nn - #142:award_species_quest line 25:
$su:nn - #142:award_species_quest line 25:
$su:nn - #142:heartbeat line 9:
$su:nn - #142:_kill_target line 7:
$su:nn - #142:_kill_target line 7:
$su:nn - #148:heartbeat line 5:
$su:nn - #148:heartbeat line 5:
$su:nn - #148:heartbeat line 5:
$su:nn - #148:turn_to_corpse line 10:
$su:nn - #148:turn_to_corpse line 10:
$su:nn - #148:turn_to_corpse line 12:
$su:nn - #148:turn_to_corpse line 12:
$su:nn - #148:turn_to_corpse line 12:
$su:nn - #150:register line 30:
$su:nn - #150:service_queue line 10:
$su:nn - #150:service_queue line 11:
$su:nn - #150:service_queue line 11:
$su:nn - #150:service_queue line 53:
$su:nn - #150:unregister line 8:
$su:nn - #150:unregister line 11:
$su:nn - #150:register_all line 9:
$su:nn - #150:register_all line 9:
$su:nn - #150:validate_queue line 14:
$su:nn - #150:register_long line 4:
$su:nn - #150:register_long line 7:
$su:nn - #150:unregister_long line 3:
$su:nn - #150:unregister_long line 5:
$su:nn - #150:@h-check line 6:
$su:nn - #150:@h-check line 13:
$su:nn - #150:@h-check line 15:
$su:nn - #150:@h-check line 18:
$su:nn - #150:@h-check line 20:
$su:nn - #150:@h-check line 22:
$su:nn - #150:@h-check line 24:
$su:nn - #150:@h-check line 26:
$su:nn - #150:megacheck line 17:
$su:nn - #150:inspect line 12:
$su:nn - #150:inspect line 14:
$su:nn - #150:service_long_queue line 5:
$su:nn - #150:service_long_queue line 15:
$su:nn - #155:process_queue line 29:
$su:nn - #155:process_queue line 41:
$su:nn - #155:process_queue line 49:
$su:nn - #155:btell line 2:
$su:nn - #166:award_to line 47:
$su:nn - #166:award_to line 47:
$su:nn - #166:tree_tag line 9:
$su:nn - #166:tree_tag line 12:
$su:nn - #186:_clean line 29:
$su:nn - #186:_exitfunc line 13:
$su:nn - #186:_exitfunc line 13:
$su:nn - #186:_new_clean line 18:
$su:nn - #186:_new_clean line 24:
$su:nn - #186:_new_clean line 27:
$su:nn - #186:_new_clean line 38:
$su:nn - #186:_new_clean line 38:
$su:nn - #186:_new_clean line 57:
$su:nn - #186:enterfunc line 5:
$su:nn - #186:enterfunc line 8:
$su:nn - #202:@setup-areas line 11:
$su:nn - #202:@setup-areas line 11:
$su:nn - #202:@reset-maps line 18:
$su:nn - #202:@reset-maps line 18:
$su:nn - #202:@merge-icons line 7:
$su:nn - #202:@merge-icons line 11:
$su:nn - #202:@merge-icons line 11:
$su:nn - #202:@merge-icons line 18:
$su:nn - #204:validate line 14:
$su:nn - #204:validate line 14:
$su:nn - #204:validate line 21:
$su:nn - #204:validate line 21:
$su:nn - #214:change_random_pressure line 16:
$su:nn - #214:inspect line 8:
$su:nn - #214:update_wind_room line 5:
$su:nn - #214:create_cloud line 5:
$su:nn - #214:create_cloud line 5:
$su:nn - #216:_tell_standings line 23:
$su:nn - #251:_cannot_set_property line 4:
$su:nn - #251:_cannot_set_property line 4:
$su:nn - #251:_cannot_set_property line 7:
$su:nn - #251:_describe_set_property line 2:
$su:nn - #251:_cannot_add_property line 3:
$su:nn - #251:_cannot_add_property line 5:
$su:nn - #251:_cannot_add_property line 5:
$su:nn - #251:_describe_add_property line 2:
$su:nn - #251:_describe_add_property line 2:
$su:nn - #251:_cannot_add_verb line 4:
$su:nn - #251:_cannot_add_verb line 8:
$su:nn - #251:_cannot_add_verb line 8:
$su:nn - #251:_describe_add_verb line 2:
$su:nn - #251:_describe_add_verb line 2:
$su:nn - #251:_cannot_set_verb line 4:
$su:nn - #251:_cannot_set_verb line 4:
$su:nn - #251:_cannot_set_verb line 7:
$su:nn - #251:_describe_set_verb line 2:
$su:nn - #251:_cannot_delete_verb line 4:
$su:nn - #251:_cannot_delete_verb line 4:
$su:nn - #251:_cannot_delete_verb line 7:
$su:nn - #251:_describe_delete_verb line 2:
$su:nn - #251:_cannot_delete_property line 4:
$su:nn - #251:_cannot_delete_property line 4:
$su:nn - #251:_cannot_delete_property line 7:
$su:nn - #251:_describe_delete_property line 2:
$su:nn - #256:add_to line 19:
$su:nn - #256:add_to line 24:
$su:nn - #256:moveto line 8:
$su:nn - #256:_flow line 4:
$su:nn - #256:_flow line 41:
$su:nn - #256:_flow line 41:
$su:nn - #256:tree_tag line 30:
$su:nn - #283:look_self line 23:
$su:nn - #284:can_modify_prop line 18:
$su:nn - #284:can_modify_prop line 20:
$su:nn - #284:can_add_prop line 19:
$su:nn - #284:can_add_prop line 21:
$su:nn - #285:xmit_with_xyz line 8:
$su:nn - #285:xmit_with_xyz line 8:
$su:nn - #293:txt_assigned line 3:
$su:nn - #293:_@assign line 30:
$su:nn - #293:assigned_msg_seq line 26:
$su:nn - #293:do_combine line 14:
$su:nn - #293:_@attach line 17:
$su:nn - #293:_@attach line 17:
$su:nn - #293:_@mailban line 19:
$su:nn - #293:_@mailban line 22:
$su:nn - #293:_@commentban line 3:
$su:nn - #293:_@commentban line 13:
$su:nn - #293:_@commentban line 14:
$su:nn - #296:_run line 3:
$su:nn - #296:_run line 7:
$su:nn - #296:_run line 12:
$su:nn - #296:_readlog line 1:
$su:nn - #307:forge line 20:
$su:nn - #317:@whohas line 29:
$su:nn - #317:@whohas line 73:
$su:nn - #317:@whohas line 85:
$su:nn - #317:@allitems line 20:
$su:nn - #317:_ofind line 57:
$su:nn - #317:@monsters line 40:
$su:nn - #317:@monsters line 54:
$su:nn - #317:@monsters-xp line 14:
$su:nn - #317:@monsters-new line 15:
$su:nn - #317:@checkloot line 14:
$su:nn - #317:@spy line 14:
$su:nn - #317:@spy line 22:
$su:nn - #317:@spy line 24:
$su:nn - #317:quickbar line 21:
$su:nn - #317:quickbar line 41:
$su:nn - #317:@aspy line 6:
$su:nn - #317:@aspy line 9:
$su:nn - #317:@rspy line 11:
$su:nn - #317:@pathto line 26:
$su:nn - #317:@pathto line 28:
$su:nn - #317:@pathto line 36:
$su:nn - #317:@pathto line 39:
$su:nn - #317:@pathto line 39:
$su:nn - #317:@pathto line 42:
$su:nn - #317:ascend line 3:
$su:nn - #317:match_for_spawn line 31:
$su:nn - #317:monster_for_spawn line 31:
$su:nn - #317:@ofind+ line 31:
$su:nn - #317:update_sources line 22:
$su:nn - #317:update_sources line 53:
$su:nn - #317:update_sources line 72:
$su:nn - #317:update_sources line 140:
$su:nn - #317:@actor-check line 11:
$su:nn - #317:@bigtree line 14:
$su:nn - #317:@my line 26:
$su:nn - #317:@checkspeciesquests line 3:
$su:nn - #317:@checkspeciesquests line 3:
$su:nn - #317:@checkspeciesquests line 5:
$su:nn - #317:@checkspeciesquests line 5:
$su:nn - #317:@checkspeciesquests line 7:
$su:nn - #317:@checkspeciesquests line 7:
$su:nn - #317:@checkspeciesquests line 9:
$su:nn - #317:@checkspeciesquests line 9:
$su:nn - #317:@checkspeciesquests line 11:
$su:nn - #317:@checkspeciesquests line 11:
$su:nn - #317:@checkspeciesquests line 13:
$su:nn - #317:@checkspeciesquests line 13:
$su:nn - #317:@checkspeciesquests line 13:
$su:nn - #317:@checkspeciesquests line 15:
$su:nn - #317:@checkspeciesquests line 15:
$su:nn - #317:@checkspeciesquests line 15:
$su:nn - #317:@findunsecureobjects line 8:
$su:nn - #317:@findunsecureobjects line 8:
$su:nn - #317:@what-is-auto-cleaning line 3:
$su:nn - #317:tostr_for_ex line 4:
$su:nn - #317:@addex line 21:
$su:nn - #317:@compare line 23:
$su:nn - #317:@shopgrep line 6:
$su:nn - #317:@dropgrep line 6:
$su:nn - #317:@topitems line 13:
$su:nn - #317:@topvalues line 14:
$su:nn - #317:@ff line 31:
$su:nn - #334:initialize line 2:
$su:nn - #334:initialize line 2:
$su:nn - #334:initialize line 5:
$su:nn - #334:initialize line 5:
$su:nn - #334:type_for line 7:
$su:nn - #334:type_for line 7:
$su:nn - #334:type_for line 7:
$su:nn - #334:del*ete line 46:
$su:nn - #334:reset line 12:
$su:nn - #334:reset line 41:
$su:nn - #334:copy_props line 4:
$su:nn - #334:copy_props line 4:
$su:nn - #334:@list-costs line 10:
$su:nn - #334:warp line 9:
$su:nn - #334:warp line 9:
$su:nn - #334:warp line 9:
$su:nn - #338:action_doing_msg line 5:
$su:nn - #338:action_doing_msg line 5:
$su:nn - #345:_clean line 10:
$su:nn - #345:_clean line 17:
$su:nn - #347:tree_tag line 3:
$su:nn - #356:announce_change line 11:
$su:nn - #357:announce_change line 11:
$su:nn - #357:announce_remove line 11:
$su:nn - #357:announce_add line 11:
$su:nn - #361:@cv line 8:
$su:nn - #361:@cp line 8:
$su:nn - #364:_start line 4:
$su:nn - #364:_finish line 5:
$su:nn - #364:doing_msg line 10:
$su:nn - #364:doing_msg line 10:
$su:nn - #366:creature_heartbeat line 3:
$su:nn - #366:exitfunc line 3:
$su:nn - #366:exitfunc line 3:
$su:nn
Source
1"name_and_number(object [,sepr] [,english_list_args]) => \"ObjectName (#object)\""; 2"Return name and number for OBJECT. Second argument is optional separator (for those who want no space, use \"\"). If OBJECT is a list of objects, this maps the above function over the list and then passes it to $string_utils:english_list."; 3"The third through nth arguments to nn_list corresponds to the second through nth arguments to English_list, and are passed along untouched."; 4{objs, ?sepr = " ", @eng_args} = args; 5if (typeof(objs) != LIST) 6objs = {objs}; 7endif 8name_list = {}; 9for what in (objs) 10name = valid(what) ? what.name | {"<invalid>", "$nothing", "$ambiguous_match", "$failed_match"}[1 + (what in {#-1, #-2, #-3})]; 11name = tostr(name, sepr, "(", what, ")"); 12name_list = {@name_list, name}; 13endfor 14return this:english_list(name_list, @eng_args);
columnize_suspended columnise_suspended
Referenced by
- #24:columnize line 5:
$string_utils:columnize_suspended - #57:look_self line 9:
$string_utils:columnize_suspended
Source
1"columnize_suspended (interval, items, n [, width]) - Turn a one-column list of items into an n-column list, suspending for `interval' seconds as necessary. 'width' is the last character position that may be occupied; it defaults to a standard screen width. Example: To tell the player a list of numbers in three columns, do 'player:tell_lines ($string_utils:columnize_suspended(0, {1, 2, 3, 4, 5, 6, 7}, 3));'."; 2{interval, items, n, ?width = 79} = args; 3height = ((length(items) + n) - 1) / n; 4items = {@items, @$list_utils:make((height * n) - length(items), "")}; 5colwidths = {}; 6for col in [1..n - 1] 7colwidths = listappend(colwidths, 1 - (((width + 1) * col) / n)); 8endfor 9result = {}; 10for row in [1..height] 11line = tostr(items[row]); 12for col in [1..n - 1] 13$command_utils:suspend_if_needed(interval); 14line = tostr(this:left(line, colwidths[col]), " ", items[row + (col * height)]); 15endfor 16result = listappend(result, line[1..min($, width)]); 17endfor 18return result;
a_or_an
Referenced by
- #33:ready line 16:
$su:a_or_an - #156:change_role line 8:
$su:a_or_an - #156:change_role line 9:
$su:a_or_an - #367:watch_tell line 5:
$su:a_or_an
Source
1":a_or_an(<noun>) => \"a\" or \"an\""; 2"To accomodate personal variation (e.g., \"an historical book\"), a player can override this by having a personal a_or_an verb. If that verb returns 0 instead of a string, the standard algorithm is used."; 3noun = args[1]; 4if ($object_utils:has_verb(player, "a_or_an") && ((custom_result = player:a_or_an(noun)) != 0)) 5return custom_result; 6endif 7if (noun in this.use_article_a) 8return "a"; 9endif 10if (noun in this.use_article_an) 11return "an"; 12endif 13a_or_an = "a"; 14if (noun != "") 15if (index("aeiou", noun[1])) 16a_or_an = "an"; 17"unicycle, unimplemented, union, united, unimpressed, unique"; 18if ((((noun[1] == "u") && (length(noun) > 2)) && (noun[2] == "n")) && ((index("aeiou", noun[3]) == 0) || (((noun[3] == "i") && (length(noun) > 3)) && (index("aeioubcghqwyz", noun[4]) || ((length(noun) > 4) && index("eiy", noun[5])))))) 19a_or_an = "a"; 20endif 21endif 22endif 23return a_or_an; 24"Ported by Mickey with minor tweaks from a Moo far far away."; 25"Last modified Sun Aug 1 22:53:07 1993 EDT by BabyBriar (#2).";
index_all
Referenced by
none
Source
1"index_all(string,target) -- returns list of positions of target in string."; 2"Usage: $string_utils:index_all(<string,pattern>)"; 3" $string_utils:index_all(\"aaabacadae\",\"a\")"; 4{line, pattern} = args; 5if ((typeof(line) != STR) || (typeof(pattern) != STR)) 6return E_TYPE; 7else 8where = {}; 9place = -1; 10next = 0; 11while ((place = index(line[next + 1..$], pattern)) != 0) 12where = {@where, place + next}; 13next = ((place + next) + length(pattern)) - 1; 14endwhile 15return where; 16endif
match_stringlist match_string_list
Referenced by
- #167:biz line 4:
$su:match_stringlist - #167:biz_access line 9:
$su:match_stringlist - #167:biz_access line 11:
$su:match_stringlist - #327:_invoke line 8:
$su:match_stringlist
Source
1"Copied from Puff (#1449):match_stringlist Tue Oct 19 08:18:13 1993 PDT"; 2"$string_utils:match_stringlist(string, {list of strings})"; 3"The list of strings should be just that, a list of strings. The first string is matched against the list of strings."; 4"If it exactly matches exactly one of them, the index of the match is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 5"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of one of the strings."; 6"Again, if exactly one match is found, the index of that string is returned, and if more than one match is found, $ambiguous match is returned."; 7"Finally, if there are no exact or partial matches, then $failed_match is returned."; 8{subject, stringlist} = args; 9if ((subject == "") || (length(stringlist) < 1)) 10return $nothing; 11endif 12matches = {}; 13"First check for exact matches."; 14for i in [1..length(stringlist)] 15if (subject == stringlist[i]) 16matches = {@matches, i}; 17endif 18endfor 19"Now return a match, or $ambiguous, or check for partial matches."; 20if (length(matches) == 1) 21return matches[1]; 22elseif (length(matches) > 1) 23return $ambiguous_match; 24elseif (length(matches) == 0) 25"Checking for partial matches is almost identical to checking for exact matches, but we use index(list[i], target) instead of list[i] == target to see if they match."; 26for i in [1..length(stringlist)] 27if (index(stringlist[i], subject) == 1) 28matches = {@matches, i}; 29endif 30endfor 31if (length(matches) == 1) 32return matches[1]; 33elseif (length(matches) > 1) 34return $ambiguous_match; 35elseif (length(matches) == 0) 36return $failed_match; 37endif 38endif
from_ASCII
Referenced by
- #6:parse_command line 63:
$su:from_ascii - #6:parse_command line 81:
$su:from_ascii - #324:from64 line 25:
$string_utils:from_ascii
Source
1"This converts a ASCII character code in the range [32..126] into the ASCII character with that code, represented as a one-character string."; 2""; 3"Example: $string_utils:from_ASCII(65) => \"A\""; 4code = args[1]; 5return this.ascii[code - 31];
to_ASCII
Referenced by
- #20:crapsum line 7:
$su:to_ascii - #20:crapsum line 14:
$su:to_ascii - #103:get_html_icon line 6:
$su:to_ASCII
Source
1"Convert a one-character string into the ASCII character code for that character."; 2""; 3"Example: $string_utils:to_ASCII(\"A\") => 65"; 4return (index(this.ascii, args[1], 1) || raise(E_INVARG)) + 31;
abbreviated_value
Referenced by
- #2:@d*isplay line 187:
$string_utils:abbreviated_value - #2:@d*isplay line 200:
$string_utils:abbreviated_value - #50:@d*isplay line 187:
$string_utils:abbreviated_value - #50:@d*isplay line 200:
$string_utils:abbreviated_value
Source
1"Copied from Mickey (#52413):abbreviated_value Fri Sep 9 08:52:41 1994 PDT"; 2":abbreviated_value(value,max_reslen,max_lstlev,max_lstlen,max_strlen,max_toklen)"; 3""; 4"Gets the printed representation of value, subject to these parameters:"; 5" max_reslen = Maximum desired result string length."; 6" max_lstlev = Maximum list level to show."; 7" max_lstlen = Maximum list length to show."; 8" max_lstlen = Maximum string length to show."; 9" max_lstlen = Maximum token length (e.g., numbers and errors) to show."; 10""; 11"A best attempt is made to get the exact target size, but in some cases the result is not exact."; 12{value, ?max_reslen = $maxint, ?max_lstlev = $maxint, ?max_lstlen = $maxint, ?max_strlen = $maxint, ?max_toklen = $maxint} = args; 13return this:_abbreviated_value(value, max_reslen, max_lstlev, max_lstlen, max_strlen, max_toklen); 14"Originally written by Mickey.";
_abbreviated_value
Referenced by
- #20:abbreviated_value line 13:
this:_abbreviated_value
Source
1"Copied from Mickey (#52413):_abbreviated_value Fri Sep 9 08:52:44 1994 PDT"; 2"Internal to :abbreviated_value. Do not call this directly."; 3{value, max_reslen, max_lstlev, max_lstlen, max_strlen, max_toklen} = args; 4if ((type = typeof(value)) == LIST) 5if (!value) 6return "{}"; 7elseif (max_lstlev == 0) 8return "{...}"; 9else 10n = length(value); 11result = "{"; 12r = max_reslen - 2; 13i = 1; 14eltstr = ""; 15while (((i <= n) && (i <= max_lstlen)) && (r > (x = (i == 1) ? 0 | 2))) 16eltlen = length(eltstr = this:(verb)(value[i], r, max_lstlev - 1, max_lstlen, max_strlen, max_toklen)); 17lastpos = 1; 18if (r >= (eltlen + x)) 19comma = (i == 1) ? "" | ", "; 20result = tostr(result, comma); 21if (r > 4) 22lastpos = length(result); 23endif 24result = tostr(result, eltstr); 25r = (r - eltlen) - x; 26elseif (i == 1) 27return "{...}"; 28elseif (r > 4) 29return tostr(result, ", ...}"); 30else 31return tostr(result[1..lastpos], "...}"); 32endif 33i = i + 1; 34endwhile 35if (i <= n) 36if (i == 1) 37return "{...}"; 38elseif (r > 4) 39return tostr(result, ", ...}"); 40else 41return tostr(result[1..lastpos], "...}"); 42endif 43else 44return tostr(result, "}"); 45endif 46endif 47elseif (type == STR) 48result = "\""; 49while ((q = index(value, "\"")) ? q = min(q, index(value, "\\")) | (q = index(value, "\\"))) 50result = ((result + value[1..q - 1]) + "\\") + value[q]; 51value = value[q + 1..$]; 52endwhile 53result = result + value; 54if ((length(result) + 1) > (z = max(min(max_reslen, max(max_strlen, max_strlen + 2)), 6))) 55z = z - 5; 56k = 0; 57while ((k < z) && (result[z - k] == "\\")) 58k = k + 1; 59endwhile 60return tostr(result[1..z - (k % 2)], "\"+..."); 61else 62return tostr(result, "\""); 63endif 64else 65v = (type == ERR) ? $code_utils:error_name(value) | tostr(value); 66len = max(4, min(max_reslen, max_toklen)); 67return (length(v) > len) ? v[1..len - 3] + "..." | v; 68endif 69"Originally written by Mickey.";
match_suspended
Referenced by
none
Source
1"$string_utils:match_suspended(string [, obj-list, prop-name]*)"; 2"Each obj-list should be a list of objects or a single object, which is treated as if it were a list of that object. Each prop-name should be string naming a property on every object in the corresponding obj-list. The value of that property in each case should be either a string or a list of strings."; 3"The argument string is matched against all of the strings in the property values."; 4"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 5"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 6"Finally, if there are no exact or partial matches, then $failed_match is returned."; 7"This verb will suspend as needed, and should be used if obj-list is very large."; 8subject = args[1]; 9if (subject == "") 10return $nothing; 11endif 12no_exact_match = no_partial_match = 1; 13for i in [1..length(args) / 2] 14prop_name = args[(2 * i) + 1]; 15for object in ((typeof(olist = args[2 * i]) == LIST) ? olist | {olist}) 16if (valid(object)) 17if (typeof(str_list = `object.(prop_name) ! E_PERM, E_PROPNF => {}') != LIST) 18str_list = {str_list}; 19endif 20if (subject in str_list) 21if (no_exact_match) 22no_exact_match = object; 23elseif (no_exact_match != object) 24return $ambiguous_match; 25endif 26else 27for string in (str_list) 28if (index(string, subject) != 1) 29elseif (no_partial_match) 30no_partial_match = object; 31elseif (no_partial_match != object) 32no_partial_match = $ambiguous_match; 33endif 34endfor 35endif 36endif 37$command_utils:suspend_if_needed(5); 38endfor 39endfor 40return no_exact_match && (no_partial_match && $failed_match);
incr_alpha
Referenced by
- #11:prune line 36:
$string_utils:incr_alpha - #20:incr_alpha line 8:
this:incr_alpha
Source
1"args[1] is a string. 'increments' the string by one. E.g., aaa => aab, aaz => aba. empty string => a, zzz => aaaa."; 2"args[2] is optional alphabet to use instead of $string_utils.alphabet."; 3{s, ?alphabet = this.alphabet} = args; 4index = length(s); 5if (!s) 6return alphabet[1]; 7elseif (s[$] == alphabet[$]) 8return this:incr_alpha(s[1..index - 1], alphabet) + alphabet[1]; 9else 10t = index(alphabet, s[index]); 11return s[1..index - 1] + alphabet[t + 1]; 12endif
is_float
Referenced by
- #87:_do_convert line 21:
$string_utils:is_float
Source
1"Usage: is_float(string)"; 2"Is string composed of one or more digits possibly preceded by a minus sign either followed by a decimal or by an exponent?"; 3"Return true or false"; 4return match(args[1], "^ *[-+]?%(%([0-9]+%.[0-9]*%|[0-9]*%.[0-9]+%)%(e[-+]?[0-9]+%)?%)%|%([0-9]+e[-+]?[0-9]+%) *$");
inside_quotes
Referenced by
none
Source
1"Copied from Moo_tilities (#332):inside_quotes by Mooshie (#106469) Tue Dec 23 10:26:49 1997 PST"; 2"Usage: inside_quotes(STR)"; 3"Is the end of the given string `inside' a doublequote?"; 4"Called from $code_utils:substitute."; 5{string} = args; 6quoted = 0; 7while (i = index(string, "\"")) 8if ((!quoted) || (string[i - 1] != "\\")) 9quoted = !quoted; 10endif 11string = string[i + 1..$]; 12endwhile 13return quoted;
strip_all_but_seq
Referenced by
none
Source
1":strip_all_but_seq(string, keep) => chars in string not in exact sequence of keep removed."; 2":strip_all_but() works similarly, only it does not concern itself with the sequence, just the specified chars."; 3string = args[1]; 4wanted = args[2]; 5output = ""; 6while (m = match(string, wanted)) 7output = output + string[m[1]..m[2]]; 8string = string[m[2] + 1..length(string)]; 9endwhile 10return output;
ps_backup
Referenced by
none
Source
1"Copied from string utilities (#20):ps by Satan (#2) Mon Feb 16 18:35:03 2004 PST"; 2"Pronoun (and other things) substitution. See 'help pronouns' for details."; 3"syntax: $string_utils:pronoun_sub(text[,who[,thing[,location[,dobj[,iobj]]]]])"; 4"%s,%o,%p,%q,%r => <who>'s pronouns. <who> defaults to player."; 5"%n,%d,%i,%t,%l,%% => <who>, dobj, iobj, <thing>, location and %"; 6"<thing> defaults to caller; <location> defaults to who.location"; 7"%S,%O,%P,%Q,%R, %N,%D,%I,%T,%L have corresponding capitalized substitutions."; 8" %[#n], %[#d], ... => <who>, dobj, etc.'s object number"; 9"%(foo) => <who>.foo and %(Foo) => <who>.foo capitalized. %[dfoo] => dobj.foo, etc.."; 10"%<foo> -> whatever <who> does when normal people foo. This is determined by calling :verb_sub() on the <who>."; 11"%<d:foo> -> whatever <dobj> does when normal people foo."; 12{string, ?who = player, ?thing = caller, ?where = $nothing, ?dobject = dobj, ?iobject = iobj} = args; 13where = valid(where) ? where | (valid(who) ? who.location | where); 14set_task_perms($no_one); 15if (typeof(string) == LIST) 16plines = {}; 17for line in (string) 18plines = {@plines, this:(verb)(line, who, thing, where)}; 19endfor 20return plines; 21endif 22old = tostr(string); 23new = ""; 24objspec = "nditl"; 25objects = {who, dobject, iobject, thing, where}; 26prnspec = "sopqrSOPQR"; 27prprops = {"ps", "po", "pp", "pq", "pr", "Ps", "Po", "Pp", "Pq", "Pr"}; 28oldlen = length(old); 29while ((prcnt = index(old, "%")) && (prcnt < oldlen)) 30s = old[k = prcnt + 1]; 31if ((s == "<") && (gt = index(old[k + 2..$], ">"))) 32"handling %<verb> "; 33gt = (gt + k) + 1; 34vb = old[k + 1..gt - 1]; 35vbs = who; 36if ((length(vb) > 2) && (vb[2] == ":")) 37" %<d:verb>"; 38vbs = objects[index(objspec, vb[1]) || 1]; 39vb = vb[3..$]; 40endif 41vb = $object_utils:has_verb(vbs, "verb_sub") ? vbs:verb_sub(vb) | this:(verb)(vb, vbs); 42new = (new + old[1..prcnt - 1]) + vb; 43k = gt; 44else 45cp_args = {}; 46if (brace = index("([", s)) 47if (!(w = index(old[k + 1..oldlen], ")]"[brace]))) 48return new + old; 49else 50p = old[prcnt + 2..(k = k + w) - 1]; 51if (brace == 1) 52"%(property)"; 53cp_args = {who, p}; 54elseif (p[1] == "#") 55"%[#n] => object number"; 56s = (o = index(objspec, p[2])) ? tostr(objects[o]) | (("[" + p) + "]"); 57elseif (!(o = index(objspec, p[1]))) 58s = ("[" + p) + "]"; 59else 60" %[dproperty] "; 61cp_args = {objects[o], p[2..w - 1], strcmp(p[1], "a") < 0}; 62endif 63endif 64elseif (o = index(objspec, s)) 65cp_args = {objects[o], "", strcmp(s, "a") < 0}; 66elseif (w = index(prnspec, s, 1)) 67cp_args = {who, prprops[w]}; 68elseif (s == "#") 69s = tostr(who); 70elseif (s != "%") 71s = "%" + s; 72endif 73new = (new + old[1..prcnt - 1]) + ((!cp_args) ? s | ((typeof(sub = $string_utils:_cap_property(@cp_args)) != ERR) ? sub | (("%(" + tostr(sub)) + ")"))); 74endif 75old = old[k + 1..oldlen]; 76oldlen = oldlen - k; 77endwhile 78return new + old;
mel_match
Referenced by
none
Source
1"$string_utils:match(string [, obj-list, prop-name]*)"; 2"Each obj-list should be a list of objects or a single object, which is treated as if it were a list of that object. Each prop-name should be string naming a property on every object in the corresponding obj-list. The value of that property in each case should be either a string or a list of strings."; 3"The argument string is matched against all of the strings in the property values."; 4"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 5"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 6"Finally, if there are no exact or partial matches, then $failed_match is returned."; 7subject = args[1]; 8if (subject == "") 9return $nothing; 10endif 11exact_match = #-1; 12partial_match = #-1; 13pairs = args[2..$]; 14while (pairs) 15objs = pairs[1]; 16if (typeof(objs) != LIST) 17objs = {pairs[1]}; 18endif 19prop = pairs[2]; 20for object in (objs) 21str_list = `object.(prop) ! E_PERM, E_PROPNF => {}'; 22if (typeof(str_list) == STR) 23str_list = {str_list}; 24endif 25if (subject in str_list) 26if (valid(exact_match) && (exact_match != object)) 27return $ambiguous_match; 28else 29exact_match = object; 30endif 31else 32for string in (str_list) 33if (index(string, subject) == 1) 34if (valid(partial_match) && (partial_match != object)) 35partial_match = $ambiguous_match; 36break; 37else 38partial_match = object; 39endif 40endif 41endfor 42endif 43endfor 44pairs = listdelete(pairs, 1); 45pairs = listdelete(pairs, 1); 46endwhile 47if (valid(exact_match)) 48return exact_match; 49elseif (valid(partial_match)) 50return partial_match; 51elseif (partial_match == $ambiguous_match) 52return $ambiguous_match; 53else 54return $failed_match; 55endif
match_backup_spunky
Referenced by
none
Source
1"Copied from string utilities (#20):match by Hacker (#36) Mon Feb 23 20:07:24 2004 PST"; 2"$string_utils:match(string [, obj-list, prop-name]*)"; 3"Each obj-list should be a list of objects or a single object, which is treated as if it were a list of that object. Each prop-name should be string naming a property on every object in the corresponding obj-list. The value of that property in each case should be either a string or a list of strings."; 4"The argument string is matched against all of the strings in the property values."; 5"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 6"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 7"Finally, if there are no exact or partial matches, then $failed_match is returned."; 8subject = args[1]; 9if (subject == "") 10return $nothing; 11endif 12no_exact_match = no_partial_match = 1; 13for i in [1..length(args) / 2] 14prop_name = args[(2 * i) + 1]; 15for object in ((typeof(olist = args[2 * i]) == LIST) ? olist | {olist}) 16if (valid(object)) 17if (typeof(str_list = `object.(prop_name) ! E_PERM, E_PROPNF => {}') != LIST) 18str_list = {str_list}; 19endif 20if (subject in str_list) 21if (no_exact_match) 22no_exact_match = object; 23elseif (no_exact_match != object) 24return $ambiguous_match; 25endif 26else 27for string in (str_list) 28if (index(string, subject) != 1) 29elseif (no_partial_match) 30no_partial_match = object; 31elseif (no_partial_match != object) 32no_partial_match = $ambiguous_match; 33endif 34endfor 35endif 36endif 37endfor 38endfor 39#97:tell("[su] default case"); 40return no_exact_match && (no_partial_match && $failed_match);
match_aliases
Referenced by
- #44:match line 19:
$su:match_aliases
Source
1"$string_utils:match_aliases(string, objlist [, who])"; 2"The argument string is matched against all of the strings in the :name() and :aliases() of the objects in objlist. If 'who' is provided and is a player with .private_aliases defined, it will be used as well."; 3"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 4"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 5"Finally, if there are no exact or partial matches, then $failed_match is returned."; 6{subj, ?olist = {}, ?who = #-1} = args; 7if (subj == "") 8return $nothing; 9endif 10if (typeof(olist) != LIST) 11olist = {olist}; 12endif 13if ((gamevalid(who) && is_a(who, $player)) && has_property(who, "private_aliases")) 14matchlist = (subj in who.private_aliases) ? who.private_aliases[subj] | {}; 15matching_objs = {}; 16for m in (matchlist) 17for o in (olist) 18if (((o == m) || is_a(o, m)) && (o != who)) 19matching_objs = {@matching_objs, o}; 20endif 21yield 0; 22endfor 23yield 0; 24endfor 25if (matching_objs) 26if (length(matching_objs) > 1) 27return $ambiguous_match; 28else 29return matching_objs[1]; 30endif 31endif 32endif 33for o in (olist) 34if (gamevalid(o) && ((subj == o.name) || (subj == o:name()))) 35return o; 36endif 37yield 0; 38endfor 39for o in (olist) 40if (gamevalid(o) && (subj in o.aliases)) 41return o; 42endif 43yield 0; 44endfor 45for o in (olist) 46if (gamevalid(o)) 47for name in ({o:name(), @o:aliases()}) 48if (index(name, subj) == 1) 49return o; 50endif 51yield 0; 52endfor 53endif 54yield 0; 55endfor 56return $failed_match;
escape
Referenced by
- #3:emote line 8:
$su:escape - #6:@nude line 22:
$su:escape - #6:say_backup line 2:
$su:escape - #6:_page line 8:
$su:escape - #38:make_message line 19:
$su:escape - #38:make_message line 32:
$su:escape - #38:make_message line 40:
$su:escape - #84:@paste line 20:
$su:escape - #84:|* line 16:
$su:escape - #84:|* line 16:
$su:escape - #107:say line 6:
$su:escape - #107:think line 14:
$su:escape - #130:_page line 8:
$su:escape - #167:summary line 8:
$su:escape - #237:chat line 1:
$su:escape - #293:_@comment line 43:
$su:escape - #293:_@annotate line 20:
$su:escape - #310:pose_ex line 37:
$su:escape - #310:pose_ex line 38:
$su:escape - #310:pose_ex line 81:
$su:escape - #310:pose_ex line 82:
$su:escape - #318:_who line 57:
$su:escape - #336:@* line 26:
$su:escape - #360:prog line 1:
$su:escape
Source
1text = args[1]; 2if (typeof(text) != STR) 3return ""; 4endif 5"WARNING: If you're editing this verb, chances are you're only seeing one tilde as the third argument to strsub in the folling line. One of the tildes gets eaten on output, so you need to add it back in before you save, such that the third argument has two tildes."; 6text = strsub(text, "~", "~~"); 7return text;
match_aliases_ambiguous
Referenced by
- #44:match_ambiguous line 20:
$su:match_aliases_ambiguous
Source
1"Copied from string utilities (#20):match_aliases by Hacker (#36) Fri Mar 5 20:34:58 2004 PST"; 2"$string_utils:match_aliases(string, objlist)"; 3"The argument string is matched against all of the strings in the :name() and :aliases() of the objects in objlist."; 4"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 5"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 6"Finally, if there are no exact or partial matches, then $failed_match is returned."; 7subject = args[1]; 8if (subject == "") 9return $nothing; 10endif 11no_exact_match = no_partial_match = 1; 12for object in ((typeof(olist = args[2]) == LIST) ? olist | {olist}) 13if (valid(object)) 14str_list = {object:name(), @object:aliases()}; 15if (subject in str_list) 16if (no_exact_match) 17no_exact_match = object; 18elseif (no_exact_match != object) 19return $ambiguous_match; 20endif 21else 22for string in (str_list) 23if (index(string, subject) != 1) 24elseif (no_partial_match) 25no_partial_match = object; 26elseif (no_partial_match != object) 27no_partial_match = $ambiguous_match; 28endif 29endfor 30endif 31endif 32endfor 33return no_exact_match && (no_partial_match && $failed_match);
plural
Referenced by
- #1:plural_name line 6:
$su:plural - #3:player_integration_msg_backup line 40:
$su:plural - #6:tell_age line 2:
$su:plural - #6:@age line 37:
$su:plural - #6:pname line 8:
$su:plural - #6:pname line 10:
$su:plural - #20:plural line 20:
this:plural - #56:_player_integration_msg line 47:
$su:plural - #147:do_make line 74:
$su:plural - #147:do_make line 75:
$su:plural
Source
1":plural(STR item [, count[, mode]]) => pluralization"; 2""; 3"Mode can be 0 (default) -- english number, 1 -- literal number, or 2 -- no number."; 4""; 5"Examples:"; 6" :plural(\"dog\") => \"dogs\""; 7" :plural(\"a dog\") => \"some dogs\""; 8" :plural(\"fart\", 3) => \"three farts\""; 9{instring, ?count = "N", ?mode = 0} = args; 10article = ""; 11if (count == 1) 12if (mode != 1) 13return instring; 14else 15return tostr(count, " ", instring); 16endif 17endif 18if (matchspec = match(instring, " of ")) 19index = matchspec[1] - 1; 20return this:plural(instring[1..index], count) + instring[index + 1..$]; 21elseif (length(instring) > 2) 22if (instring[1..2] == "a ") 23instring = instring[3..$]; 24article = "some "; 25endif 26elseif (length(instring) > 3) 27if (instring[1..3] == "an ") 28instring = instring[4..$]; 29article = "some "; 30endif 31elseif (length(instring) > 4) 32if (instring[1..4] == "one ") 33instring = instring[5..$]; 34article = "some "; 35endif 36endif 37if (length(instring) > 2) 38if ((instring[$ - 1..$] == "ex") || (instring[$ - 1..$] == "ix")) 39nounval = instring[1..$ - 2] + "ices"; 40elseif (instring[$ - 1..$] == "um") 41nounval = instring[1..$ - 2] + "a"; 42elseif (instring[$ - 1..$] == "us") 43nounval = instring[1..$ - 2] + "i"; 44elseif (instring[$ - 1..$] == "os") 45nounval = instring[1..$ - 2] + "oi"; 46elseif (instring[$ - 1..$] == "oy") 47nounval = instring[1..$ - 2] + "oys"; 48elseif (instring[$ - 1..$] == "ey") 49nounval = instring[1..$ - 2] + "eys"; 50elseif (instring[$ - 1..$] == "ay") 51nounval = instring[1..$ - 2] + "ays"; 52elseif (instring[$] == "y") 53nounval = instring[1..$ - 1] + "ies"; 54elseif (((instring[$ - 1..$] == "ch") && (instring[$ - 2] != "o")) || (instring[$..1] == "sh")) 55nounval = instring + "es"; 56elseif ((instring[$] == "x") || (instring[$] == "s")) 57nounval = instring + "es"; 58else 59nounval = instring + "s"; 60endif 61elseif (length(instring) > 1) 62nounval = instring + "s"; 63else 64nounval = "nothings"; 65endif 66if (count == "N") 67return article + nounval; 68elseif (mode == 1) 69return tostr(count, " ", nounval); 70elseif (mode == 2) 71return nounval; 72else 73count = $su:english_number(count); 74return (count + " ") + nounval; 75endif
aggregate_number
Referenced by
- #3:player_integration_msg_backup line 40:
$su:aggregate_number - #6:new_tell_contents line 26:
$su:aggregate_number - #6:new_tell_contents line 45:
$su:aggregate_number - #6:new_tell_contents line 82:
$su:aggregate_number - #6:new_tell_contents line 101:
$su:aggregate_number - #6:tell_contents_sub line 34:
$string_utils:aggregate_number - #54:tell_contents_sub line 48:
$string_utils:aggregate_number - #56:_player_integration_msg line 47:
$su:aggregate_number - #98:aggregate_names line 8:
$string_utils:aggregate_number - #98:aggregate_names_bold line 8:
$string_utils:aggregate_number - #103:tell_contents_sub line 37:
$string_utils:aggregate_number - #107:_get_many line 15:
$su:aggregate_number - #107:tell_contents line 50:
$string_utils:aggregate_number - #129:look_self line 3:
$su:aggregate_number - #147:tell_contents_old line 17:
$string_utils:aggregate_number - #186:tell_contents_sub line 42:
$string_utils:aggregate_number - #187:list_name line 4:
$su:aggregate_number - #345:look_self line 38:
$string_utils:aggregate_number
Source
1number = args[1]; 2if (number < 11) 3return this:english_number(number); 4elseif (number < 20) 5return "lots of"; 6elseif (number == 20) 7return "a score of"; 8elseif (number < 51) 9return "scores of"; 10else 11return "massive numbers of"; 12endif
msg
Referenced by
- #6:who_doing_msg line 1:
$su:msg - #6:pee line 18:
$su:msg - #98:voice_of line 6:
$su:msg - #106:hear_say_to line 8:
$su:msg - #106:hear_say_to line 26:
$su:msg - #106:_notice_nude line 7:
$su:msg - #106:_flee line 11:
$su:msg - #106:_is_nude line 7:
$su:msg - #106:greet_msg line 2:
$su:msg - #106:head_to line 11:
$su:msg - #107:die line 73:
$su:msg - #107:_resist line 41:
$su:msg - #110:lick_msg line 11:
$su:msg - #110:lick_msg line 17:
$su:msg - #110:bite_msg line 11:
$su:msg - #110:bite_msg line 17:
$su:msg - #111:disintegrate line 3:
$su:msg - #111:tease line 4:
$su:msg - #111:tease line 7:
$su:msg - #114:ambience line 3:
$su:msg - #119:_bash line 7:
$su:msg - #119:_bash line 8:
$su:msg - #125:effect line 5:
$su:msg - #125:reup line 4:
$su:msg - #125:reup line 7:
$su:msg - #125:onset line 2:
$su:msg - #125:onset line 5:
$su:msg - #125:overdose line 2:
$su:msg - #125:remove_from line 24:
$su:msg - #125:recover line 2:
$su:msg - #141:wipe line 20:
$su:msg - #141:wipe line 22:
$su:msg - #141:lick line 7:
$su:msg - #141:lick line 13:
$su:msg - #141:lick line 15:
$su:msg - #165:noise_msg line 2:
$su:msg - #165:look_place_msg line 1:
$su:msg - #215:upgrade_msg line 1:
$su:msg - #231:noise_msg line 4:
$su:msg - #240:ambience line 3:
$su:msg - #257:smell line 22:
$su:msg - #257:smell line 23:
$su:msg - #267:do_spring line 2:
$su:msg - #267:do_spring line 7:
$su:msg - #267:do_strike line 2:
$su:msg - #267:do_notice line 2:
$su:msg - #267:do_notice line 5:
$su:msg - #267:do_notice line 7:
$su:msg - #267:install line 16:
$su:msg - #306:msg line 1:
$su:msg - #306:heartbeat line 24:
$su:msg
Source
1if (args[1] == {}) 2return ""; 3endif 4return (typeof(args[1]) == LIST) ? args[1][random($)] | args[1];
nn_c
Referenced by
none
Source
1"Copied from string utilities (#20):nn by Hacker (#36) Sat Apr 10 03:54:39 2004 PDT"; 2"name_and_number(object [,sepr] [,english_list_args]) => \"ObjectName (#object)\""; 3"Return name and number for OBJECT. Second argument is optional separator (for those who want no space, use \"\"). If OBJECT is a list of objects, this maps the above function over the list and then passes it to $string_utils:english_list."; 4"The third through nth arguments to nn_list corresponds to the second through nth arguments to English_list, and are passed along untouched."; 5{objs, ?sepr = " ", @eng_args} = args; 6if (typeof(objs) != LIST) 7objs = {objs}; 8endif 9name_list = {}; 10for what in (objs) 11name = valid(what) ? what.name | {"<invalid>", "$nothing", "$ambiguous_match", "$failed_match"}[1 + (what in {#-1, #-2, #-3})]; 12name = tostr(name, sepr, (("(" + $ansi.bg_blue) + $ansi.bold_on) + $ansi.white, what, $ansi.reset + ")"); 13name_list = {@name_list, name}; 14endfor 15return this:english_list(name_list, @eng_args);
message_db
Referenced by
- #3:player_integration_msg line 23:
$su:message_db - #3:player_integration_msg_backup line 5:
$su:message_db - #3:player_integration_msg_old line 18:
$su:message_db - #6:new_tell_contents line 5:
$su:message_db - #6:new_tell_contents line 6:
$su:message_db - #6:new_tell_contents line 7:
$su:message_db - #56:_player_integration_msg line 14:
$su:message_db - #98:aggregate_names line 4:
$su:message_db - #98:aggregate_names_bold line 4:
$su:message_db - #107:tell_holding line 14:
$su:message_db - #107:_get_many line 13:
$su:message_db - #147:tell_contents_old line 14:
$su:message_db - #184:_start line 51:
$su:message_db - #184:_finish line 41:
$su:message_db - #184:_abort line 11:
$su:message_db - #270:_start line 51:
$su:message_db - #270:_finish line 28:
$su:message_db - #270:_abort line 7:
$su:message_db
Source
1":message_db(LIST objs, STR prop) => Returns a pruned message list of the format {{objects_with_message}, message}"; 2msg_db = {}; 3names = {}; 4things = args[1]; 5prop = args[2]; 6for x in (things) 7added = 0; 8msg = `x:(prop)() ! ANY => ""'; 9if (!msg) 10msg = `x.(prop) ! ANY => ""'; 11endif 12if (msg_db) 13for y in [1..length(msg_db)] 14$cu:sin(0); 15if (msg_db[y][2] == msg) 16msg_db[y][1] = listappend(msg_db[y][1], x); 17added = 1; 18endif 19endfor 20endif 21if (!added) 22msg_db = setadd(msg_db, {{x}, msg}); 23endif 24endfor 25return msg_db;
english_weight
Referenced by
- #6:tell_contents_old line 51:
$su:english_weight - #107:tell_contents line 66:
$su:english_weight
Source
1weight = args[1]; 2if (weight < 1000) 3return tostr(weight) + " grams"; 4else 5return (tostr(weight = weight / 1000) + " kilogram") + ((weight > 1) ? "s" | ""); 6endif
english_weight_short
Referenced by
- #6:tell_contents line 39:
$su:english_weight_short - #6:tell_contents line 40:
$su:english_weight_short - #6:new_tell_contents line 34:
$su:english_weight_short - #6:new_tell_contents line 53:
$su:english_weight_short - #6:new_tell_contents line 90:
$su:english_weight_short - #6:new_tell_contents line 109:
$su:english_weight_short - #6:tell_contents_sub line 21:
$su:english_weight_short - #6:tell_contents_sub line 40:
$su:english_weight_short - #54:tell_contents_sub line 30:
$su:english_weight_short - #54:tell_contents_sub line 54:
$su:english_weight_short - #103:tell_contents_sub line 19:
$su:english_weight_short - #103:tell_contents_sub line 43:
$su:english_weight_short - #107:tell_contents line 32:
$su:english_weight_short - #107:tell_contents line 56:
$su:english_weight_short - #186:tell_contents_sub line 24:
$su:english_weight_short - #186:tell_contents_sub line 48:
$su:english_weight_short - #345:look_self line 25:
$su:english_weight_short - #345:look_self line 44:
$su:english_weight_short
Source
1weight = toint(args[1]); 2if (weight < 1000) 3return tostr(weight) + "g"; 4else 5return floatstr(tofloat(weight) / 1000.0, 1) + "kg"; 6endif
plural_deprecated
Referenced by
none
Source
1"Copied from string utilities (#20):plural by Spunky (#97) Wed May 5 13:15:49 2004 PDT"; 2string = args[1]; 3if (idx = index(string, " of ")) 4what = string[1..idx - 1]; 5else 6what = string; 7endif 8if ((what[$] == "s") || (what[$] == "x")) 9what = what + "es"; 10else 11what = what + "s"; 12endif 13if (idx) 14return what + string[idx..$]; 15else 16return what; 17endif
strip_article
Referenced by
- #6:new_tell_contents line 25:
$su:strip_article - #6:new_tell_contents line 44:
$su:strip_article - #6:new_tell_contents line 81:
$su:strip_article - #6:new_tell_contents line 100:
$su:strip_article
Source
1text = args[1]; 2text = strsub(text, "the ", ""); 3text = strsub(text, "a ", ""); 4text = strsub(text, "an ", ""); 5return text;
random_word
Referenced by
- #20:gibberish line 9:
$su:random_word
Source
1objnums = tonum(max_object()); 2while (1) 3what = #-1; 4while ((!is_a(what, #1)) || (!what.description)) 5wn = random(objnums); 6what = toobj(wn); 7endwhile 8desc = what.description; 9if (typeof(desc) == LIST) 10desc = desc[random(length(desc))]; 11endif 12dl = $su:explode(desc, " "); 13w = ""; 14nwords = length(dl); 15tries = 0; 16while ((length(w) < 3) && (tries < nwords)) 17w = dl[random(nwords)]; 18tries = tries + 1; 19endwhile 20if (length(w) >= 3) 21w = $su:strip_chars(w, ".?!,"); 22w = $su:lowercase(w); 23return w; 24endif 25$cu:sin(); 26endwhile
nn_tb
Referenced by
none
Source
1what = args[1]; 2if (valid(what)) 3return (what.name + " ") + tostr(what); 4endif
strip_binary
Referenced by
none
Source
1if (length(args) != 1) 2raise(E_ARGS); 3endif 4s = args[1]; 5bin = decode_binary(s); 6safe_s = ""; 7for b in (bin) 8if (typeof(b) == STR) 9safe_s = safe_s + b; 10endif 11endfor 12return safe_s;
last_word_start
Referenced by
none
Source
1"This breaks up the argument string into words, returning a list of indices into argstr corresponding to the starting points of each of the arguments."; 2rest = args[1]; 3threshold = (length(args) > 1) ? args[2] | 0; 4"... find first nonspace..."; 5wend = rmatch(rest, "[^ ]%|^")[1]; 6rest = rest[1..wend]; 7if (!rest) 8return {}; 9endif 10pattern = "%(^%|[^ ]+%)%([ ]+%)"; 11while (rest) 12m = rmatch(rest, pattern); 13if (!m) 14return {}; 15endif 16if ((!threshold) || (wend <= threshold)) 17return {m[3][2][2] + 1, wend}; 18endif 19rest = rest[1..m[1]]; 20endwhile 21return {};
gibberish
Referenced by
none
Source
1msg = args[1]; 2if (typeof(msg) == INT) 3wordcount = msg; 4else 5wordcount = min(max(3, length(msg) / 5), 16); 6endif 7words = {}; 8for i in [1..wordcount] 9words = setadd(words, $su:random_word()); 10endfor 11return $su:from_list(words, " ");
merge
Referenced by
none
Source
1"Merge two paragraphs with 'join' between them."; 2"i.e., $su:merge({\"Bob is cool.\"}, {\"This sucks.\",\"The end.\"}, \"and\")"; 3" => {\"Bob is cool, and this sucks.\", \"The end.\"}"; 4{first, second, join} = args; 5first_endline = first[$]; 6second_firstline = second[1]; 7merged = ""; 8if (first_endline[$] == ".") 9first_endline[$] = ","; 10endif 11`second_firstline[1] = $su:lowercase(second_firstline[1]) ! E_RANGE'; 12merged = tostr(first_endline, join ? tostr(" ", join, " ") | " ", second_firstline); 13return {@first[1..$ - 1], merged, @second[2..$]};
make_table
Referenced by
- #6:list_prefs line 17:
$su:make_table - #6:list_pref_categories line 18:
$su:make_table - #50:find_property line 28:
$su:make_table - #50:find_verb line 28:
$su:make_table - #253:_changelog_object line 21:
$su:make_table - #253:_changelog_verb line 16:
$su:make_table - #253:_changelog_all line 28:
$su:make_table - #253:_changelog_critical line 39:
$su:make_table - #317:@topitems line 16:
$su:make_table - #317:@topvalues line 17:
$su:make_table - #326:print_report line 14:
$su:make_table - #326:print_report line 29:
$su:make_table
Source
1":make_table(LIST|STR header_colors, LIST headers, LIST|STR row_colors, LIST rows, LIST row_widths)"; 2" => a very nice table, as a list of strings to be fed to e.g. :tell_lines."; 3" look #469417 for documentation."; 4{header_colors, headers, row_colors, rows, row_widths} = args; 5n_cols = length(row_widths); 6table = {}; 7"First, the header"; 8multirow_header = typeof(headers[1]) == LIST; 9if (!multirow_header) 10header_colors = {header_colors}; 11headers = {headers}; 12endif 13for line_idx in [1..length(headers)] 14colors = header_colors[line_idx]; 15color = ""; 16if (typeof(colors) != LIST) 17color = colors; 18endif 19line = headers[line_idx]; 20string = ""; 21for i in [1..n_cols] 22string = ((string + (color ? color | colors[i])) + $su:left(line[i], -row_widths[i])) + ((i != n_cols) ? " " | $ansi.reset); 23endfor 24table = {@table, string}; 25endfor 26color = ""; 27if (typeof(row_colors) != LIST) 28color = row_colors; 29endif 30for data_idx in [1..length(rows)] 31row = rows[data_idx]; 32string = ""; 33for i in [1..n_cols] 34string = ((string + (color ? color | row_colors[i])) + $su:left(row[i], -row_widths[i])) + ((i != n_cols) ? " " | $ansi.reset); 35endfor 36table = {@table, string}; 37$cu:sin(); 38endfor 39table[$] = table[$] + $ansi.reset; 40return table;
word_wrap
Referenced by
- #6:notify line 59:
$su:word_wrap - #38:display_message_improved line 19:
$su:word_wrap - #38:display_message_improved line 20:
$su:word_wrap - #38:display_message_improved line 48:
$su:word_wrap - #38:display_message_improved line 56:
$su:word_wrap - #263:wrap_for_screen line 6:
$su:word_wrap - #293:txt_log line 13:
$su:word_wrap - #293:txt_log line 24:
$su:word_wrap - #293:extra_text line 31:
$su:word_wrap - #293:extra_text line 33:
$su:word_wrap - #293:old_txt_log line 12:
$su:word_wrap
Source
1"$su:word_wrap(LIST lines, INT linelength [, STR color [, STR suspend_text]])"; 2" => LIST of lines wrapped at linelength."; 3{in_lines, linelen, ?color = "", ?suspend_text = ""} = args; 4broken_lines = {}; 5idx = 0; 6currlen = 0; 7indent = 2; 8indspace = " "; 9for line in (in_lines) 10broken_lines = {@broken_lines, ""}; 11idx = idx + 1; 12currlen = 0; 13for word in ($su:_splitwords(line)) 14wordlen = length($ansi:strip(word)); 15realwordlen = (rwl = index($ansi:strip(word), " ")) ? rwl - 1 | length($ansi:strip(word)); 16while (realwordlen > linelen) 17subword = word[1..linelen]; 18word = word[linelen + 1..$]; 19broken_lines[idx] = subword; 20idx = idx + 1; 21broken_lines = {@broken_lines, indspace}; 22currlen = indent; 23realwordlen = (rwl = index($ansi:strip(word), " ")) ? rwl - 1 | length($ansi:strip(word)); 24endwhile 25if (!currlen) 26broken_lines[idx] = word; 27currlen = wordlen; 28elseif ((currlen + wordlen) < linelen) 29broken_lines[idx] = broken_lines[idx] + word; 30currlen = currlen + wordlen; 31elseif ((currlen + realwordlen) < linelen) 32broken_lines[idx] = broken_lines[idx] + word[1..realwordlen]; 33idx = idx + 1; 34broken_lines = {@broken_lines, indspace}; 35currlen = indent; 36else 37idx = idx + 1; 38broken_lines = {@broken_lines, indspace + word}; 39currlen = wordlen + indent; 40endif 41$cu:sin(1, suspend_text); 42endfor 43endfor 44if (!color) 45return broken_lines; 46endif 47for i in [1..length(broken_lines)] 48broken_lines[i] = (color + broken_lines[i]) + $ansi.reset; 49endfor 50return broken_lines;
_splitwords
Referenced by
- #20:word_wrap line 13:
$su:_splitwords
Source
1":_splitwords(STR s) => LIST words -- split and include trailing space."; 2{s} = args; 3if (!s) 4return {}; 5endif 6s = " " + s; 7words = {}; 8lasti = length(s); 9while (s) 10i = rindex(s[1..lasti - 1], " "); 11if ((i == 1) || ((lasti - i) > 1)) 12words = {s[i + 1..$], @words}; 13s = s[1..i]; 14endif 15if (i == 1) 16break; 17endif 18lasti = i; 19yield 0; 20endwhile 21return words;
colorize colourize c
Referenced by
none
Source
1":colorize(STR text, [LIST colors]) => colored text"; 2(((" example: $su:colorize(\"/rhello\") => \"" + $ansi.red) + "hello") + $ansi.reset) + "\""; 3" available colors: /R, /G, /B, /C, /M, /Y, /K"; 4" /r, /g, /b, /c, /m, /y, /w"; 5" also callable as 'colourize'."; 6" restrict it to certain colors by passing them as a list (of strings) as the second argument, e.g. {\"red\", \"green\"}. E_INVARG is raised if a color is used which doesn't appear in the list."; 7{intext, ?ok_cols = {}} = args; 8color_subs = {}; 9if (ok_cols) 10ok_letters = {}; 11for col in (ok_cols) 12sub = $lu:assoc(col, this.color_subs); 13ok_letters = {@ok_letters, sub[2][2]}; 14color_subs = {@color_subs, sub}; 15endfor 16split = $su:explode(intext, "/"); 17for word in (split) 18if (length(word)) 19letter = word[1]; 20if (!(letter in ok_letters)) 21raise(E_INVARG, tostr("/", letter)); 22return E_INVARG; 23endif 24endif 25endfor 26else 27color_subs = this.color_subs; 28endif 29color_subs = $lu:slice(color_subs, {2, 3}); 30colorized = $su:subst(intext, color_subs, 1) + $ansi.reset; 31return colorized;
highlight_words
Referenced by
- #106:_compile line 21:
$su:highlight_words - #106:_compile line 27:
$su:highlight_words - #106:_compile line 30:
$su:highlight_words - #106:_compile line 33:
$su:highlight_words
Source
1"(STR text, LIST words) => highlight all words in text"; 2text = args[1]; 3words = args[2]; 4lines = (typeof(text) == LIST) ? text | {text}; 5newlines = {}; 6for text in (lines) 7newtext = ""; 8for w in ($su:explode(text)) 9ws = $su:strip_chars(w, "?!.,"); 10if (ws in words) 11newtext = (newtext + ((" " + $ansi.bold_on) + w)) + $ansi.reset; 12else 13newtext = (newtext + " ") + w; 14endif 15endfor 16newtext = newtext[2..$]; 17newlines = {@newlines, newtext}; 18endfor 19return (typeof(args[1]) == LIST) ? newlines | newlines[1];
fast_words
Referenced by
- #3:tell_map line 66:
$su:fast_words - #3:tell_map_backup line 58:
$su:fast_words - #3:tell_map_old line 61:
$su:fast_words - #33:ready line 29:
$su:fast_words
Source
1text = args[1]; 2sep = (length(args) > 1) ? args[2] | " "; 3sepl = length(sep); 4w = {}; 5while (text) 6space = index(text, sep); 7if (!space) 8w = listappend(w, text); 9text = ""; 10else 11w = listappend(w, word = text[1..space - 1]); 12if (length(text) >= (next = (length(word) + sepl) + 1)) 13text = text[next..$]; 14else 15text = ""; 16endif 17endif 18endwhile 19return w;
re_sub*stitute
Referenced by
none
Source
1":re_sub(STR target, { {regex1, repl1}, ... }, [INT case_sensitive]) => STR result"; 2{s, tuples, ?case_sensitive = 0} = args; 3for tuple in (tuples) 4{regex, repl} = tuple; 5start_s = s; 6while (matches = match(s, regex, case_sensitive)) 7result = substitute(repl, matches); 8matchtext = s[matches[1]..matches[2]]; 9if ((length(matchtext) > 1) && (strcmp(matchtext, $su:uppercase(matchtext)) == 0)) 10s[matches[1]..matches[2]] = $su:uppercase(result); 11else 12s[matches[1]..matches[2]] = result; 13endif 14if (s == start_s) 15break; 16endif 17start_s = s; 18endwhile 19endfor 20return s;
smart_abbrev
Referenced by
- #37:folder_and_message line 12:
$su:smart_abbrev - #37:folder_and_message_and_subject line 12:
$su:smart_abbrev - #256:tree_tag line 26:
$su:smart_abbrev - #293:msg_summary_line line 23:
$su:smart_abbrev - #317:@whohas line 85:
$su:smart_abbrev - #317:_bigtree line 27:
$su:smart_abbrev - #317:tell_for_ex line 21:
$su:smart_abbrev
Source
1":smart_abbrev(STR/LIST string(s), [INT eachbelow, INT totalbelow]) => STR/LIST abbreviated."; 2" Eliminates articles like 'the', 'an', 'pair of', then shortens non-final words, then, as a last resort, turns strings into initials. Will try to get each string in the list below 'eachbelow', and the total length of all strings below 'totalbelow'."; 3{given, ?eachbelow = 0, ?totalbelow = 0} = args; 4givenlist = typeof(given) == LIST; 5l = givenlist ? given | {given}; 6orig = l; 7len = length(l); 8for phase in [1..4] 9phaseverb = tostr("_", verb, "_", phase); 10each_ok = 1; 11total_ok = (phase != 1) && (strslen < totalbelow); 12strslen = 0; 13for i in [1..len] 14if (total_ok && (length(l[i]) < eachbelow)) 15"total is ok, and this one is fine, so skip it"; 16else 17l[i] = this:(phaseverb)(l[i]); 18if (!l[i]) 19#7195:tell("smart_abbrev] :", phaseverb, " returned 0 length string for '", orig[i], "'"); 20endif 21endif 22strslen = strslen + length(l[i]); 23if (eachbelow && (length(l[i]) >= eachbelow)) 24each_ok = 0; 25endif 26endfor 27if (((phase == 2) && (!totalbelow)) && each_ok) 28"return here if we didn't get totalbelow"; 29return givenlist ? l | l[1]; 30endif 31if (each_ok && (strslen < totalbelow)) 32return givenlist ? l | l[1]; 33endif 34endfor 35return givenlist ? l | l[1];
metaphone
Referenced by
- #20:properties_like line 3:
this:metaphone - #20:properties_like line 15:
this:metaphone
Source
1":metaphone(word) => special awesome code"; 2{name} = args; 3metaph = ""; 4ename = ""; 5wname = ""; 6VOWELS = "AEIOU"; 7FRONTV = "EIY"; 8VARSON = "CSPTG"; 9excpPAIR = "AGKPW"; 10nextLTR = "ENNNR"; 11for i in [1..length(name)] 12if ((idx = index("abcdefghijklmnopqrstuvwxyz", name[i])) || (idx = index("ABCDEFGHIJKLMNOPQRSTUVWXYZ", name[i]))) 13ename = ename + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[idx]; 14endif 15endfor 16if (!ename) 17return ""; 18endif 19"ae,gn,kn,pn,wr -> drop first letter"; 20if (idx = index(excpPAIR, ename[1])) 21if (ename[2] == nextLTR[idx]) 22ename = ename[2..$]; 23endif 24endif 25if (ename[1] == "X") 26ename[1] = "S"; 27endif 28if ((length(ename) > 1) && (ename[1..2] == "WH")) 29ename[2..$] = ename[3..$]; 30endif 31len = length(ename); 32for i in [1..len] 33curLtr = ename[i]; 34vowelBefore = 0; 35prevLtr = " "; 36if (i > 1) 37prevLtr = ename[i - 1]; 38vowelBefore = index(VOWELS, prevLtr); 39endif 40"keep initial vowel"; 41if ((i == 1) && index(VOWELS, curLtr)) 42metaph = metaph + curLtr; 43continue; 44endif 45vowelAfter = 0; 46frontvAfter = 0; 47nextLTR = ""; 48if (i < len) 49nextLTR = ename[i + 1]; 50vowelAfter = index(VOWELS, nextLTR); 51frontvAfter = index(FRONTV, nextLTR); 52endif 53"skip doubles"; 54if (curLtr == nextLTR) 55continue; 56endif 57nextLtr2 = ""; 58nextLtr3 = ""; 59if (i < (len - 1)) 60nextLtr2 = ename[i + 2]; 61if (i < (len - 2)) 62nextLtr3 = ename[i + 3]; 63endif 64endif 65if (curLtr == "B") 66if (!((i == len) && (prevLtr == "M"))) 67metaph = metaph + curLtr; 68endif 69elseif (curLtr == "C") 70if (!(((i > 1) && (prevLtr == "S")) && frontvAfter)) 71if (((i > 1) && (nextLTR == "I")) && (nextLtr2 == "A")) 72metaph = metaph + "X"; 73elseif (frontvAfter) 74metaph = metaph + "S"; 75elseif (((i > 1) && (prevLtr == "S")) && (nextLTR == "H")) 76metaph = metaph + "K"; 77elseif (nextLTR == "H") 78if ((i == 1) && (!index(VOWELS, nextLtr2))) 79metaph = metaph + "K"; 80else 81metaph = metaph + "X"; 82endif 83elseif (prevLtr == "C") 84metaph = metaph + "S"; 85else 86metaph = metaph + "K"; 87endif 88endif 89elseif (curLtr == "D") 90if (((prevLtr == "N") && (nextLTR == "S")) && (i == (len - 1))) 910; 92elseif ((nextLTR == "G") && index(FRONTV, nextLtr2)) 93metaph = metaph + "J"; 94else 95metaph = metaph + "T"; 96endif 97elseif (curLtr == "G") 98if (((i < (len - 1)) && (nextLTR == "H")) && index(VOWELS, nextLtr2)) 990; 100elseif ((((i == (len - 3)) && (nextLTR == "N")) && (nextLtr2 == "E")) && (nextLtr3 == "D")) 1010; 102elseif ((i == (len - 1)) && (nextLTR == "N")) 1030; 104elseif ((prevLtr == "D") && frontvAfter) 1050; 106elseif ((prevLtr != "G") && frontvAfter) 107metaph = metaph + "J"; 108else 109metaph = metaph + "K"; 110endif 111elseif (curLtr == "H") 112if (index(VARSON, prevLtr) || (vowelBefore && (!vowelAfter))) 1130; 114else 115metaph = metaph + "H"; 116endif 117elseif (curLtr in {"F", "J", "L", "M", "N", "R"}) 118metaph = metaph + curLtr; 119elseif (curLtr == "K") 120if (prevLtr != "C") 121metaph = metaph + "K"; 122endif 123elseif (curLtr == "P") 124metaph = metaph + ((nextLTR == "H") ? "F" | "P"); 125elseif (curLtr == "Q") 126metaph = metaph + "K"; 127elseif (curLtr == "S") 128if (((i > 1) && (nextLTR == "I")) && (nextLtr2 in {"O", "A"})) 129metaph = metaph + "X"; 130else 131metaph = metaph + ((nextLTR == "H") ? "X" | "S"); 132endif 133elseif (curLtr == "T") 134if (((i > 1) && (nextLTR == "I")) && (nextLtr2 in {"O", "A"})) 135metaph = metaph + "X"; 136elseif (nextLTR == "H") 137metaph = metaph + "0"; 138elseif (!(((i < (len - 2)) && (nextLTR == "C")) && (nextLtr2 == "H"))) 139metaph = metaph + "T"; 140endif 141elseif (curLtr == "V") 142metaph = metaph + "F"; 143elseif (curLtr in {"W", "Y"}) 144if ((i < len) && vowelAfter) 145metaph = metaph + curLtr; 146endif 147elseif (curLtr == "X") 148metaph = metaph + "KS"; 149elseif (curLtr == "Z") 150metaph = metaph + "S"; 151endif 152endfor 153return metaph;
properties_like
Referenced by
- #100:help line 28:
$su:properties_like
Source
1":properties_like(OBJ on what, STR like what) => LIST props"; 2{what, match} = args; 3metamatch = this:metaphone(match); 4l = {}; 5cache = this.proplikecache; 6props = properties(what); 7metamap = {}; 8if (cache && (cache[1..2] == {what, length(props)})) 9metamap = cache[3..$]; 10else 11for p in (props) 12if (p[1] == "_") 13continue; 14endif 15meta = this:metaphone(p); 16metamap = {@metamap, {meta, p}}; 17$cu:sin(); 18endfor 19this.proplikecache = {what, length(props), @metamap}; 20endif 21for m in (metamap) 22if (metamatch == m[1]) 23l = {@l, m[2]}; 24endif 25endfor 26return l;
index_any
Referenced by
- #20:_smart_abbrev_2 line 5:
$su:index_any - #20:_smart_abbrev_2 line 20:
$su:index_any - #20:_smart_abbrev_2 line 22:
$su:index_any
Source
1":index_any(STR check, STR targets) => INT first index"; 2"finds the index of the first occurence of any character in 'targets'."; 3" e.g. $su:index_any(\"hamburger\", \"aeiou\") => 2"; 4{check, targets} = args; 5for i in [1..length(check)] 6if (index(targets, check[i])) 7return i; 8endif 9endfor 10return 0;
_smart_abbrev_1
Referenced by
none
Source
1return $su:re_sub(args[1], {{"%bpair of +", ""}, {"%bthe +", ""}, {"%ban? +", ""}, {" +and +", "&"}});
_smart_abbrev_2
Referenced by
none
Source
1{l} = args; 2rem = l; 3did_one = 0; 4txns = {}; 5while ((brk = $su:index_any(rem, " -&'")) || (!did_one)) 6if (!brk) 7"first word == last word"; 8spc = ""; 9word = rem; 10rem = ""; 11else 12spc = rem[brk]; 13word = rem[1..brk - 1]; 14rem = rem[brk + 1..$]; 15endif 16orig_word = word; 17"e.g. alcohol => alc, creature => cr, soda => soda"; 18if (tostr(tonum(word)) == word) 19"don't do anything, it's a number"; 20elseif (vowel = $su:index_any(word[2..$], "aeiou")) 21if (vowel == 1) 22vowel = $su:index_any(word[3..$], "aeiou"); 23vowel = vowel ? vowel + 2 | 2; 24else 25vowel = vowel + 1; 26endif 27if (vowel && (vowel != length(word))) 28word = word[1..vowel - 1]; 29endif 30endif 31did_one = 1; 32txns = {@txns, {orig_word != word, length(word), word, spc}}; 33endwhile 34if (rem) 35txns = {@txns, {0, length(rem), rem, ""}}; 36endif 37gather = ""; 38gspc = ""; 39result = ""; 40for txn in (txns) 41if (txn[1..2] == {1, 1}) 42"length 1, changed"; 43gather = gather + txn[3]; 44gspc = txn[4]; 45else 46"not"; 47if (gather) 48result = (result + gather) + gspc; 49gather = gspc = ""; 50endif 51result = (result + txn[3]) + txn[4]; 52endif 53endfor 54if (!result) 55result = gather; 56endif 57return result;
_smart_abbrev_3
Referenced by
none
Source
1return $su:re_sub(args[1], {{"%b%([a-zA-Z]%)[a-zA-Z]+[ -]", "%1 "}});
_smart_abbrev_4
Referenced by
none
Source
1return $su:re_sub(args[1], {{"%b%([a-zA-Z]%)[a-zA-Z]+%b", "%1"}, {" +", ""}});
english_list_bold
Referenced by
- #98:aggregate_names_bold line 14:
$su:english_list_bold
Source
1"Copied from string utilities (#20):english_list by Hacker (#36) Fri Mar 27 03:39:15 2009 CDT"; 2"Prints the argument (must be a list) as an english list, e.g. {1, 2, 3} is printed as \"1, 2, and 3\", and {1, 2} is printed as \"1 and 2\"."; 3"Optional arguments are treated as follows:"; 4" Second argument is the string to use when the empty list is given. The default is \"nothing\"."; 5" Third argument is the string to use in place of \" and \". A typical application might be to use \" or \" instead."; 6" Fourth argument is the string to use instead of a comma (and space). Gary_Severn's deranged mind actually came up with an application for this. You can ask him."; 7" Fifth argument is a string to use after the penultimate element before the \" and \". The default is to have a comma without a space."; 8{things, ?nothingstr = "nothing", ?andstr = " and ", ?commastr = ", ", ?finalcommastr = ","} = args; 9nothingstr = "nothing"; 10"This is a horrible shitty hack and I apologize to whoever is reading this. I've wronged us both."; 11nthings = length(things); 12bold = {}; 13for x in (things) 14bold = {@bold, ($ansi.bold_on + tostr(x)) + $ansi.bold_off}; 15endfor 16things = bold; 17if (nthings == 0) 18r = nothingstr; 19elseif (nthings == 1) 20r = tostr(things[1]); 21elseif (nthings == 2) 22r = tostr(things[1], andstr, things[2]); 23else 24ret = ""; 25for k in [1..nthings - 1] 26if (k == (nthings - 1)) 27commastr = finalcommastr; 28endif 29ret = tostr(ret, things[k], commastr); 30endfor 31r = tostr(ret, andstr, things[nthings]); 32endif 33return r;
repeat
Referenced by
none
Source
1{n, what} = args; 2if (n > 250) 3raise(E_INVARG, "n too large in $su:repeat"); 4endif 5s = ""; 6for i in [1..n] 7s = s + what; 8endfor 9return s;
uncapitalize
Referenced by
none
Source
1"Copied from string utilities (#20):capitalize by Hacker (#36) Sun Jun 28 02:45:29 2009 CDT"; 2"capitalizes its argument."; 3if (string = args[1]) 4ansi = 0; 5for i in [1..length(string)] 6if (string[i] == "~") 7ansi = 1; 8elseif (ansi && (string[i] == "m")) 9ansi = 0; 10elseif (!ansi) 11if (testi = index("ABCDEFGHIJKLMNOPQRSTUVWXYZ", string[i], 0)) 12string[i] = "abcdefghijklmnopqrstuvwxyz"[testi]; 13return string; 14endif 15endif 16endfor 17endif 18return string;
encrypt decrypt
Referenced by
- #130:radio_receive line 4:
$su:decrypt - #285:transmit line 15:
$su:encrypt - #285:xmit_with_xyz line 58:
$su:encrypt
Source
1":encrypt/:decrypt(STR, KEY) => Encrypt or decrypt 'STR' with KEY. In both cases, the process is reversible. A zero-length means that STR will be returned verbatim."; 2if (verb == "decrypt") 3args = {@args, 1}; 4return this:crypto(@args); 5else 6return this:crypto(@args); 7endif
_tohash
Referenced by
- #20:to_value line 4:
this:_tohash
Source
1"_tohash(string) -- auxiliary for :to_value()"; 2rest = this:triml(args[1]); 3vhash = []; 4if (!rest) 5return {0, []}; 6elseif (rest[1] == "]") 7return {rest[2..$], []}; 8endif 9while (1) 10rlen = length(rest); 11key = 0; 12if (rest[1] == "\"") 13result = this:_unquote(rest[2..rlen]); 14if (typeof(result[1] == INT)) 15return result; 16endif 17key = result[2]; 18rest = result[1]; 19if (!rest) 20return {0, ""}; 21endif 22key_end = index(rest, "->"); 23if (!key_end) 24return {rlen, "missing arrow '->' in hash entry definition"}; 25endif 26rest = rest[key_end + 2..$]; 27elseif (w = index("{[", rest[1])) 28return {rlen, "hash key cannot be list or hash"}; 29else 30key_end = index(rest, "->"); 31if (!key_end) 32return {rlen, "missing arrow '->' in hash entry definition"}; 33endif 34thing = rest[1..key_end - 1]; 35if (typeof(s = this:_toscalar(thing)) == STR) 36return {rlen, s}; 37endif 38key = s; 39rest = rest[key_end + 2..rlen]; 40endif 41val = 0; 42rest = this:triml(rest); 43rlen = length(rest); 44if (w = index("{[\"", rest[1])) 45result = this:({"_tolist", "_tohash", "_unquote"}[w])(rest[2..rlen]); 46if (typeof(result[1] == INT)) 47return result; 48endif 49val = result[2]; 50rest = result[1]; 51else 52val = rest[1..vlen = min(index(rest + ",", ","), index(rest + "]", "]")) - 1]; 53if (typeof(s = this:_toscalar(val)) == STR) 54return {rlen, s}; 55endif 56val = s; 57rest = rest[vlen + 1..rlen]; 58endif 59vhash[key] = val; 60rest = this:triml(rest); 61if (!rest) 62return {0, vhash}; 63elseif (rest[1] == "]") 64return {rest[2..$], vhash}; 65elseif (rest[1] == ",") 66rest = this:triml(rest[2..$]); 67else 68return {length(rest), ", or ] expected"}; 69endif 70endwhile
crapsum
Referenced by
none
Source
1{text, key, ?limit = 999} = args; 2if (!key) 3raise(E_INVARG, "key is required"); 4else 5sum = length(text); 6for i in [1..length(key)] 7sum = sum + $su:to_ascii(key[i]); 8$cu:sin(); 9endfor 10state = $rng:make_state(sum); 11result = limit; 12for i in [1..length(text)] 13{v, state} = $rng:random(limit, state); 14result = (result + v) - $su:to_ascii(text[i]); 15endfor 16return mod(abs(result), limit); 17endif
new_encrypt new_decrypt
Referenced by
none
Source
1":encrypt/:decrypt(STR, KEY) => Encrypt or decrypt 'STR' with KEY. In both cases, the process is reversible. A zero-length means that STR will be returned verbatim."; 2{s, key} = args; 3if (!key) 4return s; 5elseif (length(s) > 3000) 6raise(E_INVARG, "string too long"); 7else 8rnd_a = 16807; 9rnd_m = $maxint; 10rnd_state = 1; 11ascii = $su.ascii; 12keysum = length(s); 13k = length(ascii); 14for i in [1..length(key)] 15keysum = keysum + index(ascii, key[i], 1); 16endfor 17result = ""; 18for i in [1..length(s)] 19rnd_state = mod(rnd_a * rnd_state, rnd_m); 20v = mod(rnd_state, 64) + 1; 21if (verb == "new_decrypt") 22c = (index(ascii, s[i], 1) - v) - 2; 23else 24c = index(ascii, s[i], 1) + v; 25endif 26result = result + ascii[mod(c, k) + 1]; 27endfor 28return result; 29endif
format_bytesize
Referenced by
- #50:paramedic line 130:
$su:format_bytesize - #50:paramedic line 132:
$su:format_bytesize
Source
1":format_bytesize(INT bytes) => STR formatted nicely. e.g., 49394 => 48k."; 2{b} = args; 3if (!b) 4return "0b"; 5endif 6minus = b < 0; 7b = abs(b); 8if (b > 943718400) 9"over 900mb"; 10gb = tofloat(b) / 1073741824.0; 11s = floatstr(gb, 1) + "g"; 12elseif (b >= 1048576) 13"1mb+"; 14mb = tofloat(b) / 1048576.0; 15s = floatstr(mb, 0) + "m"; 16elseif (b >= 1024) 17"1kb+"; 18kb = tofloat(b) / 1024.0; 19s = floatstr(kb, 0) + "k"; 20else 21s = tostr(b, "b"); 22endif 23return tostr(minus ? "-" | "", s);
crypto
Referenced by
- #20:encrypt line 4:
this:crypto - #20:encrypt line 6:
this:crypto
Source
1":crypto(STR s, STR key [, INT decrypt]) => STR encrypted/decrypted."; 2ascii = this.ascii; 3{s, key, ?decrypt = 0} = args; 4if (!key) 5return s; 6endif 7strlen = length(s); 8keysum = strlen; 9for i in [1..length(key)] 10keysum = (keysum + index(ascii, key[i], 1)) + 31; 11endfor 12state = keysum; 13result = ""; 14for i in [1..strlen] 15state = mod(16807 * state, 2147483647); 16val = mod(state, 64) + 1; 17if (decrypt) 18c = (index(ascii, s[i], 1) - val) - 2; 19else 20c = index(ascii, s[i], 1) + val; 21endif 22result = result + ascii[mod(c, 95) + 1]; 23endfor 24return result;
columnize_horiz*ontal
Referenced by
none
Source
1"columnize_horiz*ontal (items, n [, width[, hard]]) - Just like $su:columnize, but values go left-to-right first."; 2{items, n, ?width = 79, ?hard = 0, ?highlight = 0} = args; 3height = ((length(items) + n) - 1) / n; 4colwidths = {}; 5for col in [1..n] 6colwidths = {@colwidths, 1 - (((width + 1) * col) / n)}; 7endfor 8result = {}; 9bright = 1; 10for row in [1..height] 11row_items = items[1 + ((row - 1) * n)..min($, row * n)]; 12n_for_row = min(length(row_items), n); 13if (highlight) 14bright = !bright; 15line = bright ? $ansi.bold_on | $ansi.reset; 16else 17line = ""; 18endif 19for col in [1..n_for_row] 20col_item = tostr(row_items[col]); 21line = this:left((line + " ") + col_item, colwidths[col]); 22endfor 23diff = length(line) - length($ansi:strip(line)); 24line = line[1..min($, width + diff)] + $ansi.reset; 25result = {@result, line}; 26yield; 27endfor 28return result;
reverse_nn rev_nn
Referenced by
- #317:@compare line 30:
$su:rev_nn - #317:@compare line 84:
$su:rev_nn - #317:@compare line 148:
$su:rev_nn
Source
1o = args[1]; 2return tostr(o, " (", `o.name ! E_INVIND => "<invalid>"', ")");
spr*intf pr*intf
Referenced by
none
Source
1" :spr*intf (STR before, value1, value2, ...) => 'before' formatted"; 2" :pr*intf (OBJ who, STR, value1, value2, ...) => Same as sprintf, but :tell()s 'who' the result"; 3""; 4"This verb is a 'copy' of C's sprintf() function. There is documentation on sprintf"; 5" in numerous places, such as here:"; 6""; 7"http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/"; 8""; 9"Note that this is unfinished, and shouldn't be used for output players will see (yet)."; 10"Also, a number of functions of the original sprintf wouldn't make any sense here - e.g.,"; 11" MOO is not made to deal with memory addresses, so the %p specifier (for fetching the"; 12" value that a pointer 'points' to) would be entirely useless, as well as (to my knowledge)"; 13" impossible to implement via MOO's programming language alone."; 14""; 15"The %s, %d, %i, %f, %c, and %% specifiers are supported, of course, but there are also"; 16" some changes:"; 17" %s Normal if given a string; provided with a list, picks one element at random. Ex:"; 18" sprintf(\"%s\", {\"True\", \"False\"}) => \"True\" OR \"False\""; 19" %o Takes an object and returns the effect of tostr(object). The '#' option"; 20" makes this display *without* the usual '#' seen in front (e.g. #1 => 1)."; 21""; 22" ~ Irony"; 23if (verb[1..2] == "pr") 24{who, string, @repl} = args; 25(typeof(who) == OBJ) || raise(E_INVARG); 26offset = 2; 27else 28{string, @repl} = args; 29who = 1; 30offset = 1; 31endif 32SPECIFIERS = ["s" -> {STR, LIST}, "d" -> {INT}, "i" -> {INT}, "f" -> {FLOAT}, "o" -> {OBJ}, "c" -> {INT}]; 33SPECIFIER_KEYS = "sdifoc"; 34OPTIONS = "-+ #0"; 35CAN_OPTIONS = "-+ #0123456789."; 36FLOATLEN = 19; 37"opt: 1: -, 2: +, 3: (space), 4: #, 5: 0"; 38dopt = opt = {0, 0, 0, 0, 0}; 39types = E_NONE; 40newstring = text = ""; 41on = pos = prec = len = 0; 42strlen = length(string); 43while ((pos = pos + 1) <= strlen) 44if (string[pos] != "%") 45newstring = newstring + string[pos]; 46continue; 47elseif (string[pos..min(pos + 1, $)] == "%%") 48newstring = newstring + "%"; 49pos = pos + 1; 50continue; 51endif 52char = string[pos = pos + 1]; 53while (index(CAN_OPTIONS, char)) 54if ((!(len || prec)) && (o = index(OPTIONS, char))) 55opt[o] = 1; 56elseif (((val = decode_binary(char, 1)[1] - 48) > -1) && (val < 10)) 57if ((prec > 0) || (string[pos - 1] == ".")) 58prec = (prec * 10) + val; 59else 60len = (len * 10) + val; 61endif 62endif 63char = string[pos = pos + 1]; 64endwhile 65if (index(SPECIFIER_KEYS, char, 1)) 66types = SPECIFIERS[char]; 67`sub = repl[on = on + 1] ! E_RANGE => raise(E_ARGS)'; 68if (!(typeof(sub) in types)) 69errmsg = tostr("args[", on + offset, "] is invalid: %", char, " does not accept an argument of type ", $code_utils:type_str(sub)); 70raise(E_TYPE, errmsg); 71elseif (equal("s", char)) 72if (typeof(sub) == LIST) 73text = sub[random($)]; 74else 75text = sub; 76endif 77(prec > 0) && (text = text[1..min(prec, $)]); 78elseif (equal("f", char)) 79text = floatstr(sub, (sub % 1.0) ? FLOATLEN | (opt[4] ? prec || length(tostr(sub)) | 0)); 80elseif (index("di", char, 1) && (prec > length(tostr(sub)))) 81text = $su:right(sub, prec, "0"); 82elseif (equal("o", char)) 83text = tostr(sub)[1 + opt[4]..$]; 84elseif (equal("c", char)) 85text = encode_binary(sub); 86prec = len = 0; 87else 88text = tostr(sub); 89endif 90else 91errmsg = tostr("Invalid specifier '%", char, "'"); 92raise(E_INVARG, errmsg); 93endif 94if (index("dif", char, 1)) 95if (opt[2] && (sub > ((typeof(sub) == INT) ? 0 | 0.0))) 96text = "+" + text; 97elseif (opt[3] && (!sub)) 98text = " " + text; 99endif 100endif 101if (len) 102text = $su:(opt[1] ? "left" | "right")(text, len, opt[5] ? "0" | " "); 103endif 104opt = dopt; 105prec = len = 0; 106newstring = newstring + text; 107endwhile 108(typeof(who) == OBJ) && who:tell(newstring); 109return newstring;
capitalize_words
Referenced by
- #114:dname line 2:
$su:capitalize_words
Source
1s = args[1]; 2ns = ""; 3space = 1; 4for i in [1..length(s)] 5ch = s[i]; 6if ((ch == " ") || (ch == "-")) 7space = 1; 8ns = ns + ch; 9elseif (!space) 10ns = ns + ch; 11elseif (charnum = index("abcdefghijklmnopqrstuvwxyz", ch)) 12ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[charnum]; 13ns = ns + ch; 14space = 0; 15else 16ns = ns + ch; 17space = 0; 18endif 19endfor 20return ns;
superview sv
Referenced by
- #20:superview line 10:
this:superview - #20:superview line 18:
$su:superview - #20:superview line 18:
this:superview - #92:process_queue line 149:
$su:sv
Source
1v = args[1]; 2m = ""; 3reset = $ansi.reset; 4if (typeof(v) == LIST) 5m = ($ansi.yellow + "{") + $ansi.white; 6first = 1; 7for x in (v) 8m = m + (first ? "" | (($ansi.yellow + ", ") + $ansi.white)); 9first = 0; 10m = m + this:superview(x); 11endfor 12m = m + ($ansi.yellow + "}"); 13elseif (typeof(v) == HASH) 14m = ((col = $ansi.bold_on + $ansi.yellow) + "[") + reset; 15first = 1; 16for kvp in (v) 17{k, v} = kvp; 18m = (((((m + (first ? "" | ((col + ", ") + $ansi.reset))) + $su:superview(k)) + col) + " -> ") + reset) + this:superview(v); 19first = 0; 20endfor 21m = ((m + col) + "]") + reset; 22elseif ((typeof(v) == OBJ) && valid(v)) 23m = ((((($ansi.cyan + v.name) + " (") + $ansi.bold_on) + tostr(v)) + $ansi.bold_off) + ")"; 24elseif (typeof(v) == OBJ) 25m = $ansi.red + tostr(v); 26elseif (typeof(v) == STR) 27m = ("\"" + v) + "\""; 28else 29m = tostr(v); 30endif 31return m + reset;
widen
Referenced by
none
Source
1{old_s, ?n_spaces = 1} = args; 2s = ""; 3old_chars = this:char_list(old_s); 4spaces = $su:space(n_spaces); 5for c in (old_chars) 6s = (s + c) + spaces; 7endfor 8return s[1..$ - n_spaces];
bonus_num
Referenced by
none
Source
1n = args[1]; 2s = ""; 3if (((typeof(n) == FLOAT) && (n >= 0.0)) || ((typeof(n) == INT) && (n >= 0))) 4if (tofloat(n) == 0.0) 5s = "+"; 6else 7s = $ansi.green + "+"; 8endif 9else 10s = $ansi.red; 11endif 12return (s + tostr(n)) + $ansi.reset;
trim_binary
Referenced by
none
Source
1{text} = args; 2if (!text) 3return text; 4elseif (text && (text[$] != $ansi.binary_tag)) 5return text; 6endif 7total = 0; 8length = length(text); 9for i in [0..length - 1] 10if (text[$ - i] != $ansi.binary_tag) 11break; 12endif 13total = total + 1; 14yield; 15endfor 16if ((total % 2) == 1) 17return text[1..$ - 1] + " "; 18endif 19return text;
short_num
Referenced by
none
Source
1n = args[1]; 2if (n < 1000) 3return tostr(n); 4elseif (n < 10000) 5n = tofloat(n) / 1000.0; 6n = tofloat(toint(n * 10.0)) / 10.0; 7return tostr(n) + "k"; 8else 9n = n / 1000; 10return tostr(n) + "k"; 11endif
random_string
Referenced by
none
Source
1{?len = 20} = args; 2s = this:space(len); 3for i in [1..len] 4s[i] = this.lettersnumbers[random($)]; 5endfor 6return s;
silence
Referenced by
- #20:silence_words line 25:
this:silence
Source
1":silence(STR s, FLOAT pct) => randomly replace characters in s until pct of it is periods."; 2{s, pct} = args; 3len = length(s); 4to_silence = toint(ceil(tofloat(len) * pct)); 5positions = $lu:range(1, len); 6weights = {}; 7for p in (positions) 8weight = random(); 9weights = {@weights, {p, weight}}; 10endfor 11weights = $lu:sort_alist(weights, 2); 12delete = weights[1..to_silence]; 13for pw in (delete) 14s[pw[1]] = "."; 15endfor 16return s;
scramble
Referenced by
none
Source
1":scramble(STR s, FLOAT pct) => randomly replace characters in s until pct of it is line noise."; 2{s, pct} = args; 3len = length(s); 4to_silence = toint(ceil(tofloat(len) * pct)); 5positions = $lu:range(1, len); 6weights = {}; 7for p in (positions) 8weight = random(); 9weights = {@weights, {p, weight}}; 10endfor 11weights = $lu:sort_alist(weights, 2); 12delete = weights[1..to_silence]; 13for pw in (delete) 14s[pw[1]] = this.line_noise[random($)]; 15endfor 16return s;
silence_words
Referenced by
- #285:xmit_with_xyz line 55:
$su:silence_words
Source
1{s, pct} = args; 2wordlens = {}; 3words = this:explode(s); 4full_len = length(s); 5for w in (words) 6wordlens = {@wordlens, tofloat(length(w)) / tofloat(full_len)}; 7endfor 8real_words = words; 9words = $lu:make_alist({words, $lu:range(1, length(words)), wordlens}); 10words = $lu:sort_alist(words, 3); 11silenced = 0.0; 12while loop (silenced < pct) 13for word_index in [1..length(words)] 14{word, real_index, pct_for_word} = words[word_index]; 15if ((silenced + pct_for_word) < pct) 16real_words[real_index] = "..."; 17words = listdelete(words, word_index); 18silenced = silenced + pct_for_word; 19continue loop; 20endif 21endfor 22"if we get here, we need to do characters"; 23{word, real_index, pct} = words[random($)]; 24word_pct = ((pct - silenced) / (1.0 / tofloat(full_len))) / tofloat(length(word)); 25real_words[real_index] = this:silence(word, word_pct); 26endwhile 27final = {}; 28last_w = ""; 29for w in (real_words) 30if (last_w != "...") 31final = {@final, w}; 32elseif (w != "...") 33final = {@final, w}; 34endif 35last_w = w; 36endfor 37return $su:from_list(final, " ");
to_hex
Referenced by
none
Source
1{value} = args; 2digits = "0123456789ABCDEF"; 3bits = $math_utils:BLFromInt(value); 4r = ""; 5for i in [0..3] 6o = i * 8; 7r = r + digits[1 + $math_utils:IntFromBL(bits[o + 1..o + 4])]; 8r = r + digits[1 + $math_utils:IntFromBL(bits[o + 5..o + 8])]; 9endfor 10return r;
to_hex2
Referenced by
none
Source
1inthash = string_hash(args[1]); 2if (inthash < 0) 3hex = $math_utils:base_conversion($minint + inthash, 10, 16); 4first = toint($math_utils:base_conversion(hex[1], 16, 10)); 5hex = $math_utils:base_conversion(first + 8, 10, 16) + hex[2..$]; 6else 7hex = $math_utils:base_conversion(inthash, 10, 16); 8endif 9return hex;
match_aliases_generics
Referenced by
- #44:match_generics line 21:
$su:match_aliases_generics
Source
1"Copied from string utilities (#20):match_aliases_ambiguous by Hacker (#36) Sun Nov 21 05:30:18 2010 CST"; 2"Copied from string utilities (#20):match_aliases by Hacker (#36) Fri Mar 5 20:34:58 2004 PST"; 3"$string_utils:match_aliases(string, objlist)"; 4"The argument string is matched against all of the strings in the :name() and :aliases() of the objects in objlist."; 5"If it exactly matches exactly one of them, the object containing that property is returned. If it exactly matches more than one of them, $ambiguous_match is returned."; 6"If there are no exact matches, then partial matches are considered, ones in which the given string is a prefix of some property string. Again, if exactly one match is found, the object with that property is returned, and if there is more than one match, $ambiguous_match is returned."; 7"Finally, if there are no exact or partial matches, then $failed_match is returned."; 8subject = args[1]; 9if (subject == "") 10return $nothing; 11endif 12no_exact_match = no_partial_match = 1; 13for object in ((typeof(olist = args[2]) == LIST) ? olist | {olist}) 14if (valid(object)) 15str_list = {object:name(), @object:aliases()}; 16if (subject in str_list) 17if (no_exact_match) 18no_exact_match = object; 19elseif (parent(no_exact_match) != parent(object)) 20return $ambiguous_match; 21endif 22else 23for string in (str_list) 24if (index(string, subject) != 1) 25elseif (no_partial_match) 26no_partial_match = object; 27elseif (parent(no_partial_match) != parent(object)) 28return $ambiguous_match; 29endif 30endfor 31endif 32endif 33endfor 34return no_exact_match && (no_partial_match && $failed_match);