Jump to content




MLG Mining: Circular Branch Mining


358 replies to this topic

#341 JiRB0T

  • Members
  • 4 posts

Posted 07 November 2014 - 08:49 PM

I'm having troubles with my turtle when it reaches anything it doesn't like it returns a "api_turtleExt:208: Invalid side", I've setup as shown and have dug a tunnel and shafts proper but once it reaches a player/gravel it give this error any thought or fixes?

#342 UkeFox

  • Members
  • 3 posts

Posted 13 November 2014 - 05:59 AM

View PostJiRB0T, on 07 November 2014 - 08:49 PM, said:

I'm having troubles with my turtle when it reaches anything it doesn't like it returns a "api_turtleExt:208: Invalid side", I've setup as shown and have dug a tunnel and shafts proper but once it reaches a player/gravel it give this error any thought or fixes?

It's an easy fix :D

Five easy steps to solving invalid side:


1. Type edit api_turtleExt
2. Navigate to ln 208 (you'll know you're there by the indicator at the bottom right)
3. You'll see turtle.Attack(tdir). You need to remove tdir so there is nothing in the parenthesis but leave everything else the same.
4. Save your edits.
5. Profit!


I think the problem is in the way ComputerCraft handles variables to the turtle.Attack() class now vs. when this program was written.

Have fun! :D

Edited by UkeFox, 14 November 2014 - 08:35 PM.


#343 swisszeni

  • New Members
  • 2 posts

Posted 30 December 2014 - 08:34 PM

View PostUkeFox, on 13 November 2014 - 05:59 AM, said:

It's an easy fix :D

While you are correct with this fixing the crash of the turtle (and that is sufficient for most I guess ;) ), it won't fix the function as giving it back its old behaviour. This will lead to a problem if the turtle should attack up- or downwards since turtle.attack() will only attack mobs/players in front of the turtle. To reachiev this, you also need to implement turtle.attackUp() and turtle.attackDown() direction dependent.

The function with this addition would look like this:
function attack(dir)
  turnTo(dir)
  local tDir=turnedDir(dir)
  local attack
  if dir==up then
	attack=turtle.attackUp
  elseif dir==down then
	attack=turtle.attackDown
  else
	attack=turtle.attack
  end
  local success
  while attack() do
	success=true
	sleep(0.3)
  end
  turnFrom(dir)
  return success
end

Since editing the code may not be that easy for everyone, I forked the project to make the updating easyer. You can get the modified startup-script at http://pastebin.com/Jyyby90U. If there is enough time, I'll add some other features as persistence for server restarts or centralized coordination between turtles.

Edited by swisszeni, 30 December 2014 - 09:34 PM.


#344 Deathdrgn

  • New Members
  • 1 posts

Posted 20 January 2015 - 03:18 PM

After running in to the attack(tdir) issue myself in regards to gravel, I found that changing line 208 from "while turtle.attack(tDir) do" to "while turtle.attack(Dir) do" will restore original function

#345 swisszeni

  • New Members
  • 2 posts

Posted 03 February 2015 - 03:54 PM

View PostDeathdrgn, on 20 January 2015 - 03:18 PM, said:

After running in to the attack(tdir) issue myself in regards to gravel, I found that changing line 208 from "while turtle.attack(tDir) do" to "while turtle.attack(Dir) do" will restore original function
No it won't. Since the var "Dir" isn't set anywhere in the function, you are actually passing a NULL value. Furthermore the turtle-API will ignore the value passed. In the end your solution is the same as UkeFox's. Fixes the crash but won't restore the original behaviour.

Stick to my post for a real fix.

#346 drakkon20

  • New Members
  • 1 posts

Posted 11 February 2015 - 02:35 PM

View PostDeathdrgn, on 20 January 2015 - 03:18 PM, said:

After running in to the attack(tdir) issue myself in regards to gravel, I found that changing line 208 from "while turtle.attack(tDir) do" to "while turtle.attack(Dir) do" will restore original function

Hey Death! I think I've tracked you down! You should join my private server! I miss playing with you! I came back to MC recently and everybody is missing :S Whats the best way to chat? Let me know!

#347 ISteam

  • New Members
  • 1 posts

Posted 25 February 2015 - 07:09 PM

Is there a way to make this program self contained (=so the mining turtles don't stop if I move out of the chunk,log out, etc....) ?

#348 Picksme

  • Members
  • 7 posts

Posted 13 April 2015 - 02:24 AM

This looks super cool! Well done.

#349 voidbreath

  • Members
  • 6 posts

Posted 28 November 2016 - 01:53 PM

Two years later, im getting the api_turtleExt:208: Invalid side error on contact with gravel, ive tried all 3 solutions posted above. Anyone got other ideas?

#350 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 November 2016 - 04:41 AM

And what happened when you did this?

#351 voidbreath

  • Members
  • 6 posts

Posted 30 November 2016 - 05:50 AM

View PostBomb Bloke, on 30 November 2016 - 04:41 AM, said:

And what happened when you did this?

api_turtleExt:219: attempt to call nil

or with it written like so:
function attack(dir)
turnTo(dir)
local tDir=turnedDir(dir)
local attack
if dir==up then
attack=turtle.attackUp()
elseif dir
==down then
attack=turtle.attackDown()
else
attack=turtle.attack()
end
local success
while attack() do
success=true
sleep(0.3)
end
turnFrom(dir)
return success
end
api_turtleExt:215: attempt to call boolean

was unsure if it was an oversight that the parentheses weren't there so i tried it both ways

Edit: accidently put turnfrom(dir) instead of turnFrom(dir), I now get api_turtleExt:215: attempt to call boolean regardless of parentheses

Edited by voidbreath, 30 November 2016 - 05:59 AM.


#352 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 November 2016 - 06:03 AM

Where line 215 is...?

#353 voidbreath

  • Members
  • 6 posts

Posted 30 November 2016 - 06:09 AM

View PostBomb Bloke, on 30 November 2016 - 06:03 AM, said:

Where line 215 is...?

Oh right sorry, 215 is "while attack() do"

#354 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 November 2016 - 06:54 AM

Ah, right, you've added some extra brackets to the function. Try it the way swisszeni had it - just do a straight copy/paste.

#355 voidbreath

  • Members
  • 6 posts

Posted 30 November 2016 - 07:22 AM

View PostBomb Bloke, on 30 November 2016 - 06:54 AM, said:

Ah, right, you've added some extra brackets to the function. Try it the way swisszeni had it - just do a straight copy/paste.

Well this is vaguely embarrassing, i suppose it came down to a typo on my part :( thanks a bunch for your patience and help with this

#356 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 November 2016 - 08:05 AM

You're not the first to make a mistake, and you won't be the last. :P

#357 peanutinky

  • Members
  • 4 posts

Posted 21 March 2018 - 02:09 PM

is there a way to make it bedrock proof it stops at bedrock and sits there for a minute then it finally moves on. i know that i could cheat and go to creative mode and get bedrock and put it in a ignore block.
i love using this program it works well and with the bug fix that was submitted about api_turtleExt line 208. i still have some problems with grave stopping it from finishing getting it out of the way. thanks again for thew great program. im not a programmer trying to learn from everybody's coding i have read the lua verision 1 on line but this uses lua verision 2 i think.
:D

#358 atithaoss

  • Members
  • 17 posts

Posted 21 March 2018 - 03:33 PM

Hello,
I have a problem with MLG.
In my previous server all were working like a charm now in my new server when i try to make 4 tunnels the turtle stuck without any error in the East side and in the North side.
Have you experience this problem???

#359 atithaoss

  • Members
  • 17 posts

Posted 21 March 2018 - 05:01 PM

I download my map locally and it is working but not in my server....
do you have any clue why is that?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users