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

program crashes at if ... then... else command

Started by jelto365, 13 August 2013 - 03:32 PM
jelto365 #1
Posted 13 August 2013 - 05:32 PM
Title: program crashes at if … then… else command

I build a mining machine and used the codes from direwolf20 that he wrote in season 5. But the machine doesn't work verry well for me so i decided to change the codes a little bit to make it work.
The machine is made out of frames and is controlled by one computer. there are 16 turtles that place a miningwell on front of them and put all the items from the miningwell into an enderchest under them.
The problem is some of the turtles can't drop their stuff into the chest and then have to wait with braking the miningwell. But some other turtles can break them and wait for a few secconds and then the machine should move but can't because there are still some miningwells placed. After a few secconds the turtles that could break the miningwells, place them back and so the machine can't move at all.

I had the idea to let all the turtles do their program end after they finished send a signal to the computer. After the computer collected signals from all the 16 turtles it moves the machine wich should be possible because no miningwells are placed. Then after the whole machine moved the computer sends a signal to all the turtles to run the program again.

The problem is I'm not verry good at programming and my program on my computer doesn't work because there should be a mistake in line 9 wich only sais: else
The error is: bios:338: [string "cycle"] :9: syntax error
This is my program:
http://pastebin.com/WB8xMNGw

I really don't know what to do I wached video's on youtube and searched with google to tons off different sites but I couldn't find anything.

sorry for my bad english, I'm from holland

Jelto365
Bubba #2
Posted 13 August 2013 - 06:37 PM
Split into new topic.
nolongerexistant #3
Posted 13 August 2013 - 07:48 PM

function moveon()
   if rednet.recieve() then
	  (j+1)
   else
	  sleep(1)
end

Should be:

function moveon()
   if rednet.receive() then -- You spelled 'receive' wrong
	 j = j + 1 -- Not sure if your method for this works
   else
	  sleep(1)
   end -- You forgot an end
end
jelto365 #4
Posted 23 August 2013 - 12:35 PM
ok, it works now Thanks!!