Jump to content




[Turtle][CraftOS]Liraal's Stuff: Keycard Lock; magicTurtle API v. 1.252

turtle api

105 replies to this topic

#21 ScottKillen

  • New Members
  • 1 posts

Posted 29 February 2012 - 08:02 PM

The mine function calls mineDiamond(l) which is not defined, but there is an uncalled function above mine() called diamondMine(l). I am not a lua guru yet, but I think this is a bug.

#22 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 29 February 2012 - 08:05 PM

yes it is, ill fix it right away
thx B)/> my first bug in release version :unsure:/>

Fixed in 1.251

Added beta functions:
mineGrid()
camoMine()

These haven't been properly tested and may be bugged.

#23 pcmaster160

  • New Members
  • 28 posts

Posted 29 February 2012 - 11:00 PM

when I call (in lua prompt) magicTurtle.mine(diamond) it returns true and does nothing. is there something I have to define before it will mine?

#24 ThePH

  • Members
  • 31 posts

Posted 29 February 2012 - 11:32 PM

Where dyou get thoses ideas from? O_O

#25 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 01 March 2012 - 12:35 AM

View Postpcmaster160, on 29 February 2012 - 11:00 PM, said:

when I call (in lua prompt) magicTurtle.mine(diamond) it returns true and does nothing. is there something I have to define before it will mine?
I think you have to pass a string to the function,so you should do it like this:
magicTurtle.mine("diamond")


#26 pcmaster160

  • New Members
  • 28 posts

Posted 01 March 2012 - 02:14 AM

View PostMysticT, on 01 March 2012 - 12:35 AM, said:

View Postpcmaster160, on 29 February 2012 - 11:00 PM, said:

when I call (in lua prompt) magicTurtle.mine(diamond) it returns true and does nothing. is there something I have to define before it will mine?
I think you have to pass a string to the function,so you should do it like this:
magicTurtle.mine("diamond")
error line 146, attempt to performace arithmetic __sub on nil and number

same error comes up on line 156 for the tunnel program with arguments 10,10,10

#27 silverwolfx

  • New Members
  • 1 posts

Posted 01 March 2012 - 04:02 AM

View Postpcmaster160, on 01 March 2012 - 02:14 AM, said:

View PostMysticT, on 01 March 2012 - 12:35 AM, said:

View Postpcmaster160, on 29 February 2012 - 11:00 PM, said:

when I call (in lua prompt) magicTurtle.mine(diamond) it returns true and does nothing. is there something I have to define before it will mine?
I think you have to pass a string to the function,so you should do it like this:
magicTurtle.mine("diamond")
error line 146, attempt to performace arithmetic __sub on nil and number

same error comes up on line 156 for the tunnel program with arguments 10,10,10

You probably forgot to call setPos() first. so the it's trying to do math on non-existent coords

#28 pcmaster160

  • New Members
  • 28 posts

Posted 01 March 2012 - 04:21 AM

View Postsilverwolfx, on 01 March 2012 - 04:02 AM, said:

View Postpcmaster160, on 01 March 2012 - 02:14 AM, said:

View PostMysticT, on 01 March 2012 - 12:35 AM, said:

View Postpcmaster160, on 29 February 2012 - 11:00 PM, said:

when I call (in lua prompt) magicTurtle.mine(diamond) it returns true and does nothing. is there something I have to define before it will mine?
I think you have to pass a string to the function,so you should do it like this:
magicTurtle.mine("diamond")
error line 146, attempt to performace arithmetic __sub on nil and number

same error comes up on line 156 for the tunnel program with arguments 10,10,10

You probably forgot to call setPos() first. so the it's trying to do math on non-existent coords
lol we need some noob proof instructions, like call this, then this. :unsure:/>
Still having an issue.
now its on line 374 attempt to call nil... can someone simply write like 2 lines on how to use this api for the diamond mine
heres what i'm doing:
magicTurtle.setPos(516,13,525)
magicTurtle.mine("diamond")


#29 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 01 March 2012 - 06:09 AM

Seems like there was a fair amount of bugs after all. It was a simple mistake in isSpace() function, fixed in 1.252. The above should work.
BTW, remember that you can save position to file as well.

#30 francogp

    Lua Artistan

  • Members
  • 58 posts

Posted 01 March 2012 - 09:14 AM

I cant use sendCommand with a turtle, can you post an example of ussage?

#31 6677

  • Members
  • 197 posts
  • LocationCambridgeshire, England

Posted 01 March 2012 - 09:56 AM

Reading position from file might be useful in turtle factories. Much needed feature, thanks for adding.

#32 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 01 March 2012 - 12:51 PM

View Postfrancogp, on 01 March 2012 - 09:14 AM, said:

I cant use sendCommand with a turtle, can you post an example of ussage?

-- on the turtle
magicTurtle.setPos(0,0,0)
magicTurtle.setUpdateID(11)
magicTurtle.autoUpdate()
-- on the controller
redet.open("back")
magicTurtle.sendCommand(27, "print("Hello")")

Im thinking about making a youtube video, but not for the time being.

A preview of what Im working on ATM:
-Cobble Generator
-Mining specific blocks
-Reed Farm
-Following player
-Pathfinding
-Blowing up obstacles :unsure:/>

#33 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 01 March 2012 - 09:41 PM

Added a little side-project, keycard lock with multi-user support and a built in admin panel. Try it!

It's first release so it's suspected to be full of bugs. Be sure to post them here!

#34 pcmaster160

  • New Members
  • 28 posts

Posted 01 March 2012 - 09:49 PM

Now i get: 'for' limit must be a number (line 385) after running this code (same as above)

magicTurtle.setPos(516,13,525)
magicTurtle.mine("diamond")

But if i use magicTurtle.mine("diamond",1) works. what does the 1 do? and how exactly does the diamond mine function work? At the moment my turtle just runs in random directions and digs at seemingly random intervals.

#35 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 01 March 2012 - 09:58 PM

huh. it's supposed to go to level 12 and crave a tunnel 1x2 with branches of length 'l' (yes, that's the mysterious 1 :unsure:/> ). I haven't properly tested it though because im playing on super-flat world and it's layer 5.

#36 pcmaster160

  • New Members
  • 28 posts

Posted 01 March 2012 - 10:19 PM

for me it does that then makes a X pattern in every direction from its starting point and keeps backtracking through that.

and the gotopos function is off with the z cord, it goes the opposite way it should for z and x. (if you set it to go to 10 and it is at 5, it will go to 0 instead of 10) it gets the height right though.

#37 Liraal

  • New Members
  • 477 posts
  • LocationPoland

Posted 01 March 2012 - 10:20 PM

Are you sure you used setNorth() with turtle pointing north?

#38 pcmaster160

  • New Members
  • 28 posts

Posted 01 March 2012 - 10:26 PM

nope. thanks! works now!
And it was being buggy in the diamond mine because I used 1 as the lenght and it kinda wanders through what it dug once it finishes the 4 paths it can go from its first square

#39 francogp

    Lua Artistan

  • Members
  • 58 posts

Posted 01 March 2012 - 11:00 PM

View PostLiraal, on 01 March 2012 - 12:51 PM, said:

View Postfrancogp, on 01 March 2012 - 09:14 AM, said:

I cant use sendCommand with a turtle, can you post an example of ussage?

-- on the turtle
magicTurtle.setPos(0,0,0)
magicTurtle.setUpdateID(11)
magicTurtle.autoUpdate()
-- on the controller
redet.open("back")
magicTurtle.sendCommand(27, "print("Hello")")

Im thinking about making a youtube video, but not for the time being.

A preview of what Im working on ATM:
-Cobble Generator
-Mining specific blocks
-Reed Farm
-Following player
-Pathfinding
-Blowing up obstacles :unsure:/>

I make it work with the print... but if I change the command to "go up", I get on the turtle "attempt to call nill" on the turtle, why?

#40 pcmaster160

  • New Members
  • 28 posts

Posted 02 March 2012 - 02:52 AM

can you make it so that it does not exit your application after running the goToPos command? For example in a program anything after goToPos is completed is canceled because gotopos ends the application.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users