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

Need help with computronics camera

Started by PatrikF1, 30 January 2015 - 05:03 PM
PatrikF1 #1
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.
PatrikF1 #2
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
KingofGamesYami #3
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.
PatrikF1 #4
Posted 30 January 2015 - 06:09 PM
Its a problem on line 5
Edited on 30 January 2015 - 05:10 PM
InDieTasten #5
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?
PatrikF1 #6
Posted 30 January 2015 - 06:10 PM
It says Trere is a problem on line 5
InDieTasten #7
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" ?
KingofGamesYami #8
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.
Lyqyd #9
Posted 30 January 2015 - 07:08 PM
Threads merged. Please stick to one thread for all questions about a given program/concept.