Ask a simple question, get a simple answer

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • FTB will be shutting down this forum by the end of July. To participate in our community discussions, please join our Discord! https://ftb.team/discord

xSINZx

New Member
Jul 29, 2019
305
0
0
I have a slight problem with my melee turtles. I started with the usual "while true do ..attack.. end" loop and that works fine. What I would like to implement next is a detectDown() into the mix. Yeah, overly complicated but hey, easy is meh. ;)

Code atm looks like this:

Code:
while turtle.detectDown() do
  while turtle.attack() do
  print ("Block present.")
  turtle.attack()
  end
end

It is printing the "Block present" message - but even though it has a zombie right in front of it, it is not attacking. I'm obviously doing something very wrong. Hooray for the lua-nub. Please, a pointer (pun not intended) into the right direction?

New to this LUA also, have you tried a sleep(.1) after turtle.attack()

I am using something similar but mine has the sleep line in it which I think makes it start the code again from the start. But keep working in a loop so its not just trying to attack once.
 

Freakscar

New Member
Jul 29, 2019
575
0
1
Can't you just run the redstone up to the turtles? I'm pretty sure they can interact with it.
Otherwise you can use a wireless modem and control them all from a centralised computer :) Wirelessness and less lag
I tried it with os.pullEvent first - but alas, poor Yorik here never got that one working at all. Luckily, I fiddled with my startup a bit more. Now it's doing its job. Attacking mobs (and, yes, me) whenever the pistons are extended and falling "asleep" again, when they are not. Which is complicated enough for me. ;)

Anyone wondering - heres the code and the pastebin (Link):
Code:
while true do
  while turtle.detectDown() do
  if turtle.attack() then
  print ("Attacking!")
  turtle.attack()
  end
  end
end
 

tehBlobLord

New Member
Jul 29, 2019
547
0
0
Yeah I actully like the neitherrack system over the lava pumping system personally. I don't mind semi-infinite systems. They tend to have a lot of setup and at lest you sometimes have to go back and restock them up.

I'm just not a huge fan of static systems that are overly simple. I can't stand solar sure it is a bit costly to make the higher teir ones. But they take up only a 1x1 space and then run forever with no extra work beyound running a cable.

You know what I would love... a real solar farm. One you use to make steam from the sun.

You know one of these

desert-solar-farm.jpg


I would totally rock that.
I'm pretty excited for Xycraft because apparently the power system involves bulky-ish multiblocks, which sounds really cool (and a bit like this).
Have you played around with Factorisation? That photo looks a lot like the setup that they use.
 

Moezso

New Member
Jul 29, 2019
312
0
0
Yeah I actully like the neitherrack system over the lava pumping system personally. I don't mind semi-infinite systems. They tend to have a lot of setup and at lest you sometimes have to go back and restock them up.

I'm just not a huge fan of static systems that are overly simple. I can't stand solar sure it is a bit costly to make the higher teir ones. But they take up only a 1x1 space and then run forever with no extra work beyound running a cable.

You know what I would love... a real solar farm. One you use to make steam from the sun.

You know one of these

desert-solar-farm.jpg


I would totally rock that.
That's pretty much the Factorization power system. Not nearly as impressive a scale, but the same concept.
 

Peppe

New Member
Jul 29, 2019
836
0
1
Can't you just run the redstone up to the turtles? I'm pretty sure they can interact with it.
Otherwise you can use a wireless modem and control them all from a centralised computer :) Wirelessness and less lag
Run redstone, red alloy, or jacked wire up to any side of the turtle, i'll assume you run it to the bottom in the code below.

I like to do something like this:

Redstone on = attack:

Code:
while true do
    if rs.getInput("bottom") then
        turtle.attack()
    else
        os.pullEvent("redstone")
    end
    sleep(.1)
end

Redstone off = attack:
Code:
while true do
    if not rs.getInput("bottom") then
        turtle.attack()
    else
        os.pullEvent("redstone")
    end
    sleep(.1)
end




os.pullEvent("redstone") pauses the program on that line until a redstone signal changes next to the turtle. Then it loops back through and checks if the bottom is in the right state. If it is it attacks.
 
  • Like
Reactions: Saice

Saice

New Member
Jul 29, 2019
4,020
0
1
I'm pretty excited for Xycraft because apparently the power system involves bulky-ish multiblocks, which sounds really cool (and a bit like this).
Have you played around with Factorisation? That photo looks a lot like the setup that they use.

I have... I am just sad over all Factorisation is a bit of a closed loop. There really is not a good way to get its power out of the mod.
 

jumpfight5

New Member
Jul 29, 2019
1,750
0
1
There's powerconverters, I think it's as strong as an MJ.[DOUBLEPOST=1363553275][/DOUBLEPOST]There's a really good Extrabees "cheat" site, and it shows all of the different bees and how to get them in a type of horizontal tree/flow chart.
Can anyone give me a link to this place? I can't find it anywhere :eek:
 

jumpfight5

New Member
Jul 29, 2019
1,750
0
1
Yeah, but if it's the only way, it's the only way. Someone used a block that turned FZ power into steam, seems realistic because it's Solar Turbine that uses water, so why not make steam?
 

Exedra

New Member
Jul 29, 2019
1,261
0
0
There's powerconverters, I think it's as strong as an MJ.[DOUBLEPOST=1363553275][/DOUBLEPOST]There's a really good Extrabees "cheat" site, and it shows all of the different bees and how to get them in a type of horizontal tree/flow chart.
Can anyone give me a link to this place? I can't find it anywhere :eek:
http://wiki.feed-the-beast.com The guide MilConDoin wrote is now hear. And ou may have been thinking of hexflower, which died.
 

MouseyPounds

New Member
Jul 29, 2019
58
0
0
I have... I am just sad over all Factorisation is a bit of a closed loop. There really is not a good way to get its power out of the mod.
That is changing; the solar turbine will soon produce steam. Quoting neptunepink's post on MCF regarding changes in Factorization 0.7.21:
The solar turbine got split into two components, the solar boiler & the steam turbine. The boiler works just like the old solar turbine does. It'll spit steam into a steam turbine placed on top of it, or you can run some other mod's fluid pipes between them. Or you can skip the mirror/boiler setup and pump steam directly into the turbine. (I'm interested in people's opinions of how balanced it is with Railcraft's boiler.) Water can be piped into the boiler, in addition to it being able to suck up water.

See Zjarek_S' post on a setup using this mechanic that has a pic which looks very much like the image you posted.
 
  • Like
Reactions: Saice

BlackFire

New Member
Jul 29, 2019
344
0
0
I found out that it's the "detectDown()" part that makes everything go downhill. I wanted to activate/deactivate the turtle with a piston - which would push a block up towards the turtle, so that detectDown() would return true and when I deactivate the piston, removing the block again and thus detectDown() returns false. So far, that works - but only one time. Once deactivated (block removed), the program ends. Is there a way that I can get my turtle to "wait" for this block to return, instead of terminating the execution of the program as a whole?
(I know, yet again, why I hate these little square buggers... -.-)

you can create an event : os.pullEventRaw(turtle.detectDown())

that may work