6 posts
Posted 18 April 2014 - 10:56 PM
I am trying to create a frame door using Redstone in Motion and computercraft. I have a program written (
http://pastebin.com/TW4wMZZi) which I want to make the door move up 2 at a time in one motion, however, the door only ever moves up once and I'm not sure why. If someone could help I would be very grateful. Thanks
1281 posts
Posted 18 April 2014 - 11:11 PM
You can't compare a string to an undefined variable and expect it to return true :P/>
if upProgress == hello then
hello --this
"hello" --is not the same as this
6 posts
Posted 19 April 2014 - 12:15 AM
That was an attempt to fix it when the string wasn't comparing to the string, even when the comparison should be correct, it doesn't move the two blocks
3057 posts
Location
United States of America
Posted 19 April 2014 - 01:51 AM
Wouldn't it be easier to use a For loop? an example:
file = fs.open("upProgress", "w")
for i = 1, 2 do -- i starts at 1, increases by 1 each time the loop runs. If i == 2 then the loop will stop
file.write( i - 1 )
file.close()
drive = peripheral.wrap("left")
drive.move(1, false, true)
end
1281 posts
Posted 19 April 2014 - 09:38 AM
For loop won't work. RiM platforms makes the computer reboot when it moves, hence the need to save it's state everytime.