Turtle/Bee question

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

Fyugre

New Member
Jul 29, 2019
44
0
0
Hey, I just started using the setup Direwolf20 is using for automatic bee breeding and once the bees are breeding in do run the program the inventory turtle takes out the bees from the apiary puts them in a Bee analyzer then puts them in the analyzer, once the first one is done it puts it BACK in the bee analyzer and then crashes with the message

analyze:71: attempt to perform
arithmetic _ _add on nil and nil

  1. local currslot = 1
  2. local princess = 0
  3. local bestDrone = 0
  4. local data=""
  5. local countBees = 0
  6. local beeTable = {}
  7. local currScore = 0
  8. s = peripheral.wrap("right")
  9. function regTable()
  10. beeTable["bees.species.industrious"] = 31
  11. beeTable["bees.species.imperial"] = 30
  12. beeTable["bees.species.unweary"] = 21
  13. beeTable["bees.species.majestic"] = 20
  14. beeTable["bees.species.diligent"] = 11
  15. beeTable["bees.species.noble"] = 10
  16. beeTable["bees.species.cultivated"] = 6
  17. beeTable["bees.species.common"] = 5
  18. beeTable["bees.species.forest"] = 1
  19. beeTable["bees.species.meadows"] = 1
  20. end
  21. function getBees()
  22. turtle.select(1)
  23. for i = 1,6 do
  24. if turtle.suck() then countBees = countBees + 1 end
  25. end
  26. end
  27. function returnBees()
  28. turtle.turnRight()
  29. turtle.turnRight()
  30. turtle.select(princess)
  31. s.dropSneaky(1,1)
  32. turtle.select(bestDrone)
  33. s.dropSneaky(0,1)
  34. end
  35. function ditchCombs()
  36. turtle.turnLeft()
  37. m = peripheral.wrap("front")
  38. for i = 1,8 do
  39. turtle.suck()
  40. while (not m.isBee()) and (turtle.getItemCount(i) > 0) do
  41. turtle.select(i)
  42. turtle.drop()
  43. if not m.isBee() then
  44. print("Gotta ditch the combs!")
  45. turtle.suck()
  46. turtle.dropDown()
  47. turtle.select(countBees)
  48. turtle.transferTo(i, 1)
  49. countBees = countBees - 1
  50. end
  51. end
  52. end
  53. end
  54. function scanBees()
  55. turtle.turnLeft()
  56. for i = 1, countBees do
  57. turtle.select(i)
  58. turtle.drop()
  59. end
  60. print("Sleeping for a minute while the bee scans")
  61. sleep(26)
  62. end
  63. function determineBest(slot)
  64. score = beeTable[data["speciesPrimary"]] + beeTable[data["speciesSecondary"]]
  65. print("Current: "..currScore)
  66. print("NewScore: "..score)
  67. if(bestDrone == 0) then
  68. bestDrone = slot
  69. currScore = score
  70. else
  71. if (score > currScore) then
  72. bestDrone = slot
  73. currScore = score
  74. end
  75. end
  76. end
  77. function analyzeBees()
  78. for i = 1, countBees do
  79. turtle.select(i)
  80. s.suckSneaky(0,1)
  81. turtle.turnRight()
  82. turtle.drop()
  83. m = peripheral.wrap("front")
  84. data = m.analyze()
  85. if (data["type"] == "princess") then
  86. princess = i
  87. print("Princess = "..i)
  88. else
  89. determineBest(i)
  90. end
  91. print(data["speciesPrimary"]..":"..data["speciesSecondary"])
  92. print("BestDrone = "..bestDrone)
  93. turtle.suck()
  94. turtle.turnLeft()
  95. if i ~= countBees then sleep(26) end
  96. end
  97. end
  98. function dropExcess()
  99. for i = 1, 6 do
  100. turtle.select(i)
  101. turtle.dropDown()
  102. end
  103. end
  104. ------=============================
  105. currslot = 1
  106. princess = 0
  107. bestDrone = 0
  108. data=""
  109. countBees = 0
  110. beeTable = {}
  111. currScore = 0
  112. regTable()
  113. getBees()
  114. if (turtle.getItemCount(2) > 0) then
  115. ditchCombs()
  116. scanBees()
  117. analyzeBees()
  118. returnBees()
  119. dropExcess()
  120. end

all help is appreciated.
 

thesonofdarwin

New Member
Jul 29, 2019
21
0
0
Is it possible a bee type (dominant or recessive) made it into your bee that is not listed in your table? Dire's code is very specific to acquire an exact type of bee. You need to edit his bee types if you wish to go another path with different bees.
 

Fyugre

New Member
Jul 29, 2019
44
0
0
Is it possible a bee type (dominant or recessive) made it into your bee that is not listed in your table? Dire's code is very specific to acquire an exact type of bee. You need to edit his bee types if you wish to go another path with different bees.
Nope going the same way he is it looks like something may have changed the what your supposed to call the bees like ["bees.species.industrious"] into something different therefore not recegnizing it as a #
EDIT, does anyone know what to call the bees in the turtle? I think that's the problem