its not working.. can anyone take a peek and check if something is wrong?
Spoiler
Posted 27 March 2012 - 04:04 PM
Posted 27 March 2012 - 04:35 PM
Posted 27 March 2012 - 04:42 PM
Posted 27 March 2012 - 04:55 PM
term.clear()
term.setCursorPos(1,1)
print("Area?")
o = read()
o = b -- b is nil, now o is nil also, user input lost
a = tonumber(o)
b = tonumber(o) / 2 -- shorter way: b = a / 2
x = 0
y = 0
s = 1
while y < b do -- it could be a for loop: for y = 0, b do
y = y + 1 -- remove if using for
while x < a do -- infinite loop, x never changes
turtle.forward()
turtle.placeDown()
if turtle.getSlotcount() == 0 then -- getSlotcount doesn't exists, it's getItemCount
s = s + 1
turtle.selectSlot("s") -- "s" is a string, remove the quotes to use the variable
else -- else what?
end
q = bit.band(y, 1)
if q == ("1") then -- q is a number, "1" is a string, q will never be "1"
turtle.turnRight()
turtle.forward()
turtle.turnRight()
elseif q == ("0") then -- same as above
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
end
-- end missing
You should also try to use local variables when possible:local n = 10 local o = read()And try to indent the code to check that all the end's are in the right place.
Posted 27 March 2012 - 05:15 PM
Posted 27 March 2012 - 05:28 PM
0 members, 1 guests, 0 anonymous users