6 posts
Posted 06 June 2014 - 01:19 AM
so i have this (probably pretty crappy) code that returns the bios:339: [string "miner"]:72: '=' expected error. i have looked in the forums and this seems to correspond with a missing parenthesis however i am unable to find it. if anyone could help it would be much appreciated (please excuse my probably poorly written code)
the code is as follows:
function checkfuel()
FuelLevel = turtle.getFuelLevel()
if FuelLevel > 0 then
return false
else return true
end
end
function checkitems()
slot3 = turtle.getItemCount(3)
slot4 = turtle.getItemCount(4)
slot5 = turtle.getItemCount(5)
slot6 = turtle.getItemCount(6)
slot7 = turtle.getItemCount(7)
slot8 = turtle.getItemCount(8)
slot9 = turtle.getItemCount(9)
slot10 = turtle.getItemCount(10)
slot11 = turtle.getItemCount(11)
slot12 = turtle.getItemCount(12)
slot13 = turtle.getItemCount(13)
slot14 = turtle.getItemCount(14)
slot15 = turtle.getItemCount(15)
slot16 = turtle.getItemCount(16)
if slot3==0 or slot4==0 or slot5==0 or slot6==0 or slot7==0 or slot8==0 or slot9==0 or slot10==0 or slot11==0 or slot12==0 or slot13==0 or slot14==0 or slot15==0 or slot16==0 then
return false
else return true
end
end
function maintain()
if checkfuel() then
turtle.select(1)
turtle.refuel(1)
end
if checkitems() then
turtle.select(2)
turtle.placeDown()
turtle.select(3)
turtle.dropDown()
turtle.select(4)
turtle.dropDown()
turtle.select(5)
turtle.dropDown()
turtle.select(6)
turtle.dropDown()
turtle.select(7)
turtle.dropDown()
turtle.select(8)
turtle.dropDown()
turtle.select(9)
turtle.dropDown()
turtle.select(10)
turtle.dropDown()
turtle.select(11)
turtle.dropDown()
turtle.select(12)
turtle.dropDown()
turtle.select(13)
turtle.dropDown()
turtle.select(14)
turtle.dropDown()
turtle.select(15)
turtle.dropDown()
turtle.select(16)
turtle.dropDown()
end
end
fuction checking()
if checkfuel() or checkitems() then
return false
else return true
end
end
while checking() do
turtle.dig()
turtle.foward()
turtle.digDown()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.down()
turtle.dig()
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.up()
maintain()
end
end
EDIT: fixed now, thanks for the help
[indent=1]
thanks for any help![/indent]
Edited on 06 June 2014 - 11:47 PM
8543 posts
Posted 06 June 2014 - 01:21 AM
Your code is poorly formatted, but is this line 72?
fuction checking()
If so, you've misspelled "function".
70 posts
Location
Solitude, Skyrim
Posted 06 June 2014 - 01:52 AM
right here:
fuction checking()
"function" spelled wrong
6 posts
Posted 06 June 2014 - 02:09 AM
thanks
wow that derp :P/>
7508 posts
Location
Australia
Posted 06 June 2014 - 02:14 AM
for the future themalt101 please use [
code][
/code] tags around your code, and if the script is quite large use
pastebin they both make your code more readable and thus make it quicker and easier for us to help.
6 posts
Posted 06 June 2014 - 04:22 AM
the while loop is not working for me returns attempt to call nil error, could someone tell me how to execute that section of code after the while command continuously until check() is false?
this is the pastebin site :
http://pastebin.com/8KXD0jXd
6 posts
Posted 06 June 2014 - 06:06 AM
Your code is poorly formatted, but is this line 72?
fuction checking()
If so, you've misspelled "function".
could you help me figure out what is wrong with the rest of my code?
also thanks for helping me the first time, seems i need to learn how to spellcheck
7508 posts
Location
Australia
Posted 06 June 2014 - 06:17 AM
in that paste you've still spelt function incorrectly for the check function. is this your latest code?
Edited on 06 June 2014 - 04:17 AM
6 posts
Posted 06 June 2014 - 07:02 AM
in that paste you've still spelt function incorrectly for the check function. is this your latest code?
oh sorry, this isn't the latest code, in my latest I fixed the spelling mistake and now it returns attempt to call nil error
I'm unsure what is going wrong…
7508 posts
Location
Australia
Posted 06 June 2014 - 07:12 AM
oh sorry, this isn't the latest code, in my latest I fixed the spelling mistake and now it returns attempt to call nil error
I'm unsure what is going wrong…
can you please post the updated the code and also post the exact error message so that we can help you further.
6 posts
Posted 06 June 2014 - 09:18 AM
oh sorry, this isn't the latest code, in my latest I fixed the spelling mistake and now it returns attempt to call nil error
I'm unsure what is going wrong…
can you please post the updated the code and also post the exact error message so that we can help you further.
wow, had a go at typing the code into the lua interpreter and realised it was another spelling error so don't worry
but thankyou so much for all the fast and helpful advice that you've given me :D/>
187 posts
Location
Bowie, TX
Posted 06 June 2014 - 05:24 PM
the while loop is not working for me returns attempt to call nil error, could someone tell me how to execute that section of code after the while command continuously until check() is false?
this is the pastebin site :
http://pastebin.com/8KXD0jXd
Can you please edit your OP (Opening Post) and put your ill-formatted code inside of
[code
][/code
] tags and also take it out of the bullet format you used on it. Thanks much!
Edited on 06 June 2014 - 03:25 PM