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

help!!! bios:337: [string "house.lua"]:135: '=' expected

Started by marmig0404, 11 August 2013 - 08:07 PM
marmig0404 #1
Posted 11 August 2013 - 10:07 PM
Title: help!!!
dunno what this means
bios:337: [string "house.lua"]:135: '=' expected
help?
here is the code

function refuel()
turtle.select(2)
turtle.refuel(all)
turtle.select(3)
turtle.refuel(all)
turtle.select(4)
turtle.refuel(all)
turtle.select(5)
turtle.refuel(all)
turtle.select(6)
turtle.refuel(all)
turtle.select(7)
turtle.refuel(all)
turtle.select(8)
turtle.refuel(all)
turtle.select(9)
turtle.refuel(all)
turtle.select(10)
turtle.refuel(all)
turtle.select(11)
turtle.refuel(all)
turtle.select(12)
turtle.refuel(all)
turtle.select(13)
turtle.refuel(all)
turtle.select(14)
turtle.refuel(all)
turtle.select(15)
turtle.refuel(all)
end

function middle1()
turtle.place()
turtle.up()
turtle.forward()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
turtle.turnRight()
turtle.up()
end

function middle2()
turtle.place()
turtle.up()
turtle.forward()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
turtle.turnRight()
turtle.up()
end

function top1()
turtle.place()
turtle.up()
turtle.forward()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward
turtle.select(16)
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
end

function top2a()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward
turtle.placeDown()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end

function top2b()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.forward
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
end

function top()
top1
top2a
top2b
top2a
top2b
end

function middle()
middle1
middle2
end
function house1()
refuel
middle
refuel
top
end
house1
end
anyone?
Bubba #2
Posted 12 August 2013 - 09:09 AM
Split into new topic.

You are writing the names of the function but not calling them. To call a function, you must put a parentheses after it like this:

function someFunction()
  print("Stuff happens here")
end

--# Here is how to call a function
someFunction() -- # Notice the parentheses after the function
Engineer #3
Posted 12 August 2013 - 06:42 PM
It looks like you definitely need some loops. Read about them here
TheOddByte #4
Posted 13 August 2013 - 03:13 PM
First of

turt.refuel(all) --Don't think this works, But hey, I'm not using turtles so often

turtle.refuel() -- Will refuel all if it don't have an argument

Also you forgot to call your function by adding parantheses at the end there of your code where it is 'middle1' etc
Otherwise the program will think it's a variable and it wants it to be declared

local function hello()
 print("Hello World!")
end

hello -- This will error since it think it's a variable add '()' next to it and it will be a function call :D/>/>

And this is a better refuel function that uses a for loop

function refuel()
for i = 2,15 do
  turtle.select(i)
  turtle.refuel()
 end
end

So a for loop can basically have 3 arguments, A start value, a finish value and a increment/decrement value

for i = 60, 1, -1 do
 print(i)
 sleep(.8)
end
So this will start at 60 and decrease by 1 until it reaches 1 and then the loop is finished
But the 3rd argument is never needed if you want it to only increase by 1.

Hope this was of any help to you! ;)/>