Posted 28 May 2013 - 10:37 AM
Hey. I have a very limited knowledge of coding, so be easy on me ;)/>
So, I've been trying to resolve an issue for a while now where I call a function to check how many items are in a turtle. Initially, it worked perfectly. Like an idiot, I changed all the code as I went along, not keeping backups and I've hit multiple issues now.
Each time I ran the program to test, it acted as though it was doing x = x + i each time (Which I tried to correct by adding x = 0 before calling x = x + i, though this only ever gave me 0, or whatever number I specified x was initially)
I don't know, my brain is worn out atm, and would like another pair of eyes to take a quick glance, call me an idiot, and tell me where I made the simple mistake…
The pastebin for the full program is: http://pastebin.com/P6PnuB1Z
The code without any attempted fix is:
So, I've been trying to resolve an issue for a while now where I call a function to check how many items are in a turtle. Initially, it worked perfectly. Like an idiot, I changed all the code as I went along, not keeping backups and I've hit multiple issues now.
Each time I ran the program to test, it acted as though it was doing x = x + i each time (Which I tried to correct by adding x = 0 before calling x = x + i, though this only ever gave me 0, or whatever number I specified x was initially)
I don't know, my brain is worn out atm, and would like another pair of eyes to take a quick glance, call me an idiot, and tell me where I made the simple mistake…
The pastebin for the full program is: http://pastebin.com/P6PnuB1Z
The code without any attempted fix is:
function checkPathBlocks()
for i = 1,5 do
pathBlockCheckA =pathBlockCheckA + turtle.getItemCount(i)
end
for i = 6,10 do
pathBlockCheckB = pathBlockCheckB + turtle.getItemCount(i)
end
for i = 11,15 do
pathBlockCheckC = pathBlockCheckC + turtle.getItemCount(i)
end
end