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

turtle:18: Expected Number error?

Started by jlopez24, 10 January 2013 - 08:35 PM
jlopez24 #1
Posted 10 January 2013 - 09:35 PM
I keep getting this turtle:18: Expected number error on my turtle.

The program is SethBling's "Fell" program which makes the turtle cut down your trees.

I'm on a mac so I can't go on the pastebin he provided and copy and paste. Mac's copy paste is control+c/control+v. If you press control in a turtle it brings up the menu, so I can't paste. This means I'm typing everything out word for word.

local function checkFuel()
  if turtle.getFuelLevel() < 1 then
	turtle.select(1)
	turtle.refuel(1)
  end
end

local function column()
  while turtle.digUp() do
	turtle.dig()
	checkFuel()
	turtle.up()
  end
  turtle.dig()

  checkFuel()
  while turtle.down() do
	checkFuel()
  end
end

local function digmove()
  checkFuel()
  turtle.dig()
  turtle.forward()
end

digmove()
column()
turtle.turnRight()
digmove()
turtle.turnLeft()
column()
turtle.turnLeft()
digmove()
digmove()
turtle.turnRight()
column()

The 18th line is just "checkFuel()" so I don't see why I need a number?

I tried 1 and 0 so far, but I don't know what else to do..
ChunLing #2
Posted 10 January 2013 - 09:52 PM
Hmmm…is your program named "turtle"?

The only functions I see that would require a number are the turtle.select() and turtle.refuel(), both of which are posted here with 1 as an argument. Maybe just edit those to make sure that they really have 1 rather than l or I or some such as the argument?
theoriginalbit #3
Posted 10 January 2013 - 09:53 PM
firstly, this forum has code tags [code][/code] :)/> instead of the quotes ;)/>

secondly, a Macs copy paste is cmd+c cmd+v not control+c control+v

thirdly, 'edit' doesn't allow copy paste anyway.

lastly, the problem…. I don't see any issues here…

EDIT: In follow up from ChunLing's, if your program isn't called turtle are you in SMP?
Edited on 10 January 2013 - 08:55 PM
crazyguymgd #4
Posted 11 January 2013 - 01:44 AM
- Edit nevermind that solution
crazyguymgd #5
Posted 11 January 2013 - 01:46 AM
I keep getting this turtle:18: Expected number error on my turtle.

The program is SethBling's "Fell" program which makes the turtle cut down your trees.

I'm on a mac so I can't go on the pastebin he provided and copy and paste. Mac's copy paste is control+c/control+v. If you press control in a turtle it brings up the menu, so I can't paste. This means I'm typing everything out word for word.

local function checkFuel()
  if turtle.getFuelLevel() < 1 then
	turtle.select(1)
	turtle.refuel(1)
  end
end

local function column()
  while turtle.digUp() do
	turtle.dig()
	checkFuel()
	turtle.up()
  end
  turtle.dig()

  checkFuel()
  while turtle.down() do
	checkFuel()
  end
end

local function digmove()
  checkFuel()
  turtle.dig()
  turtle.forward()
end

digmove()
column()
turtle.turnRight()
digmove()
turtle.turnLeft()
column()
turtle.turnLeft()
digmove()
digmove()
turtle.turnRight()
column()

The 18th line is just "checkFuel()" so I don't see why I need a number?

I tried 1 and 0 so far, but I don't know what else to do..

just quoted for formatting to read easier.
jlopez24 #6
Posted 11 January 2013 - 07:42 AM
firstly, this forum has code tags [code][/code] :)/> instead of the quotes ;)/>

secondly, a Macs copy paste is cmd+c cmd+v not control+c control+v

thirdly, 'edit' doesn't allow copy paste anyway.

lastly, the problem…. I don't see any issues here…

EDIT: In follow up from ChunLing's, if your program isn't called turtle are you in SMP?

Yea I'm in SMP. The program is called Fell.

And what I meant by the whole copy+paste thing was that it's control+whatever on minecraft. Everywhere else it's cmnd. And if you can't paste directly into the edit then what's the point of putting it on a paste bin? I saw the program "paste bin" or whatever, but I had no idea how to use it.
Shnupbups #7
Posted 11 January 2013 - 08:38 AM
Yea I'm in SMP. The program is called Fell.

And what I meant by the whole copy+paste thing was that it's control+whatever on minecraft. Everywhere else it's cmnd. And if you can't paste directly into the edit then what's the point of putting it on a paste bin? I saw the program "paste bin" or whatever, but I had no idea how to use it.

OFF-TOPIC: The pastebin program allows you to post and retrieve files and programs from the website http://www.pastebin.com and is used by typing:

pastebin put <fileorprogram>
or
pastebin get <onlinecode> <programname>
ChunLing #8
Posted 11 January 2013 - 08:40 AM
Okay, the part of the error message that you posted was telling us what part of the turtle API objected to your program, not what part of your program caused it to object.

There should be more of the error message, a part that mentions the name of your program and the line of your program that caused the error.
Lyqyd #9
Posted 11 January 2013 - 08:49 AM
firstly, this forum has code tags [code][/code] :)/>/> instead of the quotes ;)/>/>

secondly, a Macs copy paste is cmd+c cmd+v not control+c control+v

thirdly, 'edit' doesn't allow copy paste anyway.

lastly, the problem…. I don't see any issues here…

EDIT: In follow up from ChunLing's, if your program isn't called turtle are you in SMP?

The edit program allows you to directly paste into it, up to one line at a time.
weeepy #10
Posted 10 October 2013 - 06:58 AM
I hope my post won't get deteted second time.

I recommend to debug locally, editing the turtle API file (/ComputerCraft/lua/rom/apis/turtle/turtle).

Line 18 just delegates to native turtle code, so insert debug print of _sCommand and paramaters before this line.

In my case, I found I called turtle.select with a nil parameter.
Lyqyd #11
Posted 10 October 2013 - 10:23 AM
Posting on a long-since-solved topic with advice to attempt debugging by editing the rom isn't really helpful, so if a previous post of yours got deleted, it would have been for good reason. Locked.