Jump to content


Avarion's Content

There have been 15 items by Avarion (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#247316 Comprehensive Strip Miner

Posted by Avarion on 05 March 2016 - 11:59 AM in Turtle Programs

Does not work for me. b_update causes a crash in line 67. Attempt to compare __lt on nil and nil



#223919 Combine turtle.inspect() with while?

Posted by Avarion on 30 June 2015 - 08:11 AM in Ask a Pro

Thank you both. I've made it work now with variables.

As soon I'm finished with work I'll change the code from inspect to detect.



#223811 Combine turtle.inspect() with while?

Posted by Avarion on 29 June 2015 - 06:22 PM in Ask a Pro

Hi,

I try to make a turtle digging while there is gravel in front of it.

My first test was

  if turtle.forward() == false then
   if turtle.inspect() == true, "minecraft:gravel" then
    while turtle.inspect() == true, "minecraft:gravel" do
	 turtle.dig()
	 sleep(1)
    end
   else
    break
   end
  end

Unfortunately it seems the while command is not able to handle both values at once. Is there a way to make it work or do I have to fill the inspect information to variables first and compare then?



#220257 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 02:02 PM in Ask a Pro

Argh. Thanks. Sorry to waste your time with this :(



#220254 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 01:52 PM in Ask a Pro

Does not change the result. Still attempt to call nil value



#220252 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 01:27 PM in Ask a Pro

Thanks. One last question. Though its not part of the original I'm not sure if I need to open a new thread. I now try to put the work in functions but it seems I do not know how to submit the table to the function. The content seems to get lost because I always get the message: "attempt to call nil"

function getMaxEnergy(cell)
local count = 0
local i = 0
for i in pairs(cell) do
  count = count + cell[i].getMaxEnergy()
end
print(i)
return(count)
end
cell = {peripheral.find("tile_thermalexpansion_cell_resonant_name")}

print(getMaxEnergy(cell))



#220248 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 01:01 PM in Ask a Pro

View PostBomb Bloke, on 07 June 2015 - 12:57 PM, said:

The type being passed to peripheral.find() may be incorrect. Probably too short, by the looks of things - try "tile_thermalexpansion_cell_resonant_name"

Thanks. That was the solution. I thought find (and my variant) look up a part of the string and wrap when the part is found in the peripherals name.



#220245 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 12:52 PM in Ask a Pro

Still it refuses to comply.

x = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_3")

print("Energy: "..x.getEnergyStored("unknown"))
print("Max Energy: "..x.getMaxEnergyStored("unknown"))

This prints:

Energy: 78236235
Max Energy: 80000000

And this prints nothing:

cell = {peripheral.find("tile_thermalexpansion_cell")}

for i = 1, #cell do
  print(cell[i].getEnergyStored())
end

Even when I add the "unknown" to the method.



#220242 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 11:53 AM in Ask a Pro

I've checked find and I've tried to fix my old code. Both result in the same problem. I do not get the data.

function prepare()
cell = {}
local peripheralList = peripheral.getNames()
counter = 0
for Index = 1, #peripheralList do
  if string.find(peripheralList[Index], "tile_thermalexpansion_cell") then
	counter = counter + 1
	cell[counter]=peripheral.wrap(peripheralList[Index])
   end
end
return(cell)
end

cell = prepare()

print(cell[1][1])

cell = {peripheral.find("tile_thermalexpansion_cell")}
print(cell[1][1])

The table seems always to be empty.

If I wrap a single energy cell I get data.

Edit: Oh, if I use just cell[1] I just get the table ID, thus I've used [1][1]. There might be the problem if I haven't understood how table work.



#220216 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 08:08 AM in Ask a Pro

Argh, thanks. I intended to put it in the IF but it seems I mixed it up. I'll try the find.



#220213 Storing multiple peripherals in a table

Posted by Avarion on 07 June 2015 - 07:48 AM in Ask a Pro

Hi,

I'm trying to read the energy status of multiple energy cells. I'm trying to make it adaptive so I just have to add more cells and add them to the network and the program recognizes them. Therefore I thought I use function which uses a loop to check for all the cells and add them to a table. Then returns the table. Unfortunately it seems the table is empty when I try to access it from the main program.

function prepare()
cell = {}
local peripheralList = peripheral.getNames()
counter = 0
for Index = 1, #peripheralList do
  counter = counter + 1
  if string.find(peripheralList[Index], "tile_thermalexpansion_cell") then
   cell[counter]=peripheral.wrap(peripheralList[Index])
  end
end
return(cell)
end
function getEnergy()
end

cell = prepare()
print(cell[1].getType())



#213732 Is there a way for turtles to go through doors?

Posted by Avarion on 12 April 2015 - 08:09 PM in Ask a Pro

Thanks. I think I'll go with the piston method.



#213720 Is there a way for turtles to go through doors?

Posted by Avarion on 12 April 2015 - 05:59 PM in Ask a Pro

It seems I always get the "movement obstructed" message. Is there a way around this? It does not matter if its a normal door or a 6x3 garage door from carpenter blocks.

I don't like the idea of having open wall or ceiling elements in my base for the turtles to use.



#212025 Is there a way to place microblocks or facades on carpenter blocks?

Posted by Avarion on 02 April 2015 - 12:46 PM in Peripheral Help and Discussion

Thanks. I hope the creator of computercraft will add the support for the other mods at some point.



#210972 Is there a way to place microblocks or facades on carpenter blocks?

Posted by Avarion on 25 March 2015 - 08:31 PM in Peripheral Help and Discussion

I'd like to automate the placing of the named blocks but I don't got the orientation of the microblocks right. Is there a way to handle this. Perhaps an addon to computercraft?