Jump to content




Programming help


  • You cannot reply to this topic
23 replies to this topic

#21 ChunLing

  • Members
  • 2,027 posts

Posted 21 December 2012 - 01:55 AM

How would you like it improved?

#22 random987654321

  • New Members
  • 17 posts

Posted 21 December 2012 - 02:09 AM

Mabey have it compacted?

#23 Doyle3694

  • Members
  • 815 posts

Posted 21 December 2012 - 02:17 AM

function mine()
   for i = 1,2 do
	 turtle.digDown()
	 turtle.down()
   end
   turtle.dig()
   turtle.select(3)
   turtle.place()
   turtle.select(2)
   for i = 1,2 do
	 turtle.up()
	 turtle.placeDown()
   end
   turtle.select(1)
   turtle.place()
end

It doesn't really shorten the code, but makes it abit more eyepleasing to read.

#24 ChunLing

  • Members
  • 2,027 posts

Posted 21 December 2012 - 07:05 AM

Hmm...I'd have thought you'd want the overall program to lay more than two mines. Also, using a sand/gravel (gravel makes stone pressure plates harder to spot, if this is intended for PVP) rather than dirt causes the mine to drop the entity which triggers the mine into a pit, which can be made deeper. But this involves reducing the damage to other entities which may be about (though having the tnt under a layer of dirt also does that).

Using nested for loops would let you easily lay a larger minefield, if that's desired.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users