This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
TCMedia_chuck's profile picture

Can I please get help with my code, that will probably confuse?

Started by TCMedia_chuck, 06 March 2013 - 11:28 PM
TCMedia_chuck #1
Posted 07 March 2013 - 12:28 AM
*EDIT* I have managed to somewhat make the program do what I have asked, I made dest read the number typed, but get "test:7:attempt to compare number with string expected, got number", test being the name of the code. Any suggestions?

and of course no topic would be complete without code…

-
-startup
write("Please insert number of cycles you wish to do: ")
local tArgs = ( ... )  
local read = read()
local dist = read
local fuel = 1
if dist < 0 then
	print("Please insert a number greater than 0")
while dist >= 1 do
   for i = 1, dist do
end
end
———————————————————————————————————————————————————————
IGNORE THIS BOTTOM HALF!

I am trying to have my turtle dig down to 5 in an octagonal shape , but have run into a snag…
I am trying to get dest = (number typed into turtle) ex: test 3) which would complete 3 cycles , 1 cycle is 2 levels down. That is the concept but unfortunately the turtle only completes one cycle. I assume the problem is i have my dest = 1, I also assume that I need to use dest = 1, "y" but am unsure.

for sake of being a short topic/ question…

a link on pastebin of my full code: {link Removed by user}
Lyqyd #2
Posted 07 March 2013 - 05:16 AM
Split into new topic.
remiX #3
Posted 07 March 2013 - 05:22 AM
Tell us what you have done to fix the issue, if you have tried anything.

Have you tried to make dest = 3?
TCMedia_chuck #4
Posted 07 March 2013 - 12:14 PM
Tell us what you have done to fix the issue, if you have tried anything.

Have you tried to make dest = 3?

*EDIT* I have made dest = 3 by adding a read command, and now get an error as mentioned in the edit at the beginning of the toppic.



the only way I've made dest = 3 (to answer your question, i did) is to manually enter/ change the code, currently my code is not very smart, if it runs into a mob or player it loses count and goes to the next group of code, I am at a very basic level of coding, I have heard that i need to add gps to the turtles parameters, what i am learning is from different programs.



basicly I am trying to make my dest = y of the other way around.
LazyBoot #5
Posted 20 March 2013 - 12:38 AM
Have you tried this?

local dist = tonumber(read)