$include $lib/alynna $include $lib/rp lvar param lvar cgstage lvar sections $def }yerf }cat "Amber.Sheet" pretty tellme $def }oyerf }cat "Amber.Sheet" pretty tellhere $def -j 0 $def /dev/sda1 pop $def corny? "npc" getstat if "NPC" else "Character" then : qmorph[ arr:input -- arr:output ] { input @ foreach swap pop "^YELLOW^" swap strcat "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst repeat }array ; : mke2fs ( Parameter 1, stat dir ) ( Parameter 2, one of: ) $def SECTION_BOOLEAN 1 $def SECTION_COMPACT 2 $def SECTION_NUMERIC 3 $def SECTION_SPECIAL 4 { 1 { "Powers" "p/" SECTION_BOOLEAN }array 2 { "Constructs" "con/" SECTION_BOOLEAN }array 3 { "Shadows" "sh/" SECTION_BOOLEAN }array 4 { "Allies" "aly/" SECTION_BOOLEAN }array 5 { "Trump Cards" "tr/" SECTION_BOOLEAN }array }dict sections ! ; : getstatdir[ d:target s:dir -- a:stats ] target @ "/@rp/" dir @ strcat array_get_propvals var! x target @ "/@rp/@/" dir @ strcat array_get_propvals var! y y @ foreach var! value var! item x @ item @ [] value @ + x @ item @ ->[] x ! repeat x @ ; : doSection[ d:target i:sectionnum -- ] $def lstat BASE @ swap strcat 0 array_make var! output sections @ sectionnum @ [] 0 [] var! section sections @ sectionnum @ [] 1 [] var! BASE sections @ sectionnum @ [] 2 [] var! TYPE target @ "/@rp/" BASE @ strcat propdir? target @ "/@rp/@/" BASE @ strcat propdir? or if ( Header ) section @ header tellme TYPE @ case SECTION_BOOLEAN = when target @ BASE @ getstatdir foreach var! value var! item value @ if item @ 26 lj output @ []<- output ! then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then end SECTION_COMPACT = when target @ BASE @ getstatdir foreach var! value var! item value @ if value @ 1 = if item @ 26 lj output @ []<- output ! else { item @ " [" value @ "] " }cat 26 lj "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst output @ []<- output ! then then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then end SECTION_NUMERIC = when target @ BASE @ getstatdir foreach var! value var! item value @ if { item @ " [" value @ "] " }cat 26 lj "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst output @ []<- output ! then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then end SECTION_SPECIAL = when target @ prog { "sheet." section @ }cat call end endcase then ; : main var target mke2fs -j /dev/sda1 param ! param @ case "#public" smatch when me @ "_prefs/sheet/public?" 1 setprop { "You have opted to show your sheet to other players." }yerf exit end "#private" smatch when me @ "_prefs/sheet/public?" 0 setprop { "You have opted to keep your sheet hidden from other players. This excludes staff." }yerf exit end endcase ( Spend a little time letting wizzes look at other sheets. Default to looking at my own only. ) me @ mlevel 5 >= if param @ not if me @ target ! else param @ resolve target ! target @ int 0 < if { "Who the heck is " param @ "?" }yerf exit then then else param @ if param @ resolve target ! target @ int 0 < if { "Who the heck is " param @ "?" }yerf exit then target @ "_prefs/sheet/public?" getprop not if { target @ ansi_name " has opted to keep their sheet private." }yerf exit then else me @ target ! then then ( Start printing the sheet ... ) { target @ unparseobj }cat header tellme ( Nations and DP/XP use ) { "^YELLOW^ Race: " target @ "race" getstatstr 46 lj "^CYAN^Stuff: " target @ stuff tofloat 0 round tostr 6 rj "/" target @ power tofloat 0 round tostr 6 lj }tell { "^RED^" { "Strength: " 11 rj target @ strength "[" target @ "strength" rank "] / " target @ mstrength "[" target @ "m/strength" rank "]" }cat 39 lj "^YELLOW^" { "Warfare: " 11 rj target @ warfare "[" target @ "warfare" rank "] / " target @ mwarfare "[" target @ "m/warfare" rank "]" }cat 39 lj }tell { "^GREEN^" { "Endurance: " 11 rj target @ endurance "[" target @ "endurance" rank "] / " target @ mendurance "[" target @ "m/endurance" rank "]" }cat 39 lj "^BLUE^" { "Psyche: " 11 rj target @ psyche "[" target @ "psyche" rank "] / " target @ mpsyche "[" target @ "m/psyche" rank "]" }cat 39 lj }tell { target @ "character_mode" getstat case 0 = when { "^BLUE^ New and uninitialized " target @ corny? " ..." }cat 78 center end 1 15 .. when target @ "disapprovedby" getstat if "^RED^" { target @ corny? " last disapproved by " target @ "disapprovedby" getstat " at " "%X" target @ "disapprovedat" getstat timefmt " on " "%C" target @ "disapprovedat" getstat timefmt }cat 78 center else "^PURPLE^" { target @ corny? " in chargen since " "%X" target @ "start_chargen" getstat timefmt " on " "%C" target @ "start_chargen" getstat timefmt }cat 78 center then end 16 255 .. when "^YELLOW^" { target @ corny? " waiting for approval since " "%X" target @ "waiting_since" getstat timefmt " on " "%C" target @ "waiting_since" getstat timefmt }cat 78 center end 256 65535 .. when "^GREEN^" { target @ corny? " last approved by " target @ "approvedby" getstat " at " "%X" target @ "approvedat" getstat timefmt " on " "%C" target @ "approvedat" getstat timefmt }cat 78 center end endcase }tell ( Do Sections ) sections @ foreach pop target @ swap doSection repeat ( Do Footer ) { "AmberRPS Sheet" }cat footer tellme ; PUBLIC main