cc help

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

mattyboy12

New Member
Jul 29, 2019
82
0
0
im making a program to check if trees are grown and then to harvest them and if not to go on to the next tree but somewhy if the tree isnt grown even though i think ive put in the right code so that itll move along to the next tree it just stops and the program stops as well here is the pastebin of the program Vv69fpgA any help as to why its not working will be appreciated and i know there is programs that can do this but id like to do it by myself.
 

lavarthan

New Member
Jul 29, 2019
2,437
0
0
I have not programmed in a while, but I've done basic programming in C++ and Java never in lua though. So I have one question. What are you comparing in the 'if turtle.compare() then' Are you calling a function and if so what are you passing into it? Also could you edit and provide a link to the pastebin instead of just the last part of it. In other words something like this: http://pastebin.com/Vv69fpgA Thanks.
 

mattyboy12

New Member
Jul 29, 2019
82
0
0
i didnt know how to put that psatebin thing and its comparing lime wood which is in that slot and im calling the function just to loop the program
 

lavarthan

New Member
Jul 29, 2019
2,437
0
0
I really need to go back and watch DW20's lua programming tutorial videos. I will watch them if I get a chance and come back and help then. Hopefully someone with more lua experience will come by before then.
 

plzent3r

New Member
Jul 29, 2019
190
0
0
I'm not sure if this is the problem but on line 35 you missed the () after calling turtle.turnRight

Also, What is the problem? does the screen give any type of error message or does the turtle just do nothing(but give no error messages)?
 

Quesenek

New Member
Jul 29, 2019
396
0
0
from error checking: add () to the end of 35 remove the = from 36 remove 40. if you have the turtle returning to the base of the tree after it is done cutting down the tree and want the function to loop to recheck if the tree is grown add return tree() at 40 at 50 add tree()
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
Firstly, it would be "i = turtle.getItemCount(SLOT)", replacing SLOT by the slot number you need to check (1 to 16).

Secondly, the "turtle.drop()" function drops everything in the selected slot by default, the number is only good to make it drop less than the max.
 

Quesenek

New Member
Jul 29, 2019
396
0
0
and how if i run the code turtle.getitemcount() = i so that i can make turtle.drop(i)
For an empty inventory add this starting at line 40:
Code:
for i = 16,2,-1 do
 
turtle.select(i)
 
turtle.dropDown()
 
end
 
return tree() //to make sure your code repeats put this once at the very end of the if statement and also at the very end of the else statement.