+qwho
Displays a very compact WHO listing of players and their idle times. The code is not meant to be read by mere mortals, for it might drive them insane trying to figure it out. It nearly drove me insane writing it. =)
Functions:
cand(),
capstr(),
ceil(),
center(),
dec(),
div(),
edit(),
elements(),
extract(),
fdiv(),
first(),
gt(),
idle(),
if(),
iter(),
itext(),
lmath(),
lnum(),
lpos(),
lte(),
lwho(),
map(),
member(),
merge(),
mul(),
munge(),
name(),
not(),
null(),
repeat(),
rest(),
revwords(),
rjust(),
setdiff(),
setq(),
setr(),
sort(),
space(),
spellnum(),
splice(),
strlen(),
sub(),
switch(),
tagwrap(),
timestring(),
trimpenn(),
u(),
v(),
vadd(),
vmul(),
vsub(),
width(),
words().
Features:
#lambda.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for +qwho
@create +QWHO
@lock +QWHO==me
@set +QWHO = !NO_COMMAND
@power +QWHO = See_All
&BOTS +QWHO=#1455 #1965 #1867 #8809 #11442 #10589
&DESCRIBE +QWHO=Displays a very compact WHO listing of players and their idle times. The code is not meant to be read by mere mortals, for it might drive them insane trying to figure it out. It nearly drove me insane writing it. =)
@set +QWHO/DESCRIBE=no_command visual public nearby
&DISPLAY_NEW +QWHO=[setq(W, sub(width(%#), 2))][switch(setr(0, words(setr(1, setdiff(%0, v(bots), %b, d)))), <3, u(display_short, %q1, %q0), [setq(1, u(sort_%1, map(format_name, %q1, %b, |), %q1))][setq(2, edit(vsub(lpos(%q1|, |), 0 [lpos(X%q1, |)]), %b, |))][u(find_cols)][setq(4, space(div(sub(%qW, %q8), sub(mul(%q6, 2), 2))))][setq(3, space(div(lmath(sub, %qW %q8 [mul(strlen(%q4), sub(mul(%q6, 2), 2))]), 2)))][setq(5, ceil(fdiv(%q0, %q6)))][setq(7, extract(trimpenn(repeat(%q7|, %q5), |), 1, mul(%q6, %q5), |))]%q3[edit(merge(edit(splice(u(prepare_names), u(prepare_spaces), #, *), *,), trimpenn(repeat(iter(extract(%q7, 1, %q6, |), repeat(X, ##), |, |)@, %q5), @, r), |), @, %r%q3, |, %q4|%q4, ~, %b)]%r)]
&DISPLAY_SHORT +QWHO=switch(%1, 1, center(name(%0)%b[first(timestring(idle(%0)))], %qW), 2, center(name(first(%0))%b[first(timestring(idle(first(%0))))], 33)|[center(name(rest(%0))%b[first(timestring(idle(rest(%0))))], 33)])%r
&EXTRACT_COL +QWHO=elements(%0, vadd(repeat(%2%b, 256), vmul(%1, lnum(256))), |)
&FIND_COLS +QWHO=setq(8, 0)[null(iter(iter(9 8 7 6 5 4 3, setq(9, u(transpose, %q2, ##, |, 0))[iter(lnum(1, ##), lmath(max, u(extract_col, %q9, ##, itext(0)), |), %b, |)], %b, ~), setq(3, lmath(add, dec(sub(10, #@))|##, |))[if(cand(lte(%q3, %qW), gt(%q3, %q8), not(member(##, 0, |))), setq(6, sub(10, #@))[setq(8, %q3)][setq(7, ##)])], ~))]
&FORMAT_NAME +QWHO=[name(%0)]#[rjust(first(timestring(idle(%0))), 3, ~)]
&IDLE +QWHO=tagwrap(SAMP, center(%bIDLE%b, sub(width(%#), 2), =)%r[u(display_new, lwho(%#), idle)][center(%b[capstr(spellnum(%q0))] players online%b, sub(width(%#), 2), =)])
&LENGTH +QWHO=tagwrap(SAMP, center(%bQUICK WHO%b, sub(width(%#), 2), =)%r[u(display_new, lwho(%#), length)][center(%b[capstr(spellnum(%q0))] players online%b, sub(width(%#), 2), =)])
&PREPARE_NAMES +QWHO=edit(u(transpose, %q1, %q6, |, #), #, *#*)
&PREPARE_SPACES +QWHO=map(space, vsub(%q7, u(transpose, vsub(%q2, trimpenn(repeat(1|, %q0), |, r), |) , %q6, |, 0), |), |, *)*#
&QWHO +QWHO=tagwrap(SAMP, center(%bQUICK WHO%b, sub(width(%#), 2), =)%r[u(display_new, lwho(%#), alpha)][center(%b[capstr(spellnum(%q0))] players online%b, sub(width(%#), 2), =)])
&SORT_ALPHA +QWHO=sort(%0, i, |)
&SORT_IDLE +QWHO=munge(#260/sort_munge, map(#apply/idle, %1, %b, |), %0, |)
&SORT_LENGTH +QWHO=revwords(munge(#260/sort_munge, map(#lambda/strlen(name(\%0)), %1, %b, |), %0, |), |)
&SPACE +QWHO=X*[space(%0)]
&TRANSPOSE +QWHO=elements(%0%2[repeat(%3%2, %1)], u(transpose`helper, %0, ceil(fdiv(words(%0, %2), %1)), %1), %2)
@set +QWHO/TRANSPOSE=visual
&TRANSPOSE`HELPER +QWHO=vadd(sort(repeat(lnum(1, %1)%b, %2)), repeat(vmul(%1, lnum(%2))%b, %1))
look +QWHO
@lock +QWHO==me
@set +QWHO = !NO_COMMAND
@power +QWHO = See_All
&BOTS +QWHO=#1455 #1965 #1867 #8809 #11442 #10589
&DESCRIBE +QWHO=Displays a very compact WHO listing of players and their idle times. The code is not meant to be read by mere mortals, for it might drive them insane trying to figure it out. It nearly drove me insane writing it. =)
@set +QWHO/DESCRIBE=no_command visual public nearby
&DISPLAY_NEW +QWHO=[setq(W, sub(width(%#), 2))][switch(setr(0, words(setr(1, setdiff(%0, v(bots), %b, d)))), <3, u(display_short, %q1, %q0), [setq(1, u(sort_%1, map(format_name, %q1, %b, |), %q1))][setq(2, edit(vsub(lpos(%q1|, |), 0 [lpos(X%q1, |)]), %b, |))][u(find_cols)][setq(4, space(div(sub(%qW, %q8), sub(mul(%q6, 2), 2))))][setq(3, space(div(lmath(sub, %qW %q8 [mul(strlen(%q4), sub(mul(%q6, 2), 2))]), 2)))][setq(5, ceil(fdiv(%q0, %q6)))][setq(7, extract(trimpenn(repeat(%q7|, %q5), |), 1, mul(%q6, %q5), |))]%q3[edit(merge(edit(splice(u(prepare_names), u(prepare_spaces), #, *), *,), trimpenn(repeat(iter(extract(%q7, 1, %q6, |), repeat(X, ##), |, |)@, %q5), @, r), |), @, %r%q3, |, %q4|%q4, ~, %b)]%r)]
&DISPLAY_SHORT +QWHO=switch(%1, 1, center(name(%0)%b[first(timestring(idle(%0)))], %qW), 2, center(name(first(%0))%b[first(timestring(idle(first(%0))))], 33)|[center(name(rest(%0))%b[first(timestring(idle(rest(%0))))], 33)])%r
&EXTRACT_COL +QWHO=elements(%0, vadd(repeat(%2%b, 256), vmul(%1, lnum(256))), |)
&FIND_COLS +QWHO=setq(8, 0)[null(iter(iter(9 8 7 6 5 4 3, setq(9, u(transpose, %q2, ##, |, 0))[iter(lnum(1, ##), lmath(max, u(extract_col, %q9, ##, itext(0)), |), %b, |)], %b, ~), setq(3, lmath(add, dec(sub(10, #@))|##, |))[if(cand(lte(%q3, %qW), gt(%q3, %q8), not(member(##, 0, |))), setq(6, sub(10, #@))[setq(8, %q3)][setq(7, ##)])], ~))]
&FORMAT_NAME +QWHO=[name(%0)]#[rjust(first(timestring(idle(%0))), 3, ~)]
&IDLE +QWHO=tagwrap(SAMP, center(%bIDLE%b, sub(width(%#), 2), =)%r[u(display_new, lwho(%#), idle)][center(%b[capstr(spellnum(%q0))] players online%b, sub(width(%#), 2), =)])
&LENGTH +QWHO=tagwrap(SAMP, center(%bQUICK WHO%b, sub(width(%#), 2), =)%r[u(display_new, lwho(%#), length)][center(%b[capstr(spellnum(%q0))] players online%b, sub(width(%#), 2), =)])
&PREPARE_NAMES +QWHO=edit(u(transpose, %q1, %q6, |, #), #, *#*)
&PREPARE_SPACES +QWHO=map(space, vsub(%q7, u(transpose, vsub(%q2, trimpenn(repeat(1|, %q0), |, r), |) , %q6, |, 0), |), |, *)*#
&QWHO +QWHO=tagwrap(SAMP, center(%bQUICK WHO%b, sub(width(%#), 2), =)%r[u(display_new, lwho(%#), alpha)][center(%b[capstr(spellnum(%q0))] players online%b, sub(width(%#), 2), =)])
&SORT_ALPHA +QWHO=sort(%0, i, |)
&SORT_IDLE +QWHO=munge(#260/sort_munge, map(#apply/idle, %1, %b, |), %0, |)
&SORT_LENGTH +QWHO=revwords(munge(#260/sort_munge, map(#lambda/strlen(name(\%0)), %1, %b, |), %0, |), |)
&SPACE +QWHO=X*[space(%0)]
&TRANSPOSE +QWHO=elements(%0%2[repeat(%3%2, %1)], u(transpose`helper, %0, ceil(fdiv(words(%0, %2), %1)), %1), %2)
@set +QWHO/TRANSPOSE=visual
&TRANSPOSE`HELPER +QWHO=vadd(sort(repeat(lnum(1, %1)%b, %2)), repeat(vmul(%1, lnum(%2))%b, %1))
look +QWHO