What is it?
The best answer is to look at this discussion to see what it was intended to be, then read the commentary below the tf script (link below) to see what it actually became and why.
In short, it's a separate 'window' (or, in the case of tf, 'window section') which supports streaming data from the MUSH for a 'realtime' display of basically whatever you want.
There is one significant restriction, based on tf limitations: it can only be up to 6 lines high.
Because of this (in an attempt to cooperate with tf defaults for the 'status line'), the scripts contained herein voluntarily limit themselves even further, by leaving 'line 0' alone (line 0 == the default status line in tf) ... further reducing their capacity to 5 or fewer lines.
Without providing actual screenshots, I think that's about the best I can give for a brief description of these pages.
These are softcoded applications which utilize the Status Console.
Since this is such a new thing, much of the initial content of this category is silly, fun exploration of potential. Hopefully, in time, it'll grow to include useful stuff (i.e., right now, I'm having fun playing).
Text:
@@============================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Flying Pig (absolutely worthless as anything other than a console eraser)
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@wait 0=@set me=~:[create(flying pig,10)]
&~`1 [get(me/~)]=SSS_//|.-~~~~-,SSS
&~`2 [get(me/~)]=S_/66SS\SSSSSSS\_@
&~`3 [get(me/~)]=(")_SSS/SSS/SSS|SS
&~`4 [get(me/~)]=SS'--'||S|-\SS/SSS
&~`5 [get(me/~)]=jgsSSS//_/S/_/SSSS
@dol lnum(1,5)=@set [get(me/~)]=~`##:[edit(get(get(me/~)/~`##),S,%b)]
&~`c [get(me/~)]=0
&~`t [get(me/~)]=@assert [null(list(lnum(1, 5), CONSOLE [itext(0)] [mid(setr(p, repeat(chr(160), 78))[get(me/~`[itext(0)])][r(p)], get(me/~`c), 78)])))][set(me, ~`c:[inc(get(me/~`c))])][lte(get(me/~`c), add(78, strlen(get(me/~`1))))]; @tr me/~`t
@startup [get(me/~)]=@tr [set(me, ~`c:0)]me/~`t
@@
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ fast pig
@@
&describe [get(me/~)]=[u(me/~`t)]
&~`T [get(me/~)]=[null(iter(lnum(setr(w, add(setr(m, 77), 18)))[iter(1 2 3 4 5,setq(##,setr(p, space(%qm))[get(me/~`##)]%qp))], list(1 2 3 4 5,CONSOLE [itext(0)] [mid(r(itext(0)),inum(1),%qm)])))]
@@
@@ ===========================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Frogger
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Presently only a single 'fly'
@@ To Do: Frog (client macro to move left/right, and catch flies)
@@ Flies (more flies, and need to deal with catching ^^)
@@ Scoring (pointless, but a good exercise in console management)
@@
@wait 0=@set me=~:[create(Frogger,10)]
@wait 0=@set [get(me/~)]=VT:[chr(247)]
@wait 0=@set [get(me/~)]=VS:[chr(032)]
&VR [get(me/~)]=1
&VC [get(me/~)]=0
&VP [get(me/~)]=CONSOLE
&fly [get(me/~)]=[pemit(owner(me), %vp %vr\,%vc %vs)][set(me, vr:[pickrand(switch(%vr, 1, 1 2, 2, 1 2 3, 3, 2 3 4, 3 4))])][set(me, vc:[pickrand(switch(%vc, 0, 0 1, setr(w, 78), %qw 0, %vc [inc(%vc)]))])][pemit(owner(me), %vp %vr\,%vc %vt)]
&trig [get(me/~)]=@wait 1[null(u(fly))]=@tr me/trig
@@
@@ ===========================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Pong
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ So far, it manages ball travel.
@@ To Do: Paddles (client macros for movement)
@@ Paddles (optional macros for 'English') to add dynamic directioning.
@@ Scorekeeping (somewhat ridiculous and without purpose, since this
@@ will always be either too fast to play, or too slow
@@ to be challenging. still should probably be done as
@@ an exercise in console design)
@@
@wait 0=@set me=~:[create(Pong,10)]
&X [get(me/~)]=6
&Y [get(me/~)]=5
&VX [get(me/~)]=-5
&VY [get(me/~)]=3
@set [get(me/~)]=vs:[chr(032)]
&WX [get(me/~)]=+
&WY [get(me/~)]=0
&XX [get(me/~)]=10
&go [get(me/~)]=[map(go`[set(me, wx:[switch(%vx, -[v(X)], +, [v(X)], -, %wx)])]2, v(players) [v(spectators)])]
&go`2 [get(me/~)]=[pemit(%0, [u(PREFIX,%0)]C%vy\,[add(%vx, %xx)] [switch(%vx, 0, :, %vs)])][set(me, vx:[add(%vx, %wx1)])][set(me, wy:[switch(%vy, 1, +, [v(Y)], -, %wy)])][set(me, vy:[add(%vy, switch(%wy, +, 1, -, -1, 0))])][pemit(%0, [u(PREFIX, %0)] %vy\,[add(%vx, %xx)] *)]
&go`- [get(me/~)]=
&go [get(me/~)]=
&go [get(me/~)]=
&PREFIX [get(me/~)]=CONSOLE
@@
@@ NOTE: TFPREFIX management for PvP gaming can be done by having each
@@ player start the game by entering their TFPREFIXes. These can then
@@ be encrypted using the start time of the game as a key or some such
@@
@@ ===========================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Generic World Info
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Got started (barely) on a generic console for any world. The purpose of
@@ this application is to help advance the tf script for world-awareness.
@@
@wait 0=@set [get(me/~)]=DATA`MUDNAME:[mudname()]
@wait 0=@set [get(me/~)]=DATA`PLAYERNAME:%n
@wait 0=@set [get(me/~)]=DATA`MONEY:[money(me)]
@dolist d h m=@wait 0=@set [get(me/~)]=DATA`CONN`##:0
@dolist d h m=@wait 0=@set [get(me/~)]=DATA`IDLE`##:0
@@
@@ ===========================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Experimental
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ The following code was experimental, and never made it to testing phase
@@ before being uploaded here (i.e., none of this has ever been executed at
@@ all -- it's just a couple lines from notepad that I didn't want to just
@@ discard).
@@ The intended purpose was to eventually define a portion of the above
@@ (Generic World Info) console as multi-purpose area.
@@ This 'banner info' section would have eventually been similar to the kind
@@ of thing seen outside banks (time, temp, messagefoo) as a 'default'.
@@ Then, the same section could be used for 'games' such as Pong and Frogger
@@ (above).
@@
th iter(lnum(1, add(setr(w, width(%#)), setr(l, ~letlen(graceful,this is a test))))[setq(b, ~let(graceful,this is a test))][iter(lnum(1, 4), setq([itext(0)], repeat(chr(160), %qw)[elements(%qb, [itext(0)], %r)][repeat(chr(160), sub(add(%qw, %ql)
@@
&STATUS obj=th [map(#lambda/[lit(pemit(%#, !TFPREFIXC%0 [u(STATUS`%0)]))], lnum(1,4))]
&STATUS`1 obj=[map(#lambda/[lit(u(%0))], lattr(me/STATUS`1`*))]
Text:
@@============================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ stick figure animations
@@ (soon, I hope to convert these from line-based streams to character-
@@ based ones, so that they can be placed in any location on the console.)
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Source of material for 'cartwheel': Unsigned material located at...
@@ http://www.geocities.com/SouthBeach/Marina/4942/ascii.htm
@@
@@ 'Juggle', an original animation by Trispis.
@@ ---------------------------------------------------------------------------
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@wait 0=@set me=~:[create(stickman,10)]
@set [get(me/~)]=!no_command
&A0`1 [get(me/~)]=§§o§§
&A0`2 [get(me/~)]=§/|\§
&A0`3 [get(me/~)]=§/§\§
&A1`1 [get(me/~)]=\§o§/
&A1`2 [get(me/~)]=§§|§§
&A1`3 [get(me/~)]=§/§\§
&A2`1 [get(me/~)]=§_§o§
&A2`2 [get(me/~)]=§§/\§
&A2`3 [get(me/~)]=§|§\§
&A3`1 [get(me/~)]=§§§§§§§
&A3`2 [get(me/~)]=§§___\o
&A3`3 [get(me/~)]=§/)§§|§
&A4`1 [get(me/~)]=§§§__|§§
&A4`2 [get(me/~)]=§§§§§\o§
&A4`3 [get(me/~)]=§§§§§(§\
&A5`1 [get(me/~)]=§§§§§§\§/
&A5`2 [get(me/~)]=§§§§§§§|§
&A5`3 [get(me/~)]=§§§§§§/o\
&A6`1 [get(me/~)]=§§§§§§§§§§|__
&A6`2 [get(me/~)]=§§§§§§§§o/§§§
&A6`3 [get(me/~)]=§§§§§§§/§)§§§
&A7`1 [get(me/~)]=§§§§§§§§§§§§§§
&A7`2 [get(me/~)]=§§§§§§§§§o/__§
&A7`3 [get(me/~)]=§§§§§§§§§|§§(\
&A8`1 [get(me/~)]=§§§§§§§§§§§§o§_
&A8`2 [get(me/~)]=§§§§§§§§§§§§/\§
&A8`3 [get(me/~)]=§§§§§§§§§§§§/§|
&A9`1 [get(me/~)]=§§§§§§§§§§§§\§o§/
&A9`2 [get(me/~)]=§§§§§§§§§§§§§§|§§
&A9`3 [get(me/~)]=§§§§§§§§§§§§§/§\§
&A10`1 [get(me/~)]=§§§§§§§§§§§§§§o§§
&A10`2 [get(me/~)]=§§§§§§§§§§§§§/|\§
&A10`3 [get(me/~)]=§§§§§§§§§§§§§/§\§
@fo me=@edit [get(me/~)]/A*`*=§,[chr(160)]
&cartwheel [get(me/~)]=$cartwheel:@dol lnum(0, 10)=@wait #@=th [null(iter(1 2 3, pemit(%#, CONSOLE [itext(0)] [v(A##`[itext(0)])])))]
@@
&J`0`1 [get(me/~)]=~~~~~~~
&J`0`2 [get(me/~)]=~__O__
&J`0`3 [get(me/~)]=(oo|~o)
&J`0`4 [get(me/~)]=~~/~\
&J`0`5 [get(me/~)]=~_|~|_
@@
&J`1`1 [get(me/~)]=~~~~~o
&J`1`2 [get(me/~)]=~__O__)
&J`1`3 [get(me/~)]=(oo|~~
&J`1`4 [get(me/~)]=~~/~\
&J`1`5 [get(me/~)]=~_|~|_
@@
&J`2`1 [get(me/~)]=~~~~o
&J`2`2 [get(me/~)]=~~_O_
&J`2`3 [get(me/~)]=~(o|o)
&J`2`4 [get(me/~)]=~~/~\
&J`2`5 [get(me/~)]=~_|~|_
@@
&J`3`1 [get(me/~)]=~~~o~~o
&J`3`2 [get(me/~)]=~~_O__/
&J`3`3 [get(me/~)]=~(o|
&J`3`4 [get(me/~)]=~~/~\
&J`3`5 [get(me/~)]=~_|~|_
@@
&J`4`1 [get(me/~)]=~~o~~o
&J`4`2 [get(me/~)]=~~_O__)
&J`4`3 [get(me/~)]=~(o|
&J`4`4 [get(me/~)]=~~/~\
&J`4`5 [get(me/~)]=~_|~|_
@@
&J`5`1 [get(me/~)]=~o~~o
&J`5`2 [get(me/~)]=~~_O_~
&J`5`3 [get(me/~)]=~(o|~)
&J`5`4 [get(me/~)]=~~/~\
&J`5`5 [get(me/~)]=~_|~|_
@@
&J`6`1 [get(me/~)]=~o~~o
&J`6`2 [get(me/~)]=~~_O_~
&J`6`3 [get(me/~)]=~/~|o)
&J`6`4 [get(me/~)]=~~/~\
&J`6`5 [get(me/~)]=~_|~|_
@@
&J`7`1 [get(me/~)]=~~~o~~o
&J`7`2 [get(me/~)]=o~~O__/
&J`7`3 [get(me/~)]=~\/|
&J`7`4 [get(me/~)]=~~/~\
&J`7`5 [get(me/~)]=~_|~|_
@@
&J`8`1 [get(me/~)]=~~o~~o
&J`8`2 [get(me/~)]=~__O__)
&J`8`3 [get(me/~)]=(o~|
&J`8`4 [get(me/~)]=~~/~\
&J`8`5 [get(me/~)]=~_|~|_
@@
&J`9`1 [get(me/~)]=~o~~o
&J`9`2 [get(me/~)]=~~_O_~
&J`9`3 [get(me/~)]=~(o|~)
&J`9`4 [get(me/~)]=~~/~\
&J`9`5 [get(me/~)]=~_|~|_
@@
&J`10`1 [get(me/~)]=~o~~o
&J`10`2 [get(me/~)]=~~_O_~
&J`10`3 [get(me/~)]=~/~|o)
&J`10`4 [get(me/~)]=~~/~\
&J`10`5 [get(me/~)]=~_|~|_
@@
&J`11`1 [get(me/~)]=~~~o
&J`11`2 [get(me/~)]=o~~O_~
&J`11`3 [get(me/~)]=~\/|o)
&J`11`4 [get(me/~)]=~~/~\
&J`11`5 [get(me/~)]=~_|~|_
@@
&J`12`1 [get(me/~)]=~~o
&J`12`2 [get(me/~)]=~__O_~
&J`12`3 [get(me/~)]=(o~|o)
&J`12`4 [get(me/~)]=~~/~\
&J`12`5 [get(me/~)]=~_|~|_
@@
&J`13`1 [get(me/~)]=~o
&J`13`2 [get(me/~)]=~~_O_~
&J`13`3 [get(me/~)]=~(o|o)
&J`13`4 [get(me/~)]=~~/~\
&J`13`5 [get(me/~)]=~_|~|_
@@
&J`14`1 [get(me/~)]=~
&J`14`2 [get(me/~)]=o~_O__~
&J`14`3 [get(me/~)]=~/~|oo)
&J`14`4 [get(me/~)]=~~/~\
&J`14`5 [get(me/~)]=~_|~|_
@@
&J`15`1 [get(me/~)]=~
&J`15`2 [get(me/~)]=~__O_~
&J`15`3 [get(me/~)]=o~~|o)
&J`15`4 [get(me/~)]=~~/~\o
&J`15`5 [get(me/~)]=~_|~|_
@@
&J`16`1 [get(me/~)]=~
&J`16`2 [get(me/~)]=~__O_~
&J`16`3 [get(me/~)]=~~~|~\
&J`16`4 [get(me/~)]=o~/~\o
&J`16`5 [get(me/~)]=~_|~|_o
@@
&J`17`1 [get(me/~)]=~
&J`17`2 [get(me/~)]=~\_O_/
&J`17`3 [get(me/~)]=~~~|~
&J`17`4 [get(me/~)]=~~/~\
&J`17`5 [get(me/~)]=o_|~|_oo
@@
&J`18`1 [get(me/~)]=~
&J`18`2 [get(me/~)]=~~_O_
&J`18`3 [get(me/~)]=~<~|~>
&J`18`4 [get(me/~)]=~~/~\
&J`18`5 [get(me/~)]=o_|~|_oo
@wait 0=@edit [get(me/~)]/J*=~,%b
@@
&juggle [get(me/~)]=$juggle:@dol lnum(0, 18)=@wait #@=th null(iter(1 2 3 4 5, pemit(%#, CONSOLE [itext(0)] [v(J`##`[itext(0)])])))
@@============================================================================
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ ---------------------------------------------------------------------------
@@ Boot Wizard: an original animation - sad hack PD2007.
@@
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@ NOTE: This uses the following, slightly different, input definition:
@@
@@ /def -ag -mregexp -t'CONSOLE R([1-5])C(\d+) (.+)' statstuffbychar = \
@@ etc.
@@
@@ The purpose for this modified version is to circumvent complications from
@@ having to escape commas.
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
@@
&bootwiz [get(me/~)]=$bootwiz:@dolist 0 1=@wait [mul(##,10)]=@tr me/S`##=%#
@@
&UFUN`CENTER [get(me/~)]=[setq(w, switch(width(%#), *, 77))][setq(m, mod(%qw, 2))][setq(c, add(%qm, div(sub(%qw, %qm), 2)))]%qc
@@
&UFUN`CLEARLINE [get(me/~)]=CONSOLE %0 [chr(160)]
@@
&S`0 [get(me/~)]=@dolist [iter(1 2 3 4 5, pemit(setr(u, %0), CONSOLE [itext(0)] [chr(160)]))][lnum(1, 9)]=@wait ##=th [null(iter(get(me/S`0`F`##), [pemit(%qu, CONSOLE R[first(first(itext(0)), .)]C[add(%vc, rest(first(itext(0)), .))] [edit(iter(rest(itext(0)), ansi(first(itext(0), .), chr(rest(itext(0), .)))),%b,)])],|))]
@@
&S`0`F`1 [get(me/~)]=5.0 .046
@@
&S`0`F`2 [get(me/~)]=5.0 .111
@@
&S`0`F`3 [get(me/~)]=5.-1 .111 .056 .111
@@
&S`0`F`4 [get(me/~)]=4.-1 .111 .244 .111|5.-2 .111 .056 .056 .056 .111
@@
&S`0`F`5 [get(me/~)]=3.-1 .095 .212 .095|4.-2 .111 .056 .056 .056 .111|5.-3 .111 .056 .056 .056 .056 .056 .111
@@
&S`0`F`6 [get(me/~)]=2.-1 .095 .212 .095|3.-2 .047 .160 .089 .160 .092|4.-2 .046 .111 .056 .111 .046|5.-3 .046 .111 .056 .056 .056 .111 .046
@@
&S`0`F`7 [get(me/~)]=2.-3 .119 .095 .095 .212 .095 .095 .119|3.-2 .092 .095 .089 .095 .047|4.-2 .160 .047 .095 .092 .160|5.-3 .046 .111 .056 .056 .056 .111 .046
@@
&S`0`F`8 [get(me/~)]=1.-3 .109 .160 .160 .160 .160 .160 .109|2.-3 .160 .124 .092 .212 .047 .124 .160|3.-2 .160 .092 .089 .047 .160|5.-3 .046 .095 .047 .160 .092 .095 .046
@@
&S`0`F`9 [get(me/~)]=1.-3 .160 .095|1.2 .095 .160|2.-3 .109 .095|2.2 .095 .109|3.-3 bh.042|3.3 bh.042|5.-3 .160|5.3 .160
@@
&S`1 [get(me/~)]=@tr me/S`1`F`3=%0,3
@@
&S`1`F`3 [get(me/~)]=@dol 1 2=@wait ##=@tr me/S`1`F`3`##=%0,3
@@
&S`1`F`3`1 [get(me/~)]=@dolist [lnum(sub(%vc, 4), 0)]=@wait 0=@pemit %0=CONSOLE R%1C[setr(c, ##)] [edit(iter(lnum(sub(%vc, 4), %qc), [ansi(pickrand(r y g c b m), pickrand(+ ~ ^ -))]),%b,)]
@@
&S`1`F`3`2 [get(me/~)]=@dolist h a c k [iter(lnum(5,sub(%vc,4)),.)]=@wait 0=@pemit %0=CONSOLE R%1C[dec(setr(c,#@))] [switch(##,.,chr(160),##)][edit(iter(lnum(%qc,sub(%vc,4)),[ansi(pickrand(r y g c b m),pickrand(+ ~ ^ -))]),%b,)]
Text:
Based on the tf work at http://community.pennmush.org/node/481
I've done something similar for MUSHclient. This supports both the C# and C#,# protocols
The script below requires you to create a dummy work "status" (ip 0.0.0.0) and open it up and position it as your status console. The script will write to that world. You copy the script to your clipboard, and then open the Triggers window in your real mush world and hit 'Paste'. You must have Lua scripting enabled in the world's configuration. Replace "TFPREFIX" below with your actual desired secret
Current limitations: It's slower than the tf one, so fast animations (like the fast pig) may not work as mushclient won't trigger fast enough.
Also the regular flying pig behaves a bit weirdly at start and I don't know why. The frogger app works fine.
<triggers>
<trigger
enabled="y"
match="^!TFPREFIXC(\d+) (.*)"
omit_from_output="y"
regexp="y"
send_to="14"
sequence="100"
>
<send>
local w = GetWorld ("status") -- get "status" world
if w then -- if present
style = {}
myline = tonumber("%1")
total_lines = w:GetLinesInBufferCount ()
if total_lines > 5 then
total_lines = 5
end
for line = 1, total_lines do
style[line] = w:GetStyleInfo(line) -- A table of tables
end
if total_lines < myline then
total_lines = myline
end
w:DeleteOutput()
for line = 1, total_lines do
styleruns = style[line]
if line == myline then
styleruns = TriggerStyleRuns
end -- if
for _,v in ipairs (styleruns) do
v.text = string.gsub(v.text,"^!TFPREFIXC[0-9][0-9]* ","")
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run
w:Note ("") -- wrap up line
end -- for line
end -- world found
</send>
</trigger>
<trigger
enabled="y"
match="^!TFPREFXC(\d+),(\d+) (.*)"
omit_from_output="y"
regexp="y"
send_to="14"
sequence="100"
>
local w = GetWorld ("status") -- get "status" world
if w then -- if present
style = {}
myline = tonumber("%1")
mychar = tonumber("%2")+1
mylen = string.len("%3")
total_lines = w:GetLinesInBufferCount ()
if total_lines > 5 then
total_lines = 5
end
for line = 1, total_lines do
style[line] = w:GetStyleInfo(line)
end
if total_lines < myline then
total_lines = myline
end
w:DeleteOutput()
for line = 1, total_lines do
if (line == myline) then
-- First, identify at what style runs (by column) the new text will start and stop
-- It's the starting column if this style run includes mychar
-- It's the end column if this style run includes mychar+mylen
-- Also identify where in each style run (how many chars in)
startcol = -1
startchar = 1
endcol = -1
endchar = 1
for _,v in ipairs (style[line]) do
if (startcol == -1 and v.column <= mychar and v.column+v.length >= mychar) then
startcol = v.column
startchar = mychar - v.column
end
if (endcol == -1 and v.column <= mychar+mylen and v.column+v.length >= mychar+mylen) then
endcol = v.column
endchar = mychar + mylen - v.column + 1
end
lastindex = _
end -- for
if (startcol == -1) then
-- Oops, we're trying to write beyond the last column! So we'll extend the last style run's
-- text and length
v = style[line][lastindex]
extraneeded = mychar + mylen - v.column + v.length
style[line][lastindex].text = v.text .. string.rep(" ",extraneeded)
style[line][lastindex].length = v.length + extraneeded
startcol = v.column
startchar = mychar - v.column
endcol = v.column
endchar = v.length
end
if (endcol == -1) then
-- Oops, we've started somewhere, but are trying to write beyond the last column.
-- We'll extend it, as above.
v = style[line][lastindex]
extraneeded = mychar + mylen - v.column + v.length
style[line][lastindex].text = v.text .. string.rep(" ",extraneeded)
style[line][lastindex].length = v.length + extraneeded
endcol = v.column
endchar = v.length
end
inserted = 0
for _,v in ipairs (style[line]) do
if (v.column == startcol) then
-- show up to startchar
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
string.sub(v.text,1,startchar))
-- insert here
for x,v2 in ipairs (TriggerStyleRuns) do
v2.text = string.gsub(v2.text,"^!TFPREFIXC[0-9][0-9]*,[0-9][0-9]* ","")
w:ColourTell (RGBColourToName (v2.textcolour),
RGBColourToName (v2.backcolour),
v2.text)
end -- for
inserted = 1
end -- v.column == startcol
if (inserted == 0 or v.column >= endcol) then
-- regular style runs here, possibly with a partial column starting at endchar
if (v.column == endcol) then
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
string.sub(v.text,endchar,v.length))
else
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end
end -- not inserted or v.column >= endcol
end -- for
else -- if line == myline
for _,v in ipairs (style[line]) do
w:ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
v.text)
end -- for each style run
end -- if line == myline
w:Note ("") -- wrap up line
end -- for line
end -- world found
</send>
</trigger>
</triggers>
Text:
; ..:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
;
; Cleaning up after the party, we have this functional script.
;
; apparently, tf restricts status_height to <= 6. so, we use that.
; (discovered by Javelin)
;
/set status_height=6
;
; ..:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
; Now, we trigger on receiving data matching
;
; !<TFPREFIX>C<n> <data>
;
; (where TFPREFIX is a secret set by each user, and 'C' is the
; 'CONSOLE' identifier for tf)
;
; since TFPREFIX isn't actually required for this, I suggest using
; something else altogether, so as to separate the protocol entirely
; from @dec/tf.
; -hack
;
; and then display data on line n (from 0-6), replacing anything
; already on that line.
;
/for r 1 4 /status_add -c -r%{r} data_%{r}:$[columns()]
/for r 1 4 /set data_%{r}=$[pad(" ",-columns())]
/def -ag -mregexp -t'!TFPREFIXC(\d+) (.*)' statstuff = \
/set data_%P1=$[pad({P2},-columns())]
;
; (this section written by Javelin)
; ..:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
; The protocol has been extended to support placing a string at
; row X, column Y (where the first column is 0), making this optional method
; take the format
;
; !<TFPREFIX>C<Row#>,<Col#> <data>
;
; the data can be a string and it will be placed into position as though
; typed in in 'typeover' mode (i.e., without modifying any of the surrounding
; text).
;
/def -ag -mregexp -t'!TFPREFIXC(\d+),(\d+) (.+)' statstuffbychar = \
/set dataname=data_%P1 %; \
/eval /set old_data=%%{%{dataname}} %; \
/set newlen=$[strlen(%P3)] %; \
/set data_%P1=$[strcat(substr({old_data}, 0, {P2}), {P3}, substr({old_data}, {P2}+{newlen}, columns()))]
;
; (this section drafted by Javelin and debugged by Trispis)
;
; NOTE: The above code potentially can
; overwrite any data_# tf variable.
; If more protection is needed,
; the first (\d+) in the trigger
; pattern could be changed to
; ([1-5]) or something. - Jav
; ..:....1....:....2....:....3....:....4....:....5....:....6....:....7....:...
; Things left to do:
; Make it world-aware -- console only being visible when toggled to
; the world feeding it. This means different consoles for different
; worlds.
; Make it go away when not in use.
; Make cool stuff to use it.