ID:2299038
 
(See the best response by Ter13.)
Code:
world
proc/worldticker()
//Do what the genes do
for(var/obj/particles/Gene/g in world)
g.Transcribe()
//Set every client's window right
for(var/mob/observer/o in world)
winset(o.client,"default.worldstats","text='FPS: [world.fps] Lag: [world.tick_lag] Tick: [20*tick_lag]'")
if(o.observedcell)
o.RefreshCell()
o.RefreshCompartments()
if(o.observedgene) o.RefreshGenes()
//Retrigger the loop
spawn(20*tick_lag) worldticker()

mob/observer
proc
RefreshGenes()
var/seq=observedgene.sequence
seq=replacetextEx(seq,"A","<div style='color:#0000FF'>A</div>")
seq=replacetextEx(seq,"T","<div style='color:#DDDD00'>T</div>")
seq=replacetextEx(seq,"C","<div style='color:#FF0000'>C</div>")
seq=replacetextEx(seq,"G","<div style='color:#00DD00'>G</div>")
winset(src,null,"genemodder.genename.text='[observedgene.name]';genemodder.protname.text='[observedgene.protname]';genemodder.outputseq.text='AAAAA'")
winset(src,"genemodder","outputseq.text='WORK ALREADY'")
src << output("3'-[seq]-5'","genemodder.outputseq")


Problem description:

I am trying to get the output to refresh via a proc linked to a loop that actualizes all the stuff ingame without adding the new text to the old one, in case a mutation of a gene suddenly occurs on a tick. However, the old text is never deleted and the new one is placed right below it. Any way to clear an output?
Best response
You can clear all output to an output element with:

mob << output(null,"id")


where id is the output element's id in the skin. There is no way to clear a specific line or character in an output.
Thanks. Besides, does that null also work with grids?
Yep.
Hey there. It's been a while, but I got to code some more. However I have another question about that null thing and grids: Here's what I tried:



Problem is that this apparently only deletes 1 cell instead of wiping the whole grid off. So I wanted to know if there is a way to wipe the grid with output aswell. I tried making a loop based on the grid.cells, but it causes massive lag. The other method I used in the script below is extremely jittery and therefore not that handy as menu:
mob/observer
proc
RefreshCompartments()
//Cytosol refreshed
winset(src,"cytosolpane.cytosolprots","cells=1x1")
src << output(null,"cytosolpane.cytosolprots")
var/column=0
var/rows=1
for(var/obj/particles/n in src.observedcell.cytosol)
column++
if(column>6)
rows++
column=1
src << output(n,"cytosolpane.cytosolprots:[column],[rows]")
/*
//empty the other cells
while("[column]x[rows]"!=winget(src,"cytosolpane.cytosolprots","cells"))
column++
src << output(null,"cytosolpane.cytosolprots:[column],[rows]")
if(column>6)
rows++
column=1
*/


//Membrane refreshed
winset(src,"membranepane.membraneprots","cells=1x1")
src << output(null,"membranepane.membraneprots")
column=0
rows=1
for(var/n in src.observedcell.membrane)
column++
if(column>6)
rows++
column=1
src << output(n,"membranepane.membraneprots:[column],[rows]")


//Nucleus refreshed
winset(src,"nucleuspane.nucleusprots","cells=1x1")
src << output(null,"nucleuspane.nucleusprots")
column=0
rows=1
for(var/n in src.observedcell.nucleus)
column++
if(column>6)
rows++
column=1
src << output(n,"nucleuspane.nucleusprots:[column],[rows]")