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

Unexpected symbol Please help

Started by joey009, 07 April 2012 - 06:27 PM
joey009 #1
Posted 07 April 2012 - 08:27 PM
I contiune to get "requested_excavation.lua"]:1:unexpected symbol
and i continue to go through my coding and can not find the problem. I am relativly new to LUA so I only know enough to get my self started.
EatenAlive3 #2
Posted 07 April 2012 - 08:32 PM
We can't help you unless you post the code. Post it in
 tags or [SPOILER] tags, or use [url="http://pastebin.com/"]http://pastebin.com/[/url].
joey009 #3
Posted 07 April 2012 - 08:38 PM
*face palm* Thought I was forgetting something

w = local wx
mw = w
s = local hy
h = s
v = mw * h
z = local wx
r = r + ry
q = 0
function wx()
write ("Desired Width only even numbers(max of 20: ")
return wx
end
function hy()
write ("Desired Length only even numbers( max of 20: ")
return hy
end
function ry()
write ("Desired Height any number: ")
return ry
end
if r > 0 then

  while mw > 0 do -- movement
   turtle.dig()
   turtle.forward( mw - 1 )
  end
  while mw == 0 do -- width resetor
   mw * 0
   mw + z
 
  if q = ( 2, 6, 10, 14, 18, 22, 26, 30, 34, 38 ) then --turning correcteor
    turtle.turnLeft()
    turtle.dig()
    turtle.forward( h - 1 )
    turtle.turnLeft()
   else q = ( 4, 8, 12, 16, 20, 24, 28, 32, 36, 40 )
    turtle.turnRight()
    turtle.dig()
    turtle.forward( h - 1 )
    turtle.turnRight()
   end
  end
 
  while h == 0 do --resets length and subtracts height
   turtle.digDown( r - 1 )
   q + 2
   turtle.turnRight()
   turtle.turnRight()
   h + hy
  
  end
else
  repeat -- return to surface
  turtle.up( r + 1 )
  until r == ry else
  repeat --stalls forever
  turtle.turnRight()
  until q == 10000000
end


EatenAlive3 #4
Posted 07 April 2012 - 09:01 PM
I see what you did. You made a mistake with the local syntax and variable declaration, I'll fix that for you in a second. This is a little tricky to see what you wanted to do, so hold on while I fix it.. =O

Here you are, but I don't think it works as you intended. The bugs are for you to fix, and the changes are there for you to learn from. Good luck :P/>/>


function wx()
print("Desired Width only even numbers(max of 20: ")
local ww = tonumber(read())
if ww > 20 or ww < 0 then print("Invalid width!") wx()
else return ww end
end
function hy()
print("Desired Length only even numbers( max of 20: ")
local hh = tonumber(read())
if hh > 20 or hh < 0 then print("Invalid width!") hy()
else return hh end
end
function ry()
print("Desired Height any number: ")
return tonumber(read())
end
local w = wx()
local z = w
local s = hy()
r = ry()
rOriginal = r
h = s
mw = w
v = 0
q = 0
if r > 0 then
  while mw > 0 do -- movement
   turtle.dig()
   turtle.forward()
   mw = mw - 1
  end
  while mw == 0 do -- width resetor
   mw = z

  if (q+2)%4 == 0 and q >= 2 and q <= 38 then --turning correcteor
    turtle.turnLeft()
    turtle.dig()
    turtle.forward()
    h = h - 1
    turtle.turnLeft()
   elseif q%4 == 0 and q >= 4 and q <= 40 then
    turtle.turnRight()
    turtle.dig()
    turtle.forward()
    h = h - 1
    turtle.turnRight()
   end
  end

  while h == 0 do --resets length and subtracts height
   turtle.digDown( r - 1 )
   q = q + 2
   turtle.turnRight()
   turtle.turnRight()
   h = h + h
 
  end
else
  repeat -- return to surface
  turtle.up()
  r = r + 1
  until r == rOriginal
end
joey009 #5
Posted 08 April 2012 - 04:03 PM
I should probaly learn a little more lua BEFORE I CONTIUNE CODING… :P/>/>