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

i need help

Started by weemartin2001, 06 December 2013 - 01:41 PM
weemartin2001 #1
Posted 06 December 2013 - 02:41 PM
i keep getting

bios:337: [string"startup"]:7: syntax error

please help
Edited on 06 December 2013 - 10:22 PM
Lyqyd #2
Posted 06 December 2013 - 02:43 PM
Please post the rest of the code.
weemartin2001 #3
Posted 06 December 2013 - 02:51 PM
the pastebin is:
pastebin get dBzApegq startup
you will need these as well:
pastebin get R8Yd2A8u hand
pastebin get 2WeaxMbP handGood
pastebin get VKqCGrF7 handBad
Timendainum #4
Posted 06 December 2013 - 03:25 PM
On line 7 you are calling:

radar = sensor.wrap("right")

Is the OCS api actually loading when you call it on the first line? The OCS files do not appear on the computer unless it sees a valid sensor connected to the computer. But the error you are getting looks like it thinks "sensor" is undefined.
weemartin2001 #5
Posted 06 December 2013 - 04:42 PM
no on line 7 i have door.setTextScale(0.5)

it is line 5 sorry

i got this of a youtuber named vgtoolbox here is a link to there video
http://www.youtube.com/watch?v=FXL1T5rRurI
weemartin2001 #6
Posted 06 December 2013 - 05:10 PM
i managed to fix to but now it says

term:16: invalid redirect object

help please
Bomb Bloke #7
Posted 06 December 2013 - 05:30 PM
Sounds like you're trying to use term.redirect() incorrectly. Make sure the object you're passing it is a valid monitor, and not, for example, nil.
weemartin2001 #8
Posted 06 December 2013 - 11:35 PM
i fixed that but now to says

bios:337: [string"startup"]:7: syntax error

can you help me with that
Edited on 06 December 2013 - 10:46 PM
Lyqyd #9
Posted 06 December 2013 - 11:45 PM
Every time you change the code, you need to post the code again.
weemartin2001 #10
Posted 07 December 2013 - 12:00 AM
here is the paste bin
pastebin get VKqCGrF7 handBad
pastebin get 2WeaxMbP handGood
pastebin get R8Yd2A8u hand

pastebin get dBzApegq start
up
use these in computer craft

i keep getting

bios:337: [string"startup"]:7: syntax error
Kingdaro #11
Posted 07 December 2013 - 12:37 AM
There's nothing wrong with those links. We're asking for your code, as in, what's on your computer, not the downloads from that video.
weemartin2001 #12
Posted 07 December 2013 - 12:52 AM
that is the code i have
Lyqyd #13
Posted 07 December 2013 - 12:59 AM
Those are the same links you posted earlier, but you're saying you are getting different errors now. If you don't give us the code that you're actually using, that's actually causing those errors, we can't help you diagnose the problem.
weemartin2001 #14
Posted 07 December 2013 - 02:09 AM
os.loadAPI("ocs/apis/sensor")


door = peripheral.wrap("monitor_0")
door,setTextScale(0.5)

radar = sensor.wrap("right")

allow = {}
allow.weemartin2001 = true

avoid = {}
avoid.kingdylon31 = true

xMin = -5
xMax = -1
zMin = -6
zMax = -4

term.redirect(door)

handGood = paintutils.loadimage("handgood")
handBad = paintutils.loadimage("handBad")
handNormal = paintituls.loadimage("hand")

paintutils.drawImage(handNormal,1,1)


local function checkInRange(number, min, max)

return number >= min and number <= max

end

local function checkTargets(targets, compare)

for k,v in pairs(compare) do

if targets[k] then
–print(targets[k].position.x," ", targets[k].position.Z)
–sleep(8)
if checkInRange(targets[k].position.Z, yMin, yMax) then
return true

end

end

end

end

return false

end

while true do

timer = os.startTimer(9)

e, k = os.pullEvent()

if e == "monitor_touch" then
if checkTargets(radar.getTargets(),allow) and not checkTargets(radar.getTargets(), avoid) then
paintutils.drawImage(handGood, 1,1)
rs.setOutput("front", true)
sleep(2)
else
paintutils.drawImage(handBad, 1,1)
sleep(3)
os.reboot()

end
end
end
Bomb Bloke #15
Posted 07 December 2013 - 08:09 AM
door,setTextScale(0.5)
Comma?

Note that just because an error message tells you the issue is on a given line, doesn't mean the issue is on that line - commands can take multiple lines, so if you don't finish one properly, Lua will expect you to finish it later, then error out at the point where it realises that's not going to happen. As a general rule, if you can't spot an obvious issue with the line it complains about then you should check the one above it.
weemartin2001 #16
Posted 11 December 2013 - 01:30 PM
os.loadAPI("ocs/apis/sensor")


door = peripheral.wrap("monitor_0")
door.setTextScale(0.5)

radar = sensor.wrap("right")

allow = {}
allow.weemartin2001 = true

avoid = {}
avoid.kingdylon31 = true

xMin = -5
xMax = -1
zMin = -6
zMax = -4

term.redirect(door)

handGood = paintutils.loadimage("handgood")
handBad = paintutils.loadimage("handBad")
handNormal = paintituls.loadimage("hand")

paintutils.drawImage(handNormal,1,1)


local function checkInRange(number, min, max)

return number >= min and number <= max

end

local function checkTargets(targets, compare)

for k,v in pairs(compare) do

if targets[k] then
–print(targets[k].position.x," ", targets[k].position.Z)
–sleep(8)
if checkInRange(targets[k].position.Z, yMin, yMax) then
return true

end

end

end

end

return false

end

while true do

timer = os.startTimer(9)

e, k = os.pullEvent()

if e == "monitor_touch" then
if checkTargets(radar.getTargets(),allow) and not checkTargets(radar.getTargets(), avoid) then
paintutils.drawImage(handGood, 1,1)
rs.setOutput("front", true)
sleep(2)
else
paintutils.drawImage(handBad, 1,1)
sleep(3)
os.reboot()

end
end
end


i fixed that