This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Goof's profile picture

term.clearPixel(x,y) Only clear 1 pixel at a time.

Started by Goof, 04 January 2013 - 07:39 AM
Goof #1
Posted 04 January 2013 - 08:39 AM
Hi….


I dont find this suggestion anywhere, so i would quickly suggest this…
It would be better, if i could type in

>term.clearPixel(1,6) 
then the pixel / cell at position 1,6 would be removed, for letters/symbols, etc.

would this be added in any newer updates?

Thanks :D/>
dissy #2
Posted 04 January 2013 - 08:49 AM
You can add this functionallity yourself:

term.setCursorPos(1,6)
term.write(" ")

Edit: If you wish to have it as a single command, prepend this to your program:

function clearPixel(x,y)
  local oldX,oldY = term.getCursorPos()
  term.setCursorPos(x,y)
  term.write(" ")
  term.setCursorPos(oldX,oldY)
end
Goof #3
Posted 04 January 2013 - 01:10 PM
Yeah. I did know that. But i think it would be a bit easier to just type in
term.clearPixel(1,6)
–other stuff

but anyway.
thanks
Cloudy #4
Posted 04 January 2013 - 02:01 PM
The point is you code something yourself. We aren't going to help you with every single thing.
Lyqyd #5
Posted 04 January 2013 - 02:19 PM
Yeah. I did know that. But i think it would be a bit easier to just type in
term.clearPixel(1,6)
–other stuff

but anyway.
thanks

Put his code in your startup, slightly modified. There, magic new useless term command.


local function clearPixel(x,y)
  local oldX,oldY = term.getCursorPos()
  term.setCursorPos(x,y)
  term.write(" ")
  term.setCursorPos(oldX,oldY)
end

rawset(term, "clearPixel", clearPixel)