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

How to print this on a a monitor

Started by Blade_Black, 28 August 2012 - 01:05 PM
Blade_Black #1
Posted 28 August 2012 - 03:05 PM
On my server i wanted to try to make a virus just for fun and i wanted to display it on a big monitor but i didnt figured out how.

Code:


a = 0
term.clear()
while true do
if a == 100 then
term.clear()
a = 0
end
term.setCursorPos(15.9)
print("Virus Detected...Auto-Destruct Enabled")
x = math.random(1,16)
y = math.random(1,50)
term.setCursorPos(y,x)
print("0")
sleep(.000000000000000000000000000000000000000000000000)
a = a + 1
end


Thx For your time
-Blade_Black
sjele #2
Posted 28 August 2012 - 03:27 PM

mon = pheripheral.wrap("side") --Change side to what side monitor is on
a = 0
term.clear()
while true do
if a == 100 then
term.clear()
a = 0
end
term.setCursorPos(15.9)
mon.write("Virus Detected...Auto-Destruct Enabled")
x = math.random(1,16)
y = math.random(1,50)
term.setCursorPos(y,x)
mon.write("0")
sleep(.000000000000000000000000000000000000000000000000)
a = a + 1
end
Blade_Black #3
Posted 28 August 2012 - 04:25 PM
It gives me a error:

startup:1: attempt to index ? (a nil value)
ThinkInvisible #4
Posted 28 August 2012 - 04:30 PM
peripheral, not pheripheral.
Blade_Black #5
Posted 28 August 2012 - 04:34 PM
One more thing… The program should spam wiht 0 in different zones but it doesnt even shows the full text (Virus detected)
Dirkus7 #6
Posted 28 August 2012 - 04:48 PM
Shouldn't it be mon.setCursorPos(x,y) instead of term.setCursorPos(x,y)?
sjele #7
Posted 28 August 2012 - 04:55 PM
Shouldn't it be mon.setCursorPos(x,y) instead of term.setCursorPos(x,y)?
It should. I over looked it.
peripheral, not pheripheral.
Ops. my bad. Thanks
Blade_Black #8
Posted 28 August 2012 - 04:55 PM
It didnt worked
it gives me another error:

startup:1: attempt to index ? (a nil value)

can you post the whole code?
sjele #9
Posted 28 August 2012 - 05:07 PM

mon = peripheral.wrap("side") --make the first line this. REpleace the exisisting one. Change side to what side monitor is on.
cant_delete_account #10
Posted 28 August 2012 - 06:43 PM
Just use:

local mon = peripheral.wrap("side") -- change side to side of monitor
term.redirect(mon)
local a = 0
term.clear()
while true do
if a == 100 then
term.clear()
a = 0
end
term.setCursorPos(15.9)
print("Virus Detected...Auto-Destruct Enabled")
x = math.random(1,16)
y = math.random(1,50)
term.setCursorPos(y,x)
print("0")
sleep(.000000000000000000000000000000000000000000000000)
a = a + 1
end
term.restore()