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

Using the FS Api to save progress in RiM door, not working

Started by kingculta, 18 April 2014 - 08:56 PM
kingculta #1
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
CometWolf #2
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
kingculta #3
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
KingofGamesYami #4
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
CometWolf #5
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.