Jump to content




turtle:18: Expected Number error?

turtle help lua

10 replies to this topic

#1 jlopez24

  • New Members
  • 2 posts

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..

#2 ChunLing

  • Members
  • 2,027 posts

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?

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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 by TheOriginalBIT, 10 January 2013 - 09:55 PM.


#4 crazyguymgd

  • Members
  • 139 posts
  • LocationUSA

Posted 11 January 2013 - 01:44 AM

- Edit nevermind that solution

#5 crazyguymgd

  • Members
  • 139 posts
  • LocationUSA

Posted 11 January 2013 - 01:46 AM

View Postjlopez24, on 10 January 2013 - 09:35 PM, said:

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.

#6 jlopez24

  • New Members
  • 2 posts

Posted 11 January 2013 - 07:42 AM

View PostTheOriginalBIT, on 10 January 2013 - 09:53 PM, said:

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.

#7 Shnupbups

  • Members
  • 596 posts
  • LocationThat place over there. Y'know. The one where I am.

Posted 11 January 2013 - 08:38 AM

View Postjlopez24, on 11 January 2013 - 07:42 AM, said:

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>


#8 ChunLing

  • Members
  • 2,027 posts

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.

#9 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,451 posts

Posted 11 January 2013 - 08:49 AM

View PostTheOriginalBIT, on 10 January 2013 - 09:53 PM, said:

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.

#10 weeepy

  • New Members
  • 2 posts

Posted 10 October 2013 - 05: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.

#11 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,451 posts

Posted 10 October 2013 - 09: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users