local camera = peripheral.wrap("right")
local array = " .,-=+xX#"
local monitor = peripheral.wrap("monitor_0")
local yp = 1
monitor.clear()
monitor.setTextScale(0.5)
monitor.setCursorPos(1,1)
for j = -0.35,0.25,0.025 do
for i = -1,1,0.036 do
local d = camera.distance(i, 0-j)
local a = 1
if d > 0 then a = 2 + (8 - math.min(8, (d/1.2))) end
monitor.write(string.sub(array, a, a))
end
yp=yp+1
monitor.setCursorPos(1,yp)
end
How can i get this to work.
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Need help with computronics camera
Started by PatrikF1, 30 January 2015 - 05:03 PMPosted 30 January 2015 - 06:03 PM
I have computronics installed but the sample code doesnt work
Posted 30 January 2015 - 06:03 PM
I have computronics installed but the sample code doesnt work
local camera = peripheral.wrap("right")
local array = " .,-=+xX#"
local monitor = peripheral.wrap("monitor_0")
local yp = 1
monitor.clear()
monitor.setTextScale(0.5)
monitor.setCursorPos(1,1)
for j = -0.35,0.25,0.025 do
for i = -1,1,0.036 do
local d = camera.distance(i, 0-j)
local a = 1
if d > 0 then a = 2 + (8 - math.min(8, (d/1.2))) end
monitor.write(string.sub(array, a, a))
end
yp=yp+1
monitor.setCursorPos(1,yp)
end
How can i get this to work.Edited on 30 January 2015 - 05:08 PM
Posted 30 January 2015 - 06:05 PM
How doesn't it work?
What do you expect it to do, what does it do instead? Does it give an error message? If so, post the complete error.
What do you expect it to do, what does it do instead? Does it give an error message? If so, post the complete error.
Posted 30 January 2015 - 06:09 PM
Its a problem on line 5
Edited on 30 January 2015 - 05:10 PM
Posted 30 January 2015 - 06:10 PM
What do you mean by doesn't work? you get errors thrown at you or everything just stays black?
Posted 30 January 2015 - 06:10 PM
It says Trere is a problem on line 5
Posted 30 January 2015 - 06:15 PM
It says Trere is a problem on line 5
oh my god, be more specific. tell the exact error message and read the pinned topics in ask a pro
Your monitor is not reachable as far as I can tell without having the error message itself. peripheral.wrap("monitor_0") fails to wrap and therefor returns nil I guess.
We need to know the setup: Is the monitor actually connected to the network and by the name "monitor_0" ?
Posted 30 January 2015 - 06:52 PM
In that case, your monitor is probably attached as something other than "monitor_0". Change it to the appropriate side or name.
Posted 30 January 2015 - 07:08 PM
Threads merged. Please stick to one thread for all questions about a given program/concept.