@program #3564 1 1000 d i $include $lib/gary'smufutils-strings $include $lib/gary'smufutils-lists $include $lib/gary'smufutils-misc $include $lib/rp $include $lib/alynna $include $muf/rp/utils $include $muf/Scrp/registry $def VERSION prog "_version" getpropstr $def ERROR "Try '" command @ strcat " #help' for help." strcat sctell exit $define .tell .ansi_tell $enddef lvar target lvar hidecheck $def RPS "$RPSYSTEM" match lvar lastskill lvar lastsubskill : linetell (s --) (tell's a string as a list of lines.) 71 line_split begin swap 71 centre LINE " " strcat swap strcat LINE strcat .tell 1 - dup not until pop ; : makeFloat (?--i) dup string? if dup "." instring if strtof else atoi then then dup float? not if float then ; : floatStr (? -- s) makeFloat "%4.2f" fmtstring 6 right ; : FishNext (??) (Gets the next item from an Element_list) dup 1 element_list_get swap 1 element_list_delete swap ; : splitJobs (d s -- s s) (Takes an object and a list of jobs, returns two lists - one of what jobs they have with jp in, one of what jobs don't) "" swap "" swap "|" explode (Object ListOf2+ ListOfNotgot In..I1 I) begin swap over 4 + pick over RPutils.getJobJP if (Put in list 1!) over 3 + rotate swap element_list_add over 2 + -1 * rotate else (Put in list 2!) over 2 + rotate swap element_list_add over 1 + -1 * rotate then 1 - dup not until pop rot pop ; : makeJobItem (s -- s) (Special call just to get a job item) dup target @ "job" getstatstr over stringcmp not if "^GREEN^>^CYAN^" swap strcat "^GREEN^<" strcat then 12 left TEXTCOLOR swap strcat OPENITEM strcat target @ 3 pick RPutils.getJobLevel intostr 2 right strcat CLOSEITEM strcat "^GREEN^" strcat target @ 3 pick RPutils.getJobJP target @ 4 pick RPutils.getJobSpentJP - intostr hidecheck @ if pop "???.??" then 6 right pop "^FOREST^/^GREEN^" pop target @ 3 pick RPutils.getJobJP intostr hidecheck @ if pop "???.??" then 6 right pop swap pop ; : convertNumber (i -- s) (Converts a number 1 to 10 into a secret string!) "^GREEN^>>" swap (String number) dup 20 < if swap pop "^FOREST^|>" swap then dup 15 < if swap pop "||" swap then dup 10 < if swap pop "^CRIMSON^<|" swap then dup 5 < if swap pop "^RED^<<" swap then pop ; : makeItem (s i -- s) (Makes an item of that length) 4 - over dup "/" rinstr if dup "/" rinstr strcut swap pop then swap left capital TEXTCOLOR swap strcat OPENITEM strcat swap target @ swap getstatint hideCheck @ if convertNumber else intostr then 2 right strcat CLOSEITEM strcat ; : getNextSkill ( -- s) (Returns a 23 char string for the next skill) (lastskill @ " -- " strcat lastsubskill @ strcat .tell) lastskill @ "END" stringcmp not if " " 24 left exit then lastskill @ lastsubskill @ strcat strip "" stringcmp not if "^CYAN^________________________" "END" lastskill ! exit then lastsubskill @ strip "" stringcmp not if lastskill @ dup "START" stringcmp not if (Special case for noSkillShow) pop "Alertness" dup lastskill ! (Check we have a skill to show if we shouldn't be showing 0 - Might be stuck on alertness!) me @ "_prefs/sheet/show" getpropstr "none" stringcmp not me @ "_prefs/sheet/show" getpropstr "" stringcmp not OR if (Search through the registerty tree until we find a skill not at 0) begin lastskill @ "" stringcmp not if 0 else lastskill @ target @ swap getStatint 0 = if 1 else 0 then then while lastskill @ "skill" swap rpUtils.nextitem dup "/" rinstr strcut swap pop swap pop dup lastskill ! repeat then else "skill" swap RPUtils.nextItem dup "/" rinstr strcut swap pop dup lastskill ! me @ "_prefs/sheet/show" getpropstr "none" stringcmp not me @ "_prefs/sheet/show" getpropstr "" stringcmp not OR if (Search through the registerty tree until we find a skill not at 0) begin lastskill @ "" stringcmp not if 0 else lastskill @ target @ swap getStatint 0 = if 1 else 0 then then while lastskill @ "skill" swap RPUtils.nextItem dup "/" rinstr strcut swap pop swap pop dup lastskill ! repeat then ( dup "" stringcmp not if pop "END" lastskill ! " " exit then) then dup strip "" stringcmp not if pop "^CYAN^________________________" "END" lastskill ! exit then (Check if target has subskills for next time) "@rp/" lastskill @ strcat "/" strcat target @ swap over over propdir? if nextprop dup "/" rinstr strcut swap pop lastsubskill ! else pop pop then (DRAW SKILL) 23 makeitem "^PURPLE^*^WHITE^" swap strcat else (DRAW SUBSKILL) lastsubskill @ dup strip "" stringcmp not if pop "^CYAN^________________________" "END" lastskill ! exit then pop lastskill @ "/" strcat lastsubskill @ strcat 22 makeitem "^PURPLE^ \\^GRAY^" swap strcat (Advance the subskill) "@rp/" lastskill @ strcat "/" strcat lastsubskill @ strcat target @ swap nextprop dup "" stringcmp not if pop (No) "" lastsubskill ! else dup "/" rinstr strcut swap pop lastsubskill ! then then ; : doSection (s --) 0 swap (Have we shown anything?) 0 swap (Units Used) "" swap (Line) "" (Start) (ShowSomething? UnitsUsed LineSoFar ItemType Next) begin over swap Rputils.nextItem dup "" stringcmp not not while dup (Need to check if we need special/! for a special) 3 pick "special" stringcmp not if "special/" swap strcat then target @ swap getstatint if dup 3 pick "special" stringcmp not if "special/" swap strcat then 23 makeitem (ShowSomething? UnitsUsed LineSoFar ItemType Next NextPart) (Set shownSomething) 6 rotate pop 1 -6 rotate 5 pick 0 = if (Need to increase UnitsUsed and stick to LineSoFar) 4 rotate swap strcat (ShowSomething? UnitsUsed ItemType Next LineSoFar) 4 rotate 1 + -4 rotate -3 rotate else 5 pick 1 = if (ShowSomething? UnitsUsed LineSoFar ItemType Next NextPart) (Need to stick the strings together with a space between and do 1 + ) 5 rotate 1 + -5 rotate 4 rotate " " strcat swap strcat -3 rotate else (ShowSomething? UnitsUsed LineSoFar ItemType Next NextPart) 5 rotate pop 0 -5 rotate (Need to stick the strings together with a space between. Tell the string. Store a blank string. And set UnitsUsed to 0 again.) 4 rotate " " strcat swap strcat linetell "" -3 rotate then then then repeat pop pop (ShowSomething? UnitsUsed LineSoFar) rot if (Show last bit if needed) swap if 71 left LINE " " strcat swap strcat LINE strcat .tell then else pop pop (Show nothing!) " -- Nothing! -- " linetell then ; lvar cur lvar max lvar tier lvar result : professionscan ( -- s ) var number var class var level var bin1 var bin2 target @ "Class" getstatstr class ! target @ "Jobs/" class @ strcat getstatint level ! 0 number ! "" result ! "Job" "" RPUtils.nextItem max ! begin RPS "Jobs/" max @ strcat "/Profession" strcat getpropstr tier ! RPS "Jobs/" max @ strcat "/tier" strcat getpropstr atoi target @ "Jobs/" tier @ strcat getstatint - 1 = if 1 bin1 ! else 0 bin1 ! then 0 bin2 ! tier @ class @ smatch if 1 bin2 ! else level @ 2 / RPS "Jobs/" max @ strcat "/tier" strcat getpropstr atoi < not if 1 bin2 ! then then bin1 @ bin2 @ and if result @ max @ target @ max @ RPutils.joballowed? if "^green^" else "^red^" then swap strcat ", " strcat swap strcat result ! then "Job" max @ RPUtils.nextItem max ! number @ 1 + number ! max @ not until result @ if result @ dup strlen 2 - strcut pop result ! then result @ ; : doNextStr (i s s -- i s) (AmountUsed StringSoFar NextBit -- AmountUsed StringSoFar) (Mini function for skill sheet. Used to make sure a line is right) dup strip "" stringcmp not over "\\" instring not OR 4 pick 3 = OR if (Line complete!) swap 73 left "^CYAN^|^WHITE^" strcat dup "" "^CYAN^|^WHITE^" subst strip "" stringcmp not if pop else .tell then swap pop 0 swap dup "\\" instring if (Give extra space if not a main one!) swap 1 + swap " " swap strcat then "^CYAN^|^WHITE^" swap strcat else strcat (" SOFAR:" over strcat .tell) then ; : basicSheet (Draws a basic sheet, target should be set) LINECOLOR ".__" strcat OPENITEM strcat "Sheet V" strcat VERSION strcat CLOSEITEM strcat LINECOLOR strcat "________________________________________________________." strcat .tell (Header - Who/what is this?) target @ name ", the " strcat target @ "sex" getpropstr dup "" stringcmp not if pop "genderless" then strcat " " strcat target @ "species" getpropstr dup "" stringcmp not if pop "undefined" then strcat linetell target @ "%n" getpropstr dup "" stringcmp not not if " (AKA " swap strcat "~&R" strcat TEXTCOLOR strcat ")" strcat linetell then target @ owner me @ dbcmp me @ RPlib.staff? or if target @ "faction" getstatstr "factions/" swap strcat RPS swap getpropstr dup "none" stringcmp not not if "Part of \"" swap strcat "\"" strcat linetell else pop then then LINE 73 left LINE strcat .tell ( "Approved? " OPENITEM strcat target @ "Approved?" getstatint 1 = if "^GREEN^O" else "^RED^X" then strcat CLOSEITEM strcat 32 center "Oathed? " OPENITEM strcat target @ "Oathed?" getstatint 1 = if "^GREEN^O" else "^RED^X" then strcat CLOSEITEM strcat 32 center strcat linetell ) FOOTER .tell (First information line) "HP" OPENITEM strcat "^BRED^" strcat target @ "hp" getstatint intostr 4 right "/" strcat target @ RPlib.getMaxHP intostr 4 right strcat 27 left target @ "hp" getstat target @ Rplib.getMaxHP swap 100 * swap / (Bar %) dup rot swap intostr 3 right strcat "%" strcat swap 31 * 100 / dup 0 < if pop 0 then ansi_strcut "^BBLUE^" swap strcat strcat strcat "^BBLACK^" strcat CLOSEITEM strcat " Free XP" strcat OPENITEM strcat target @ "XP" getstatfloat target @ "XPspent" getstatfloat - 2 fchop 7 right strcat CLOSEITEM strcat " Total XP" strcat OPENITEM strcat target @ "XP" getstatfloat me @ mlevel 3 > not me @ target @ dbcmp not and if pop 0.0 then 2 fchop 8 right strcat CLOSEITEM strcat linetell ( "Status" OPENITEM strcat target @ "Status" getstatstr "Status/" swap strcat RPS swap getpropstr 16 centre strcat CLOSEITEM strcat (Second information line) " Caste" strcat OPENITEM strcat target @ "Caste" getstatstr "Caste/" swap strcat RPS swap getpropstr 18 centre strcat CLOSEITEM strcat linetell ) (ATTRIBUTES. Stored on my registery) "attribute" doSection hideCheck @ me @ "special/peek" getstatint not AND not if (STOP HERE IF HIDING!) "Cultural Experience" divider .tell .tell me @ "jobs?" getpropstr command @ "{jobs|+jobs}" smatch or pop 1 if ( target @ Rputils.getjobs ) ( target @ swap splitJobs ) (New!) "Lutrai: " target @ "Jobs/Lutrai" getstatstr strcat 20 left "Hoomiku: " target @ "Jobs/Hoomiku" getstatstr strcat 20 right " ^VIOLET^-^PURPLE^|^VIOLET^-^white^ " swap strcat strcat linetell "Koba: " target @ "Jobs/Koba" getstatstr strcat 20 left "Skole: " target @ "Jobs/Skole" getstatstr strcat 20 right " ^VIOLET^-^PURPLE^|^VIOLET^-^white^ " swap strcat strcat linetell "Cepn: " target @ "Jobs/Cepn" getstatstr strcat 20 left "Gorg: " target @ "Jobs/Gorg" getstatstr strcat 20 right " ^VIOLET^-^PURPLE^|^VIOLET^-^white^ " swap strcat strcat linetell "Faerie: " target @ "Jobs/Faerie" getstatstr strcat 20 left "Elf: " target @ "Jobs/Elf" getstatstr strcat 20 right " ^VIOLET^-^PURPLE^|^VIOLET^-^white^ " swap strcat strcat linetell "Spiral: " target @ "Jobs/Spiral" getstatstr strcat 20 left "Other: " target @ "Jobs/Other" getstatstr strcat 20 right " ^VIOLET^-^PURPLE^|^VIOLET^-^white^ " swap strcat strcat linetell FOOTER .tell "Available life paths: " professionscan strcat linetell then target @ "Professionlist" getstatstr dup "0" smatch not if "Cultural History: " swap strcat linetell else pop then (Skills. Stored under default on RPS) (Magic Talents. Only sane way of doing this is via the propdir on the target) "Special Skills" divider .tell .tell "special" doSection target @ "bonus#" getstatint if "Bonuses" divider .tell .tell 1 cur ! target @ "bonus#" getstatint max ! begin target @ "Bonus#/" cur @ intostr strcat getstatstr cur @ intostr ": " strcat swap strcat linetell cur @ 1 + cur ! cur @ max @ > until then "Basic Skills" divider .tell .tell ( "skill" doSection) then hidecheck @ not if 0 "^CYAN^|^WHITE^" begin getnextskill dup "___" instring if pop "" then dup strip "" stringcmp not not while (SlotsUsed PresentString Next) rot 1 + rot rot (Increment) doNextStr repeat pop "" doNextStr then LINECOLOR "|___________________________________________________" strcat OPENITEM strcat "Try 'sheet #help'" strcat CLOSEITEM strcat LINECOLOR strcat "__|" strcat .tell ; : main ("Sheet Call. Who=" me @ nn strcat "/What=" strcat command @ strcat "/With=" strcat over strcat prog owner swap notify) "START" lastskill ! "" lastsubskill ! dup "" stringcmp not if pop "me" then dup "#help" stringcmp not if "SC2 Sheet1" .tell "Simply use:" .tell " sheet" .tell "To see your own sheet, or:" .tell " sheet " .tell "To see someone elses." .tell "In the case of viewing someone elses, you will not be shown detail unless you are a member of staff, however you will be shown a shorthand on their stats:" .tell " ^GREEN^>> ^WHITE^=^GREEN^ Great values." .tell " ^FOREST^|> ^WHITE^=^FOREST^ Good values." .tell " || = Moderate values." .tell " ^CRIMSON^<| ^WHITE^= ^CRIMSON^Bad values." .tell " ^RED^<< ^WHITE^= ^RED^Terrible values." .tell "Finally, if you have the special 'peek', you can see all of someones skills/specials too in this manner." .tell exit then verboseSmartMatch dup ok? if target ! target @ me @ dbcmp target @ owner me @ dbcmp OR if 0 hidecheck ! basicSheet else me @ mlevel 3 > if "NOTE : You can view this sheet because of being a wizard." .tell 0 hidecheck ! basicSheet else me @ "special/peek" getstatint if "NOTE : You can view this sheet because of having peek." .tell 1 hidecheck ! basicSheet else 1 hidecheck ! basicSheet then then then then ; . c q