!!@program WhatIsZExtended.muf !!q !!@register #prop #0:_reg/muf WhatIsZExtended.muf=whatIsExtended !!@action whatis;wi;wi=#0,$muf/whatIsExtended @edit cmd-wixxxe 1 9999999 d i (Extended version of Ruffin@FurToonia's WhatIsz 1.3c) (The #help subcommands provide suitable documentation for this program.) (Originally written by Kry'Thorne. Usable under any circumstances. I claim no right to remove, modify or maintain the program when in use, but in turn can not be held responsible for any damage done by modifications or usage. It can be distributed freely and I will, likely, try and fix any bugs reported to me if allowed!) (This program provides the following public functions:) ( s -- i isFlag? Returns a 'boolean' whether the flag is in this system.) ( s -- s sortFlags Sort flags by user's preferences. Should be used before translation.) ( s -- s translateFlag Returns the full name of a whatIs flag. E.G. 'vul' becomes 'vulpine'.) ( s -- s translateFlags Same as above, but takes and returns an entire line of space delimited flags.) ( d -- showVerboseWi Prints out a basic whatis on one player.) ( d -- showDetailedWi Prints out a detailed whatis on one player.) ( d -- s getVerboseWi Gets an object's short whatis.) ( d s -- setVerboseWi Sets an object's short whatis.) ( d i -- s getDetailedWi Gets an object's long whatis for that level.) ( d i s -- setDetailedWi Sets an object's long whatis for that level.) ( d -- s getFullDetailedWi Gets all flags used in objects detailedWi.) ( d s -- s getDetailedRating Returns an english description for what 'd' thinks of this flag.) ( -- s getAllFlags Gets all the flags being used by the system.) (-----------------------------------) (------------SETTINGS---------------) (-----------------------------------) (This line defines which proptree to store wi settings under. Default is _prefs/whatIsE) ( $def wiDIR "_prefs/whatIsE/" ) $def wiDIR "_prefs/whatis/" (Uncomment this line out in places without the libraries I use most installed.) $def standalone 1 ( Where some of the properties are stored... ) ( $def verbose-prop "/verbose" ) $def verbose-prop "/flags" ( $def wieused-prop "/wiEUsed?" ) $def wieused-prop "/wiEUsed?" $def custom-verbose-prop "/custom" ( Use a custom verbose property ) $def usecustom 1 ( Tapestries MUCK guild system ) $def TapGuildSystem 1 $ifdef TapGuildSystem $include $lib/guild $endif ( #searchable / #!searchable ) $def searchrestriction 1 $ifdef searchrestriction $echo >> Allows for search hiding. $endif ( * enabled ) ( $def showallenabled 1 ) $ifdef showallenabled $echo >> Show all with "*" is enabled. $endif ( species/sex hiding enabled ) $def speciessexhideenabled 1 $ifdef speciessexhideenabled $echo >> Species and gender hiding is enabled. $endif ( Flag Level Names ) ( original set ) ( $def LEVEL1 "Hates" ) ( $def LEVEL2 "Dislikes" ) ( $def LEVEL3 "Neutral" ) ( $def LEVEL4 "Likes" ) ( $def LEVEL5 "Loves" ) ( Tapestries' set ) $def LEVEL1 "Never" $def LEVEL2 "Dislikes" $def LEVEL3 "Neutral" $def LEVEL4 "Likes" $def LEVEL5 "Loves" (-----------------------------------) (------------DEFINITIONS------------) (-----------------------------------) $def VERSION prog "_version" getpropstr ( $define .tell .tell_ansi $enddef ) $echo >>Definitions -- $ifdef standalone $echo >> Using standalone definitions : left (s i -- s) (A function to make sure a string is a certain length, given by 'i') (For example, '"test" 6 left' would return "test ") swap " " strcat swap strcut pop ; : right (s i -- s) (A function to make sure a string is a certain length, given by 'i') (For example, '"test" 6 right' would return " test") swap " " swap strcat dup strlen rot - strcut swap pop ; : removePropDir (d s) (Very powerfull, very dangerous routine to delete a propdir and all properties under it) (Only used in this program to remove it's cached report) over over "/" strcat propdir? if "/" strcat begin over over nextprop swap pop dup "" stringcmp not not while over over propdir? if over over removePropDir over over remove_prop else over over remove_prop then repeat pop pop else remove_prop then ; PUBLIC removePropDir : capital (s -- ) (Make sure it has a capital!) dup "" stringcmp not not if 1 strcut swap toupper swap strcat then ; : english_list (s s -- s) (Converts a list into 'english' form, the list is given by the first s, while s is a character to 'explode' them by) explode over "" stringcmp not not if dup 1 = not if "" swap begin dup while 1 - swap rot 3 pick 0 = if " and " else ", " then swap strcat strcat swap repeat pop 2 strcut swap pop else pop then else pop pop "N/A" then ; $else $echo >> Using GMU libraries. $echo >> If compilation crashes due to undefined words, then GMU are installed incorrectly. ($include $lib/Gary'sMufUtils-lists)(NOT USED) $include $lib/Gary'sMufUtils-strings $include $lib/Gary'sMufUtils-misc ($include $lib/Gary'sMufUtils-exits)(NOT USED) $endif $echo >> Success. (-----------------------------------) (------------ACTUAL CODE------------) (-----------------------------------) : collateOnline ( -- s) (Forms everyone online into a list) online "" swap (I1..IN List I) begin rot dup player? if rot swap intostr " " swap strcat strcat swap else pop then 1 - dup not until pop " " " " subst strip ; : header ( s -- ) (Simple command to print a header. Could be a def really.) ( "WhatIsZ Extended V" VERSION strcat " " strcat "K'T/AnnonyMouse" 22 right strcat .tell "-------------------------------------------------[" swap 20 right strcat "]--" strcat .tell ) "-- WhatIsZ Extended V" VERSION strcat " " strcat "-------------------------------------------------" 52 VERSION strlen - 4 pick strlen - strcut pop strcat "[ " strcat swap strcat " ]" strcat .tell ; : footer (Simple command to print a footer. Could be a def really.) ( "-------------------------------------------------------------------------" .tell ) "-------------------------------------------------------- by K'T/AnnonyMouse --" .tell ; : getAllFlags (Gets all flags being used by the system) "" (result) prog "flags/" begin over swap nextprop dup "" stringcmp not not while dup dup "/" rinstr strcut swap pop (List Program PresentPropdir PresentFlag) 4 rotate swap " " swap strcat strcat -3 rotate repeat pop pop strip ; PUBLIC getAllFlags : safeInt ( ?-- i) (Used to make sure top of stack is an int. Doesn't try to convert other values to prevent hacks) dup int? not if pop 0 then ; : GetSexAndSpecies ( d -- s) (Returns sex and species properties) $ifdef speciessexhideenabled dup location me @ location dbcmp not if ( Riss' ws compatable ) dup "_wsobjector" getpropstr "far" stringcmp 0 = ( WhiteFire's WWHO compatible ) over "_prefs/wwho/far-species-sex-hidden" getpropstr "yes" stringcmp 0 = or if pop "*hidden* *hidden*" exit then then $endif "" over "sex" getpropstr dup "" stringcmp not if pop "[Sex unset]" then strcat " " strcat ( WF - Added support for species_prop ... yea, so almost no one uses it any more. :) over "species_prop" getpropstr dup if 3 pick swap getpropstr else pop over "species" getpropstr then dup "" stringcmp not if pop "[Species unset]" then strcat swap pop ; : isFlag? (s -- i) (Returns a boolean if the flag is in the system) prog "flags/" rot strcat "/" strcat propdir? ; PUBLIC isFlag? : computeLevel ( s -- i) (Translates a string into one of the 5 levels for a detailed WhatIs) 0 over "love" instring if pop 5 then over "always" instring if pop 5 then over "5" instring if pop 5 then over "like" instring if pop 4 then over "often" instring if pop 4 then over "4" instring if pop 4 then over "neutral" instring if pop 3 then over "sometimes" instring if pop 3 then over "3" instring if pop 3 then over "dislike" instring if pop 2 then over "rarely" instring if pop 2 then over "2" instring if pop 2 then over "hate" instring if pop 1 then over "never" instring if pop 1 then over "1" instring if pop 1 then swap pop ; : translateLevel (i -- s) (Opposite of computeLevel. Turns a numeric into a string) "UNKNOWN" over 1 = if pop "1[Hate/Never]" then over 2 = if pop "2[Dislikes/Rarely]" then over 3 = if pop "3[Neutral/Sometimes]" then over 4 = if pop "4[Likes/Often]" then over 5 = if pop "5[Loves/Always]" then swap pop ; : removeDuplicates (s -- s) (Remove flags that occur more then once) dup "" stringcmp not if exit then (No point!) (Easiest quick way of doing this is to rebuild the list, making sure each flag is only present once) "" swap (Newlist) " " explode begin swap over 2 + pick " " strcat " " swap strcat over " " strcat " " swap strcat instr if pop (Don't need it. Already there) else dup isFlag? if (Add it!) over 2 + rotate " " strcat swap strcat over 1 + -1 * rotate else pop then then 1 - dup not until pop strip ; : sortFlag (s s -- s) (Internal routine for SortFlags. Handles the sorting of just one flag) " " strcat " " swap strcat swap " " strcat " " swap strcat swap (Whole list has a space either side and so does the target) over over instring if (String Target) (It's in there! First subst it out) swap over " " swap subst (Now add it again to the start) strcat " " " " subst else pop then strip ; : sortFlags (s -- s) (Sort the flags by the present users preferences) "s" checkargs me @ wiDIR "/order" strcat getpropstr dup "" stringcmp not if (No preference!) pop exit then (Flags SortChoice) " " explode begin dup 1 + rotate over 2 + rotate swap sortFlag over 1 + -1 * rotate 1 - dup not until pop ; PUBLIC sortFlags : getVerbosewi (d -- s) (Returns someone's verbose wi) "d" checkargs dup ok? if wiDIR verbose-prop strcat getpropstr else pop "" then ; PUBLIC getVerbosewi : setVerbosewi (d s -- ) (Set's someones verbose wi) "ds" checkargs over ok? if wiDIR verbose-prop strcat swap setprop else pop pop then ; PUBLIC setVerbosewi : getDetailedwi (d i -- s) (Returns someone's detailed wi) "di" checkargs over ok? if wiDIR "/" strcat swap intostr strcat getpropstr else pop pop "" then ; PUBLIC getDetailedwi : setDetailedwi (d i s -- ) (Sets someones detailed wi) "dis" checkargs 3 pick ok? if wiDIR "/" strcat rot intostr strcat swap setprop else pop pop pop then ; PUBLIC setDetailedwi : GetFullDetailedWi (d -- s) (Gets object's flags used in all detailed sections) "d" checkargs dup 1 getDetailedwi over 2 getDetailedwi 3 pick 3 getDetailedwi 4 pick 4 getDetailedwi 5 pick 5 getDetailedwi 6 rotate pop " " swap strcat strcat " " swap strcat strcat " " swap strcat strcat " " swap strcat strcat " " " " subst strip removeDuplicates ; PUBLIC GetFullDetailedWi : translateFlag (s -- s) (Translates a single flag by doing a lookup on it) "s" checkargs prog "/flags/" rot strcat "/name" strcat getpropstr ; PUBLIC translateFlag : translateFlags (s -- s) (Takes a string of flags and translates it to their full english names) (For example : 'vul' might become 'vulpine') "s" checkArgs dup "" stringcmp not if (Nothing there!) exit then "" swap " " explode (Translation Flag1..FlagN N) begin swap over 2 + rotate swap translateFlag dup "" stringcmp not not if swap " " strcat swap strcat else (Turned out to be an invalid flag! Ignore it) pop then over 1 + -1 * rotate 1 - dup not until pop strip ; PUBLIc translateFlags : ShowVerbosewi (d -- ) (Show someones verbose wi) "d" checkargs dup player? not if (Don't bother, not a player!) pop exit then dup getVerbosewi SortFlags translateFlags $ifdef usecustom $echo >> Using Custom Flags over wiDIR custom-verbose-prop strcat getpropstr strip dup if 30 strcut pop ( clip extra junk ) over if " " else "" then swap strcat strcat else pop then $endif (player flags) dup "" stringcmp not if (Player has no flags... Why?) pop dup wiDIR wieused-prop strcat getpropstr "" stringcmp not if (They've never seen the program.) "[Not used]" else (They've not set any.) "[None set]" then then (Player FlagsInEnglish) over GetSexAndSpecies " " swap strcat strcat $ifdef TapGuildSystem $echo >> Using Tapestries MUCK guild System ( get the ownership ) over guild-name dup if " [" swap strcat " / " strcat 3 pick guild-rank strcat "]" strcat strcat else pop then $endif swap name 14 left " " strcat swap (PlayerNameOrGap StringSoFar) (Now we need to step through StringSoFar, breaking off chunks of 59 characters.) begin dup strlen 64 > while 64 strcut swap (PlayerNameOrGap StringSoFar PresentChunkAtStart) dup " " rinstr strcut (PlayerNameOrGap StringSoFar PresentChunkAtStart ExtraToGoBack) rot strcat swap rot 15 left swap strcat .tell "" swap repeat (All done! Just whatever's left) swap 15 left swap strcat .tell ; PUBLIC ShowVerbosewi : getDetailedRating (d s -- s) (Object Flag -- Rating) (Returns the objects opinion of that flag. Can be several ratings, incase the user left the flag in several fields) "ds" checkargs " " strcat (For searching) "" (Object Flag Result) 3 pick 1 getDetailedwi " " strcat 3 pick instring if LEVEL1 over "" stringcmp not not if "|" swap strcat then strcat then 3 pick 2 getDetailedwi " " strcat 3 pick instring if LEVEL2 over "" stringcmp not not if "|" swap strcat then strcat then 3 pick 3 getDetailedwi " " strcat 3 pick instring if LEVEL3 over "" stringcmp not not if "|" swap strcat then strcat then 3 pick 4 getDetailedwi " " strcat 3 pick instring if LEVEL4 over "" stringcmp not not if "|" swap strcat then strcat then 3 pick 5 getDetailedwi " " strcat 3 pick instring if LEVEL5 over "" stringcmp not not if "|" swap strcat then strcat then swap pop swap pop dup "" stringcmp not if pop "Unrated" else "|" english_list then ; PUBLIC getDetailedRating : ShowAlternativeDetailedwi (d -- ) (Shows the alternative version of DetailedWi. Should only be called by ShowDetailedWi, as it does no checks in persuming the latter did them.) dup getFullDetailedwi sortFlags "" swap (Result) " " explode begin swap (Object Result Flag1..FlagN-1 N PresentFlag) over 3 + pick over getDetailedRating "[" swap strcat "]" strcat swap translateFlag swap strcat (Bury under result) over 2 + rotate " " strcat swap strcat over 1 + -1 * rotate 1 - dup not until pop (Object Result) " " " " subst strip over GetSexAndSpecies " " swap strcat strcat swap name 14 left " " strcat swap (PlayerNameOrGap StringSoFar) (Now we need to step through StringSoFar, breaking off chunks of 59 characters.) begin dup strlen 64 > while 64 strcut swap (PlayerNameOrGap StringSoFar PresentChunkAtStart) dup " " rinstr strcut (PlayerNameOrGap StringSoFar PresentChunkAtStart ExtraToGoBack) rot strcat swap rot 15 left swap strcat .tell "" swap repeat (All done! Just whatever's left) swap 15 left swap strcat .tell ; : ShowDetailedwi (d -- ) (Show someones detailed wi) dup player? not if (Don't bother, not a player!) pop exit then (Check to see if the player has a detailed wi) 0 over 1 getDetailedwi "" stringcmp not not if pop 1 then over 2 getDetailedwi "" stringcmp not not if pop 1 then over 3 getDetailedwi "" stringcmp not not if pop 1 then over 4 getDetailedwi "" stringcmp not not if pop 1 then over 5 getDetailedwi "" stringcmp not not if pop 1 then dup not if (Player has no flags... Why?) pop dup wiDIR wieused-prop strcat getpropstr "" stringcmp not if (They've never seen the program.) "[Not used]" else (They've not set any.) "[None set]" then swap name 14 left " " strcat swap strcat .tell exit then pop (Okay. We're definately showing it!) me @ wiDIR "/wiEAlternative?" strcat getpropstr "y" instring if ShowAlternativeDetailedwi exit then 0 (Player LevelToShow) begin 1 + dup 6 < while over over getDetailedwi sortFlags translateFlags dup "" stringcmp not if pop "[None set]" then (Player LevelShowing Result) over 1 = if 3 pick name 14 left " " strcat else "" then 3 pick (Need to translate level) "ERROR" over 1 = if pop LEVEL1 then over 2 = if pop LEVEL2 then over 3 = if pop LEVEL3 then over 4 = if pop LEVEL4 then over 5 = if pop LEVEL5 then swap pop swap rot (Player LevelShowing LevelShowingLanguageOrGap PlayerNameOrGap Result) (Tag sex and species to result) (5 pick getSexAndSpecies " " swap strcat strcat) (Now we need to step through Results, breaking off chunks of 50 characters.) begin dup strlen 50 > while 50 strcut swap dup " " rinstr strcut rot strcat swap (Player LevelShowing LevelShowingLanguageOrGap PlayerNameOrGap StringSoFar WhatToShow) rot 15 left (Player LevelShowing LevelShowingLanguageOrGap StringSoFar WhatToShow PlayerNameOrGap) 4 rotate dup "" stringcmp not if " " else "-" then swap 9 right swap strcat strcat (Player LevelShowing StringSoFar WhatToShow PlayerNameOrGapAndLevel) swap strcat .tell "" swap "" swap repeat (Need to show what's left!) (Player LevelShowing LevelShowingLanguageOrGap PlayerNameOrGap Result) swap 15 left 3 pick dup "" stringcmp not if " " else "-" then swap 9 right swap strcat strcat swap strcat .tell pop repeat pop pop ; PUBLIC ShowDetailedwi : ShowRoomwi (i -- ) (Show the wi flags of an entire room) (The number is a boolean whether to show a detailed, or verbose wi. >1=detailed) "i" checkargs me @ location contents begin dup ok? while dup player? if dup awake? if dup 3 pick not if showVerbosewi else showDetailedwi then then then next repeat pop pop ; : showTargetedwi (s i -- ) (Attempts to step through a bunch of strings, showing wies for each matched player) (The number is a boolean whether to show a detailed, or verbose wi. >1=detailed) "si" checkargs swap dup "" stringcmp not if pop "Error : No targets." .tell exit then " " explode (Step through targets) begin swap dup .pmatch dup ok? if swap pop over 2 + pick not if showVerbosewi else showDetailedwi then else pop 14 left " " strcat "[Unable to match target player]" strcat .tell then 1 - dup not until pop pop ; : showDetailed (s -- ) (Shows either a series of player's detailed wi's, or the whole room) "s" checkargs dup "" stringcmp not if (An empty string shows the whole room) 1 showRoomwi else (Targets!) 1 showTargetedwi then ; : removeflags (s s -- s) (Remove the second strings flags from the first strings) dup "" stringcmp not if (No targets!) pop exit then " " explode begin swap over 2 + rotate swap " " swap subst over 1 + -1 * rotate 1 - dup not until pop " " " " subst strip ; : doVerboseAdd (s -- ) (Add specified flags to user's flags) "Adding the following flags : " over strcat .tell " : " over translateFlags strcat .tell me @ getVerbosewi " " swap strcat strcat strip removeDuplicates me @ swap setVerbosewi "Your flags are now : " .tell me @ showVerbosewi ; : doDetailedAdd (s -- ) (Add specified flags to user's detailed flags) "=" explode 2 = not if "Error : Invalid number of arguments. See 'wi #complexhelp'." .tell exit then ComputeLevel dup not if "Error : Invalid 'level'. See 'wi #complexhelp' for information on levels." .tell exit then swap removeDuplicates swap (Flags Level) "Adjusting level : " over translateLevel strcat .tell "Adding flags : " 3 pick strcat .tell " : " 3 pick translateFlags strcat .tell me @ over getDetailedwi rot " " swap strcat strcat strip removeDuplicates me @ rot rot setDetailedwi "Your flags are now : " .tell me @ showDetailedwi ; : doVerboseRmm (s -- ) (Remove specified flags from user's flags) "Removing the following flags : " over strcat .tell " : " over translateFlags strcat .tell me @ getVerbosewi swap removeFlags removeDuplicates me @ swap setVerbosewi "Your flags are now : " .tell me @ showVerbosewi ; : doDetailedRmm (s -- ) (Remove specified flags to user's detailed flags) "=" explode 2 = not if "Error : Invalid number of arguments. See 'wi #complexhelp'." .tell exit then ComputeLevel dup not if "Error : Invalid 'level'. See 'wi #complexhelp' for information on levels." .tell exit then swap removeDuplicates swap (Flags Level) "Adjusting level : " over translateLevel strcat .tell "Removing flags : " 3 pick strcat .tell " : " 3 pick translateFlags strcat .tell me @ over getDetailedwi rot removeFlags removeDuplicates me @ rot rot setDetailedwi "Your flags are now : " .tell me @ showDetailedwi ; : doVerboseSet (s -- ) (Set user's flags to specified flags) removeDuplicates "Setting your flags to : " over strcat .tell me @ swap setVerbosewi "Your flags are now : " .tell me @ showVerbosewi ; $ifdef usecustom : doCustomSet ( s -- ) strip dup not if "Verbose custom flag cleared. Your basic settings now read:" .tell me @ wiDIR custom-verbose-prop strcat remove_prop else dup strlen 30 > if "WARNING: Custom field cropped to 30 characters." .tell 30 strcut pop then "Custom flag set to: " over strcat .tell me @ swap wiDIR custom-verbose-prop strcat swap setprop then me @ showVerbosewi ; $endif : doDetailedSet (s -- ) (Set user's detailed flags to specified flags) "=" explode 2 = not if "Error : Invalid number of arguments. See 'wi #complexhelp'." .tell exit then ComputeLevel dup not if "Error : Invalid 'level'. See 'wi #complexhelp' for information on levels." .tell exit then swap removeDuplicates swap (Flags Level) "Setting level : " over translateLevel strcat .tell "Setting flags : " 3 pick strcat .tell " : " 3 pick translateFlags strcat .tell swap me @ rot rot SetDetailedwi "Your flags are now : " .tell me @ showDetailedwi ; : doSetOrder (s -- ) (Set user's order flags to specified flags) removeDuplicates "Prefered order set to : " over strcat .tell " : " over translateflags strcat .tell dup "" stringcmp not if "Your order settings have been cleared." .tell then me @ wiDIR "/order" strcat rot setprop ; $ifdef searchrestriction : doSetSearchable (s -- ) ( Set the user searchable... since it is the default, remove the prop ) pop ( We don't use this arg. ) me @ wiDIR "/searchable" strcat remove_prop "You will now show up in #find searches." .tell ; : doSetNotSearchable (s -- ) ( Set the user searchable... since it is the default, remove the prop ) pop ( We don't use this arg. ) me @ wiDIR "/searchable" strcat "no" setprop "You will no longer show up in #find searches." .tell ; $endif : doFind (s -- ) (Search people online for certain flags) (Target) "Searching for : " over translateFlags strcat .tell dup "" stringcmp not if "Error : No target! Specify one or more flags to search for." .tell exit then online (Target Online1..OnlineN N) begin swap over 2 + pick (Object TargetFlags) 1 swap 3 pick getVerbosewi swap (Object ShowBoolean Objectswi TargetFlags) $ifdef searchrestriction 4 pick wiDIR "/searchable" strcat getpropstr "no" strcmp 0 = if 3 rotate pop 0 -3 rotate then $endif (Now we basically search through the targetflags against the players wi, if at any time we find one isn't in there, we set the boolean to 0 and don't show) " " explode begin swap over 2 + pick " " strcat " " swap strcat swap " " strcat " " swap strcat instring not if (Flag isn't there! Disqualify this user!) dup 2 + rotate pop 0 over 2 + -1 * rotate then 1 - dup not until pop pop if (Target has all specified wi flags!) showVerbosewi else pop then 1 - dup not until pop pop ; : doFlags (s -- ) (List all available flags) pop "" (LineSoFar) 0 (AmountOfItemsPresentlyOnLine) "flags/" ( WhereWeAre) (LineSoFar Count PresentDir) begin prog swap nextprop dup "" stringcmp not not while (Make a 18 letters long part to tag onto the stringSoFar) "" over dup "/" rinstr strcut swap pop ":" strcat 4 right strcat over "/name" strcat prog swap getpropstr dup "" stringcmp not if pop "" then strcat 18 left (LineSoFar Count PresentDir NextPart) 4 rotate swap " " swap strcat strcat rot rot (LineSoFar Count PresentDir) swap 1 + dup 4 = if (There are 4 parts!) rot .tell pop "" swap 0 swap else (Less then 4. We'll get back to it) swap then repeat pop (Have we anything left to show?) if (Yes!) .tell else (Nope!) pop then "Flags are presently being maintained by : " prog "maintainer" getpropstr dup "" stringcmp not if pop "Noone." then strcat .tell ; : doWhatis (s -- ) (Describe a specific flag or flags) dup "" stringcmp not if pop "Error : You need to specify one or more flags!" .tell exit then " " explode begin dup while 1 - swap (Check flag is valid) prog "flags/" 3 pick strcat "/" strcat propdir? not if 4 right ": [INVALID FLAG]" strcat ">" swap strcat .tell continue then dup 4 right ": " strcat ">" swap strcat (Flag SoFar) over prog swap "flags/" swap strcat "/name" strcat getpropstr strcat " - " strcat prog "flags/" 4 pick strcat "/description" strcat getpropstr dup "" stringcmp not if pop over prog swap "flags/" swap strcat "/desc" strcat getpropstr then (Try and find alternative desc) dup "" stringcmp not if pop "[ No description assigned ]" then strcat .tell pop repeat pop ; : doCheck (s -- ) (Make sure all wi flags have descriptions) pop prog "flags/" propdir? not if "There are no flags present as of yet!" .tell exit then 0 (Whether we found any problems) "flags/" (Where we are) begin prog swap nextprop dup "" stringcmp not not while prog over "/name" strcat getpropstr "" stringcmp not if "Flag '" over dup "/" rinstr strcut swap pop strcat "' has no name!" strcat .tell swap 1 + swap then prog over "/description" strcat getpropstr "" stringcmp not prog 3 pick "/desc" strcat getpropstr "" stringcmp not AND if "Flag '" over dup "/" rinstr strcut swap pop strcat "' has no description!" strcat .tell swap 1 + swap then repeat pop dup not if "No problems found." .tell else "Scan complete. " over intostr strcat " problems found." strcat .tell then pop ; : doImport (s -- ) (Take an exit and import flags from it) dup "" stringcmp not if "You need to specify an old wi's exit for the program to import the flags from." .tell exit then "Not implemented yet." .tell ; : Report_CheckForHighest (i s -- ) (Internal function for reports. Checks for a higher number then 'i' under that subdir) begin prog swap nextprop dup "" stringcmp not not while prog over getprop safeInt (HighestRecorded PropLoc Next) 3 pick over swap > if rot pop swap else pop then repeat pop ; : Report_PrintBar (i i s -- ) (Count Highest Label) (Internal function for reports. Prints a bar, with the given label) 16 left "|" strcat (CountForThisFlag Highest StrSoFar) (Work out column) "************************************************************" 4 pick 50 * 4 rotate / strcut pop 50 left strcat "|" strcat swap intostr 5 right strcat .tell ; : doReport (s -- ) (Prints out a tally for each flag.) Pop prog "~report?" getpropstr "y" instring not if "Report system is presently inactive." .tell exit then prog "~doingReport?" getpropstr "y" instring if "The report system is present rebuilding itself. Please check again shortly." .tell exit then (Work out highest value first) 0 "cachedreports/verbose/" Report_CheckForHighest "Of " prog "cachedreports/totalplayers" getprop safeInt intostr strcat " players, " strcat prog "cachedreports/totalverbose" getprop safeInt intostr strcat " have a verbose whatIs." strcat .tell "Report data was last calculated on : " prog "~lastreporttime" getprop SafeInt dup 0 = if pop "Never!" else "%c" swap timefmt then strcat .tell "Highest used flag count is " over intostr strcat .tell (Highest) (Now we just go do each item in turn.) "flags/" begin prog swap nextprop dup "" stringcmp not not while dup dup "/" rinstr strcut swap pop "cachedreports/verbose/" over strcat prog swap getprop safeInt swap translateFlag Capital 4 pick swap Report_PrintBar repeat pop ; : doDetailedReport (s -- ) (Prints out sectioned reports for each flag.) Pop prog "~report?" getpropstr "y" instring not if "Report system is presently inactive." .tell exit then prog "~doingReport?" getpropstr "y" instring if "The report system is present rebuilding itself. Please check again shortly." .tell exit then pop (Work out highest value first) 0 "cachedreports/detailed/1/" Report_CheckForHighest "cachedreports/detailed/2/" Report_CheckForHighest "cachedreports/detailed/3/" Report_CheckForHighest "cachedreports/detailed/4/" Report_CheckForHighest "cachedreports/detailed/5/" Report_CheckForHighest "Of " prog "cachedreports/totalplayers" getprop safeInt intostr strcat " players, " strcat prog "cachedreports/totaldetailed" getprop safeInt intostr strcat " have a detailed whatIs." strcat .tell "Report data was last calculated on : " prog "~lastreporttime" getprop SafeInt dup 0 = if pop "Never!" else "%c" swap timefmt then strcat .tell "Highest used flag count is " over intostr strcat .tell (Highest) (Now we just go do each item in turn.) "flags/" begin prog swap nextprop dup "" stringcmp not not while dup dup "/" rinstr strcut swap pop (Highest PropDir Flag) "--[" over translateFlag capital 20 left strcat "]-------------------------------------------------" strcat .tell (Do each item in turn) "cachedreports/detailed/5/" over strcat prog swap getprop safeInt "Loved" 5 pick swap Report_PrintBar "cachedreports/detailed/4/" over strcat prog swap getprop safeInt "Liked" 5 pick swap Report_PrintBar "cachedreports/detailed/3/" over strcat prog swap getprop safeInt "Neutral" 5 pick swap Report_PrintBar "cachedreports/detailed/2/" over strcat prog swap getprop safeInt "Disliked" 5 pick swap Report_PrintBar "cachedreports/detailed/1/" over strcat prog swap getprop safeInt "Hated" 5 pick swap Report_PrintBar pop repeat pop ; : doStartReport (s -- ) (Starts off the daily report process) pop "Setting up report process..." .tell prog "~report?" "yes" setprop (Allow users to use report) " Done" .tell "Checking for old running process..." .tell (Make sure no prior process is running) prog "~reportPID" getprop dup int? if (OOh! Possibly got one...) kill else pop then " Done" .tell "Starting up new process..." .tell prog "~reportPID" pid setprop background (Okay. Enough user prompts. Now the report starts) begin pid prog "~reportPID" getprop safeInt = while begin depth while pop repeat prog "~doingReport?" "yes" setprop "[WhatIsE Report] Starting up.. Clearing propdirs" .tell prog "cachedreports" removePropDir prog "~lastreporttime" systime setprop systime dbtop begin 1 - dup #0 = not while dup ok? if dup player? if (Okay. We have a valid player...) (Do verbose caching first..) dup getVerboseWi removeDuplicates dup "" stringcmp not if pop else (Add 1 to the amount of people with a verbose wi) prog "cachedreports/totalverbose" getprop safeInt 1 + prog swap "cachedreports/totalverbose" swap setprop (Now go through each flag to tally them.) " " explode begin swap prog "cachedreports/verbose/" 3 pick strcat getprop safeInt 1 + prog swap "cachedreports/verbose/" 4 pick strcat swap setprop pop 1 - dup not until pop then (Do detailed caching now..) (Check to see if the player has a detailed wi) 0 over 1 getDetailedwi "" stringcmp not not if pop 1 then over 2 getDetailedwi "" stringcmp not not if pop 1 then over 3 getDetailedwi "" stringcmp not not if pop 1 then over 4 getDetailedwi "" stringcmp not not if pop 1 then over 5 getDetailedwi "" stringcmp not not if pop 1 then if prog "cachedreports/totaldetailed" getprop safeInt 1 + prog swap "cachedreports/totaldetailed" swap setprop dup 1 getDetailedWi removeDuplicates dup "" stringcmp not if pop else " " explode begin swap prog "cachedreports/detailed/1/" 3 pick strcat getprop safeInt 1 + prog swap "cachedreports/detailed/1/" 4 pick strcat swap setprop pop 1 - dup not until pop then dup 2 getDetailedWi removeDuplicates dup "" stringcmp not if pop else " " explode begin swap prog "cachedreports/detailed/2/" 3 pick strcat getprop safeInt 1 + prog swap "cachedreports/detailed/2/" 4 pick strcat swap setprop pop 1 - dup not until pop then dup 3 getDetailedWi removeDuplicates dup "" stringcmp not if pop else " " explode begin swap prog "cachedreports/detailed/3/" 3 pick strcat getprop safeInt 1 + prog swap "cachedreports/detailed/3/" 4 pick strcat swap setprop pop 1 - dup not until pop then dup 4 getDetailedWi removeDuplicates dup "" stringcmp not if pop else " " explode begin swap prog "cachedreports/detailed/4/" 3 pick strcat getprop safeInt 1 + prog swap "cachedreports/detailed/4/" 4 pick strcat swap setprop pop 1 - dup not until pop then dup 5 getDetailedWi removeDuplicates dup "" stringcmp not if pop else " " explode begin swap prog "cachedreports/detailed/5/" 3 pick strcat getprop safeInt 1 + prog swap "cachedreports/detailed/5/" 4 pick strcat swap setprop pop 1 - dup not until pop then then (Add one of the amount of valid players) prog "cachedreports/totalplayers" getprop safeInt 1 + prog swap "cachedreports/totalplayers" swap setprop then then repeat pop "[WhatIsE Report] Finished. Took " swap systime swap - intostr strcat " second(s). Sleeping now." strcat .tell prog "~doingReport?" "no" setprop 60 60 24 * * sleep repeat ; : doStopReport (s -- ) (Stop a report and disable the system) prog "~reportPID" getprop dup int? if kill else pop then prog "~reportPID" remove_prop prog "~report?" "no" setprop (Allow users to use report) "Report system disabled." .tell ; : doToggleFormat (s -- ) pop (Don't care about what's on the stack) me @ wiDir "/wiEAlternative?" strcat getpropstr "y" instring "Now using '" over 1 = if "Default, easier to read but spammy" else "Advanced, hard to read but compact" then strcat "' format!" strcat .tell 1 = if me @ WiDir "/wiEAlternative?" strcat remove_prop else me @ WiDir "/wiEAlternative?" strcat "yes" setprop then ; : doNewDetailedReport (s -- ) (Draw the alternative detailed report, added after some suggestions) (Some code reused, 'cause I'm lazy) pop (Don't care about what's on the stack) prog "~report?" getpropstr "y" instring not if "Report system is presently inactive." .tell exit then prog "~doingReport?" getpropstr "y" instring if "The report system is present rebuilding itself. Please check again shortly." .tell exit then pop (Work out highest value first) 0 "cachedreports/detailed/1/" Report_CheckForHighest "cachedreports/detailed/2/" Report_CheckForHighest "cachedreports/detailed/3/" Report_CheckForHighest "cachedreports/detailed/4/" Report_CheckForHighest "cachedreports/detailed/5/" Report_CheckForHighest "Of " prog "cachedreports/totalplayers" getprop safeInt intostr strcat " players, " strcat prog "cachedreports/totaldetailed" getprop safeInt intostr strcat " have a detailed whatIs." strcat .tell "Report data was last calculated on : " prog "~lastreporttime" getprop SafeInt dup 0 = if pop "Never!" else "%c" swap timefmt then strcat .tell "Highest used flag count is " over intostr strcat .tell pop (Okay! Doing the new report now) "flags/" begin prog swap nextprop dup "" stringcmp not not while dup dup "/" rinstr strcut swap pop (PropDir Flag) (Need to work out the total of people with this flag) 0 "cachedreports/detailed/1/" 3 pick strcat prog swap getprop SafeInt + "cachedreports/detailed/2/" 3 pick strcat prog swap getprop SafeInt + "cachedreports/detailed/3/" 3 pick strcat prog swap getprop SafeInt + "cachedreports/detailed/4/" 3 pick strcat prog swap getprop SafeInt + "cachedreports/detailed/5/" 3 pick strcat prog swap getprop SafeInt + swap (PropDir Total Flag) (Make 'left' half) "cachedreports/detailed/1/" over strcat prog swap getprop SafeInt 100 * 51 * 100 / 3 pick / dup 0 = if pop 1 then "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" swap strcut pop (PropDir Total Flag LeftHalf) "cachedreports/detailed/2/" 3 pick strcat prog swap getprop SafeInt 100 * 51 * 100 / 4 pick / dup 0 = if pop 1 then "(((((((((((((((((((((((((((((((((((((((((((((((((((" swap strcut pop strcat (PropDir Total Flag LeftHalf) (Make 'right' half!) "cachedreports/detailed/4/" 3 pick strcat prog swap getprop SafeInt 100 * 51 * 100 / 4 pick / dup 0 = if pop 1 then ")))))))))))))))))))))))))))))))))))))))))))))))))))" swap strcut pop (PropDir Total Flag LeftHalf RightHalf) "cachedreports/detailed/5/" 4 pick strcat prog swap getprop SafeInt 100 * 51 * 100 / 5 pick / dup 0 = if pop 1 then ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" swap strcut pop strcat (PropDir Total Flag LeftHalf RightHalf) "===================================================" 3 pick strlen 3 pick strlen + 51 swap - strcut pop swap strcat strcat over translateFlag 20 left "|" strcat swap strcat "|" strcat .tell pop pop repeat pop "In the lines above, " .tell " '<' represents the percentage of people who hate a flag, " .tell " '(' represents the percentage of people who dislike a flag, " .tell " '=' represents the percentage of people who are neutral, " .tell " ')' represents the percentage of people who like a flag, " .tell " '>' represents the percentage of people who love a flag. " .tell "The easiest way of reading this report is to look at 'where' the neutral section is. If it's on the left, then in general people like the flag; Whereas if it's on the right, in general people dislike the flag." .tell ; : DoOnlineWrapper (s i -- ) (Shows the wi of /EVERYONE/ online.. They asked for it...) swap pop (Don't need this) (Number represents whether we're doing a verbose view, 0, or a full detailed view, 1) CollateOnline " " explode begin swap (Type Online1..OnlineN-1 N OnlineN) atoi dbref over 2 + pick if showDetailedwi else showVerboseWi then 1 - dup not until pop ; : main ( s-- ) me @ wiDIR wieused-prop strcat "yes" setprop (They've used this program!) (Do some quick subst's to allow for alternative command usages) "detail" "detailed" subst "detail" "complex" subst dup "" stringcmp not if (No command or arguments. Must be a room view.) "Room View" header 0 ShowRoomwi footer exit then (Seperate 'args' into 'subcommand args') dup " " instring dup if strcut strip swap strip swap else pop "" then $ifdef showallenabled over "*" stringcmp not if (Dammit, they want to view the whole stinking muck! The fools..) "Online View" header 0 DoOnlineWrapper footer exit then $endif over "#" instring not if "Focused View" header (No '#' style command, so it must be a lookup wi on a person or persons.) " " swap strcat strcat strip 0 ShowTargetedwi footer exit then $ifdef showallenabled over "#detail" stringcmp not over "*" stringcmp not AND if (Dammit, they want to view the whole stinking muck's detailed! Gonna die of spam..) "FULL Online View" header 1 DoOnlineWrapper footer exit then $endif over "#detail" stringcmp not if (Show the room's, or one or more player's detailed wi's) "Detailed View" header swap pop showDetailed footer exit then over "#set" stringcmp not if "Set flags" header dup "=" instring if (Detailed set) doDetailedSet else (Verbose set) doVerboseSet then footer exit then $ifdef usecustom over "#custom" stringcmp not if "Set custom" header doCustomSet footer exit then $endif over "#add" stringcmp not if "Add flags" header dup "=" instring if (Detailed Add) doDetailedAdd else (Verbose add) doVerboseAdd then footer exit then over "#rmm" stringcmp not if "Rmm Flags" header dup "=" instring if (Detailed Rmm) doDetailedRmm else (Verbose Rmm) doVerboseRmm then footer exit then $ifdef searchrestriction over "#searchable" stringcmp not if (Set an order) "Set searchable" header doSetSearchable footer exit then over "#!searchable" stringcmp not if (Set an order) "Set searchable" header doSetNotSearchable footer exit then $endif over "#order" stringcmp not if (Set an order) "Set order" header doSetOrder footer exit then over "#find" stringcmp not if (Find a set of flags) "Find flags" header doFind footer exit then over "#flags" stringcmp not if (List the flags available) "List flags" header doFlags footer exit then over "#whatis" stringcmp not if (List a description of one flag) "Describe flags" header doWhatIs footer exit then over "#whatisall" stringcmp not if (List a description of all flags) "Describe flags" header pop getAllFlags doWhatIs footer exit then over "#check" stringcmp not if (List a description of one flag) "Check" header doCheck footer exit then over "#import" stringcmp not if (Imports an old wi's settings.) "Import" header doImport footer exit then over "#startreport" stringcmp not if (Starts off the report process) "Start Report" header doStartReport footer exit then over "#stopreport" stringcmp not if (Stops the report process) "Stop Report" header doStopReport footer exit then over "#report" stringcmp not if (Print out a report) "Report" header doReport footer exit then over "#detailreport" stringcmp not if (Print out a detailed report) "Detailed Report" header doDetailedReport footer exit then over "#detailreport2" stringcmp not if (Print out the new, improved detailed report) "Detailed Report 2" header doNewDetailedReport footer exit then over "#toggleFormat" stringcmp not if (Changes between the two types of format available) "Format Toggle" header doToggleFormat footer exit then over "#help" stringcmp not if "Help file" header " This program allows the user to set a series of flags upon themselves to specify their likes and to allow people to view each other's flags." .tell " The program actually keeps track of two sets of flags, one is a 'basic' set of flags that you like for when people are viewing crowds (Similar to the original WhatIsZ's set), for more information on setting this list use '" command @ strcat " #basichelp'." strcat .tell " The other is a more complex rating series of flags which are rated to show flags you dislike as well as like, for more information on setting this list use '" command @ strcat " #detailhelp'." strcat .tell " Listed below are some simple commands that relate to both types of WhatIs." .tell "Commands:" .tell " " command @ strcat " #help - This screen." strcat .tell " " command @ strcat " #basichelp - More help on basic settings." strcat .tell " " command @ strcat " #detailhelp - More help on detailed settings." strcat .tell " " command @ strcat " #flags - Lists all the flags and what they mean." strcat .tell " " command @ strcat " #whatis - Gives a description of what certain flags mean." strcat .tell " " command @ strcat " #whatisall - Above, but all flags. Spammy!" strcat .tell " " command @ strcat " #order - Both types of view will show these flags first." strcat .tell " " command @ strcat " #find - Find people online who have certain flags." strcat .tell $ifdef searchrestriction " " command @ strcat " #searchable - Allows you to be seen in #finds." strcat .tell " " command @ strcat " #!searchable - Hides you from #finds." strcat .tell $endif " often means a specified list of flags, seperated by spaces." strcat .tell me @ "w" flag? if " (Wiz only commands)" .tell " " command @ strcat " #maintainhelp - Help on setting up the program." strcat .tell ( " " command @ strcat " #import - Import the flags from an old whatisZ exit." strcat .tell) " " command @ strcat " #check - List flags that don't have a description." strcat .tell " " command @ strcat " #startreport - Allow and activate the report engine." strcat .tell " " command @ strcat " #stopreport - Stop and ban the report engine." strcat .tell then footer exit then over "#basichelp" stringcmp not if "Basic help" header " The idea for the basic WhatIsZ is to both allow something simple for users that don't want the full detail and to allow something which is easier on the eyes in crowded rooms. The only thing you list in the basic WhatIs is which flags you actually have an interest in. The commands for doing so are listed below." .tell "Commands:" .tell " " command @ strcat " - Lists the flags of everyone in the room." strcat .tell " " command @ strcat " - List a specific person's flags." strcat .tell " " command @ strcat " #set - Set your basc flags to exactly these." strcat .tell " " command @ strcat " #add - Add these flags in to your present settings." strcat .tell " " command @ strcat " #rmm - Remove these flags from your present settings." strcat .tell $ifdef usecustom " " command @ strcat " #custom - Set your custom flag(s)." strcat .tell $endif prog "~report?" getpropstr "y" instring if " " command @ strcat " #report - Shows a daily summary of who has what wi flags." strcat .tell then footer exit then over "#detailhelp" stringcmp not if "Detail help" header " The detailed whatIs takes the idea a little further in both allowing mention of flags you like, flags you dislike and a couple of other catergories. To this end, there are 5 different catergories:" .tell " 1 - [Hate/Never] Flags you hate and will never do." .tell " 2 - [Dislike/Rarely] Flags you dislike and will rarely do." .tell " 3 - [Neutral/Sometimes] Flags you don't mind the inclusion of." .tell " 4 - [Like/Often] Flags you like and will do often." .tell " 5 - [Love/Always] Flags that should always happen or be there." .tell " To this end, actually setting these catergories upon yourself is more complex then the basic WhatIs, it is however still similar to such. They can be specified with a level from above for each time you set them. (For example setting flags you hate would be done with '" command @ strcat " #set 1=') To make things slightly easier, any of the words mentioned in []'s above may be used, so setting flags you like could be done with any of these commands:" strcat .tell " " command @ strcat " #set 4=" strcat .tell " " command @ strcat " #set like=" strcat .tell " " command @ strcat " #set often=" strcat .tell "Commands:" .tell " " command @ strcat " #detail - List the detailed information for everyone " strcat .tell " in the room. (Warning : SPAMMY)" .tell " " command @ strcat " #detail - List a specific person's detailed flags." strcat .tell " " command @ strcat " #set =" strcat .tell " - Set up flags on that level (See above)." .tell " " command @ strcat " #add =" strcat .tell " - Add flags to that level (See above)." .tell " " command @ strcat " #rmm =" strcat .tell " - Remove flags on that level (See above)." .tell " " command @ strcat " #toggleFormat" strcat .tell " - Toggles whether to use the default, or compact format." .tell " - The compact format is harder to read, but less space." .tell prog "~report?" getpropstr "y" instring if " " command @ strcat " #detailedreport - Shows a daily summary of who has what wi flags." strcat .tell " WARNING : Extremely spammy!" .tell " " command @ strcat " #detailedreport2 - Alternative report, shorter but hard to read." strcat .tell then footer exit then over "#maintainhelp" stringcmp not if "Maintain help" header "WhatIs flags are stored on the program itself in the form:" .tell " /flags//name:" .tell " /flags//description:" .tell "So, for example, an 'equ' flag for 'equine' could be added with the following:" .tell " @set #" prog intostr strcat "=/flags/equ/name:equine" strcat .tell " @set #" prog intostr strcat "=/flags/equ/description:This flag represents either enjoying being an equine, or enjoying being with one." strcat .tell "As an addition, the following property can be set on the program to list who maintains the flags:" .tell " @set #" prog intostr strcat "=/maintainer:" strcat .tell footer exit then "Error : Unrecognized command. Try '" command @ strcat " #help'." strcat .tell ; . c q @set cmd-wixxxe=_version:1.0.0.1 WF @set cmd-wixxxe=%N:WhatIsZ Extended @set cmd-wixxxe=desc:Shows a persons preferences.