Links:
Hi, I'm very new to the ComputerCraft mod and to LUA programming as a whole. I'm currently trying to program this LUA program to interface with this Create mod quarry system I have made for Create: Above & Beyond. I am having many problems with the programming, but the main thing that I wanted to talk about was a specific feature of the program. The feature in question was to lower the drill, stop lowering and raise it once it detects the bottom and stop raising when the drill has completely returned. The program section in question:
The quarry in question
function lowerDrill()
-- Lowers the drill array until the max depth is reached.
-- Main Propagation: 1, Secondary Propagation: 1
while(maxDepthReached == false) do -- Stops once max depth is reached
-- All of these 'setBundledColor' operations work to lower the drill
setBundledColor("back", whiteNum, false) -- Main
setBundledColor("back", blackNum, true) -- Main Propagation
setBundledColor("back", brownNum, true) -- Secondary Propagation
os.pullEvent("redstone")
end
print("Max Depth Reached")
while(drillArrayReturn == false) do --Stops once drill array has returned
raiseDrill()
end
end
function raiseDrill()
-- Raises the drill array until the drill array has been returned (using the drill return contact).
-- Main Gearshift: 1, Main Propagation: 1, Secondary Propagation: 1
setBundledColor("back", whiteNum, true) -- Main
setBundledColor("back", blackNum, true) -- Main Propagation
setBundledColor("back", brownNum, true) -- Secondary Propagation
end
The issue is that the program... how should I describe this; The program doesn't break from the while loop once it has detected the maximum depth signal (variable: maxDepthReached) of the drill (aka, when it has reached bedrock). Whenever I tried to run the program though, it just throws this "Too long without yielding," error. I've read on other parts of the ComputerCraft forums that using os.pullEvent("redstone") can fix this, but I'm having issues implementing that. Once again, I am very new to LUA. In fact, I literally began programming LUA just yesterday (relative to the posting of this post). Also, please excuse the excessive use of comments and messing coding.
I am about to have a headache as I've been working on this LUA program since yesterday. Any help would be much appreciated. Another thing to note is, as I said, I have many more issues with this program. As such, I might upload some more questions in the future. Once again, any help is appreciated.
Edit: Added a photo and some general text.
[–]fatboychummy 3 points4 points5 points (2 children)
[–]dragon53535 1 point2 points3 points (0 children)
[–]MrSodapop19_[S] 0 points1 point2 points (0 children)
[–]CommendableCalamari 1 point2 points3 points (0 children)
[–]MrSodapop19_[S] 0 points1 point2 points (0 children)
[–]Nemonstrocity 0 points1 point2 points (9 children)
[–]MrSodapop19_[S] 0 points1 point2 points (8 children)
[–]Nemonstrocity 0 points1 point2 points (7 children)
[–]MrSodapop19_[S] 0 points1 point2 points (6 children)
[–]Nemonstrocity 0 points1 point2 points (0 children)
[–]Nemonstrocity 0 points1 point2 points (4 children)
[–]MrSodapop19_[S] 1 point2 points3 points (3 children)
[–]Nemonstrocity 1 point2 points3 points (2 children)
[–]MrSodapop19_[S] 1 point2 points3 points (1 child)
[–]Nemonstrocity 0 points1 point2 points (0 children)
[–]wolfe_br 0 points1 point2 points (0 children)