CC Melee turtle- Need a very simple script

  • 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

Affex

New Member
Jul 29, 2019
176
0
0
OI5p7nO.png


NbglNDW.png


First one's just a glamour shot. The spawning area is the same on both sides.
Nice! How did you get all emerald??
 

TheBaz

New Member
Jul 29, 2019
13
0
0
Hmm very interesting trunks. Just a quick question is there a way to I guess "save" a start up script? so instead of having to type out the script over and over to each turtle just type a command and it'll apply the start up script? I've searched all over and I can't seem to find anything on it.
 

Guswut

New Member
Jul 29, 2019
2,152
0
0
Hmm very interesting trunks. Just a quick question is there a way to I guess "save" a start up script? so instead of having to type out the script over and over to each turtle just type a command and it'll apply the start up script? I've searched all over and I can't seem to find anything on it.

Yup, although it isn't in a way you'd think to go: Pastebin.

ComputerCraft, if you have HTTP enabled ("The HTTP API must be enabled in mod_ComputerCraft.cfg before being used. To enable it open .minecraft/config/mod_ComputerCraft.cfg and change enableAPI_http=0 to enableAPI_http=1.") will allow you to use a command called "pastebin". What you'll want to do is this:

"Pastebin put startup", which will then give you a pastebin code. Then, on each new turtle, type "pastebin get <YOUR CODE HERE> startup" to get the code from the web and make it into the startup file.
 

Guswut

New Member
Jul 29, 2019
2,152
0
0
Could he not save the script to a disk?

He could, yes. But let's list out the steps:

  1. Craft a disk drive.
  2. Craft a floppy disk.
  3. Put the disk drive down next to the turtle.
  4. Place the floppy disk into the disk drive.
  5. Open the turtle.
  6. Type "cp startup /disk/startupBACKUP". (You want to do this so the computer/turtle won't boot off the disk when you use it).
  7. Close the turtle.
  8. Break the disk drive (drops the disk and disk drive).
  9. Go over to your new turtle and open it.
  10. Place down the disk drive.
  11. Place the disk inside the disk drive.
  12. Open the turtle.
  13. Type "cp /disk/startupBACKUP startup"
  14. Start "startup"
  15. Close the turtle.
Versus...
  1. Open the turtle.
  2. Type "pastebin put startup"
  3. Record the pastebin code.
  4. Close the turtle.
  5. Go over to your new turtle and open it.
  6. Type "pastebin get <CODE> startup"
  7. Start "startup"
  8. Close the turtle.
Now, if you are on a server that does not have HTTP enabled, you'll have to do the disk method, which sucks. I used to use it, and pastebin is a WHOLE lot better, by far.
 

TheBaz

New Member
Jul 29, 2019
13
0
0
Thanks for the quick replies I was just trying out your suggestions just then. Which turned out to take a while because I'm retarded and put a capital in the code. >_> I honestly didn't even know about the pastebin function so thanks for that. That'll make things in the future much much easier. Also I appear to be getting an error when trying out your code Gus. " '=' expected"
 

trunksbomb

New Member
Jul 29, 2019
390
0
0
Code:
while true do
if turtle.attack() then
  print("Burn it with FIRE!")
else
  print("Don't fire until you see the whites of their eyes....")
end
 
if turtle.getItemCount(14) > 0 then
  print("Oh gods, so much stuff.... VOID VOID VOID!"
  for vSlotCount = 16, 1, -1 do
    if turtle.getItemCount(vSlotCount) > 1 then
    turtle.select(vSlotCount)
    turtle.drop()
    print("Slot voided!")
  end
end
end
 
print("And now we play the waiting game...")
sleep(0.2)
end

There's a missing parentheses on print("Oh gods, so much stuff.... VOID VOID VOID!". Forgot to close it.
 

TheBaz

New Member
Jul 29, 2019
13
0
0
The whole thing is "bios:338: [string "startup"] :1: '=' expected" might just be me being retarded. xD
 

Guswut

New Member
Jul 29, 2019
2,152
0
0
The whole thing is "bios:338: [string "startup"] :1: '=' expected" might just be me being retarded. xD

Hrrmmm, hat sounds like I misplaced an equals sign, or forgot one, but I don't see anything like that. The "if turtle.attack()" should return either a TRUE or FALSE, which should work for that. Mm... Try making it "if turtle.attack() == "TRUE" then", perhaps, and see if that makes it happier. I have NOT tested the code I typed, as I don't have MineCraft in front of me.
 

TheBaz

New Member
Jul 29, 2019
13
0
0
Apparently that didn't fix it either. Hmm.[DOUBLEPOST=1362163360][/DOUBLEPOST]
Code:
while true do
if turtle.attack() == "TRUE"
  print("Burn it with FIRE!")
else
  print("Don't fire until you see the whites of their eyes....")
end
 
if turtle.getItemCount(14) > 0 then
  print("Oh gods, so much stuff.... VOID VOID VOID!")
  for vSlotCount =16, 1, -1 do
    if turtle.getItemCount(vSlotCount) > 1 then
    turtle.select(vSlotCount)
    turtle.drop()
    print("Slot voided!")
  end
end
end
 
print("And now we play the waiting game...")
sleep(0.2)
end

It might have been a typo on my end? From what I can see it seems to be all good.
 

Guswut

New Member
Jul 29, 2019
2,152
0
0
Apparently that didn't fix it either. Hmm.[DOUBLEPOST=1362163360][/DOUBLEPOST]
Code:
while true do
if turtle.attack() == "TRUE"
  print("Burn it with FIRE!")
else
  print("Don't fire until you see the whites of their eyes....")
end
 
if turtle.getItemCount(14) > 0 then
  print("Oh gods, so much stuff.... VOID VOID VOID!")
  for vSlotCount =16, 1, -1 do
    if turtle.getItemCount(vSlotCount) > 1 then
    turtle.select(vSlotCount)
    turtle.drop()
    print("Slot voided!")
  end
end
end
 
print("And now we play the waiting game...")
sleep(0.2)
end

It might have been a typo on my end? From what I can see it seems to be all good.

Ah, sorry, I (as usual, damn you LUA) forgot a "then" at the end of the if command.

And wait, I may have added too many "end" commands. Although that shouldn't cause that issue. Mmmm. Try the above code fix, please.
 

TheBaz

New Member
Jul 29, 2019
13
0
0
Code:
while true do
if turtle.attack() then
  print("Burn it with FIRE!")
else
  print("Don't fire until you see the whites of their eyes....")
end
 
if turtle.getItemCount(14) > 0 then
  print("Oh gods, so much stuff.... VOID VOID VOID!")
  for vSlotCount =16, 1, -1 do
    if turtle.getItemCount(vSlotCount) > 1 then
    turtle.select(vSlotCount)
    turtle.drop()
    print("Slot voided!")
  end
end
end
 
print("And now we play the waiting game...")
sleep(0.2)
end

Seems to be working now. Replaced "== "TRUE"" with "then" how you originally had it. It now spams the text not sure if intended though. :)
 

Guswut

New Member
Jul 29, 2019
2,152
0
0
Code:
while true do
if turtle.attack() then
  print("Burn it with FIRE!")
else
  print("Don't fire until you see the whites of their eyes....")
end
 
if turtle.getItemCount(14) > 0 then
  print("Oh gods, so much stuff.... VOID VOID VOID!")
  for vSlotCount =16, 1, -1 do
    if turtle.getItemCount(vSlotCount) > 1 then
    turtle.select(vSlotCount)
    turtle.drop()
    print("Slot voided!")
  end
end
end
 
print("And now we play the waiting game...")
sleep(0.2)
end

Seems to be working now. Replaced "== "TRUE"" with "then" how you originally had it. It now spams the text not sure if intended though. :)

It is going to post a lot of text quickly. Try replacing the "sleep(0.2)" with a "sleep(2)" just to see if it spams next still, or if it just posts it ten times slower. Otherwise, if you get it working and everything looks proper, then feel free to remove the print() lines as they are there to tell you what is happening currently, and for a bit of flavor.
 

trunksbomb

New Member
Jul 29, 2019
390
0
0
That is intended, as it will display either of those text options every iteration of the loop, which happens every 0.2 seconds.
 

TheBaz

New Member
Jul 29, 2019
13
0
0
Everything is working 100% now. From the killing down from the voiding of the loot. Thanks for your help guys and great coding. :)