IC2 Reactors + Computercraft

  • 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

Flexico

Well-Known Member
Dec 15, 2012
328
39
53
I want to use a Computer to control my reactors, and I got them hooked up with wired modems, but I can't find a list anywhere of what the commands are!
 
from experience...i dont think there are commands to 'run' an ic2 reactor. its literally just turn on/off via redstone signal. the only use i ever had for cc with ic2 reactors was to turn off the reactor while replacing spent fuel cells with new ones. you have to design the reactor so it does not meltdown, or time it so when it does approach meltdown, turn it off, let it cool down, replace components, etc...then start it up again. generally you use inventory management with AE, factorization, buildcraft, etc to move things about as they wear down/heat up, and keep that process going.

I can only assume you are using proxies or directly connected modems to monitor the reactor blocks. if thats the case, you should be able to do: peripheral.call("interface_name", "getMethods") where "interface_name" is the name that comes up on your chat log when you activated the modem attached to the reactor block. for example, a thaumcraft aspect jar would appear as "aspectContainer_0" or similar, and you should see a list of methods when you do peripheral.call("aspectContainer_0", "getMethods").

if the list is too long for the screen, you can also do this:

Code:
list = peripheral.call("interfaceName", "getMethods") -- replace interfaceName with proper name of reactor component reported in your chat log when you activated its modem
file = fs.open("methods", "w")
file.write(textutils.serialize(list))
file.close()

and after running that, you should have a file called methods. edit that to see what was in that list. mod authors tend to make the method names descriptive enough that it should not be hard to figure out what the methods do and how to use them.
 
I know that there are many commands added by the OpenPeripherals mod that give control over reactors. I just don't know what they are.

Using your code, I got the following:
Code:
swapStacks(from,to,fromDirection?,fromDirection?)
getHeat()
getInventoryName()
destroyStack(slotNumber)
pushItem(direction,slot,maxAmount?,intoSlot?)
getAdvancedMethodsData()
getInventorySize()
getEUOutput()
pushItemIntoSlot(direction,slot,maxAmount?,intoSlot?)
isActive()
getStackInSlot(slotNumber)
getTankInfo(direction)
getAllStacks()
listMethods()
pullItem(direction,slot,maxAmount?,intoSlot?)
getMaxHeat()
condenseItems()
pullItemIntoSlot(direction,slot,maxAmount?,intoSlot?)
isValid()
Time to experiment I guess. =P
 
the getHeat, getEUOutput, getMaxHeat, isActive calls are specific to the reactor. the rest are for manipulating items in the inventory (these are the same for any block which has an inventory, like chests, crafting tables, etc). which is good, youd need that if you planned on doing everything with the turtle. if you want to move stuff between the reactor and the turtle, make sure you use a narcissistic turtle, that will let pushItem/pullItem move items into/from the turtle itself instead of another attached inventory. then use rs.setOutput(side, true/false) to activate/deactivate the reactor. easy ;) not sure what getTankInfo would do tho, i dont recall ic2 reactors ever needing any type of fluids.
 
I think the thing about the fluids refers the config option to have reactors output steam for Railcraft machines instead of EU.

I can't for the life of me figure out how to work the inventory commands (pushItem, pullItem, etc). What I'm trying to do is replace depleted fuel rods with fresh ones. I already have systems set up to swap out coolant cells as they get too hot, and turn the reactor on/off as needed. I need something to precisely swap out specific fuel slots faster than AE can shove fresh coolant into them, and computers seem to be the ticket. The code I have so far is supposed to pull out the spent fuel rods and shove them into a chest (I'd rather have it pull into the turtle's inventory, but whatever.) The redstone signal from the back is from buildcraft gates that test if there are spect fuel cells in the reactor.
Code:
local function depletedFuel()
return redstone.getInput("back")
end

local x
local reactor = peripheral.wrap("top")
local chest = "south"
local slot = { 9, 10, 13, 14, 17, 18,
  21, 22, 25, 26, 29, 30,
  33, 34, 37, 38}

while true do
if depletedFuel() then
  --sleep(10)
   for x=1, #slot do
   turtle.select(16)
   reactor.pushItemIntoSlot(chest, slot[x])
   print(slot[x])
  end

else
  print("Idling")
end
sleep(1)
end
I've tried many different variations of "pushItemIntoSlot", and I can't even tell the difference between the "Push" vs. "pull" or whether it's "intoSlot" or not. Nothing ever gets moved.
 
you have to use the commands as if you were doing them from the reactor

so if you did reactor.pushItemIntoSlot("south", 1, 1, 9) then this would push 1 item, from slot 1 of the reactor, to an inventory south of the reactor block, into slot 9 of that inventory

with pullItem, its the reverse, grabbing an item from an inventory in the direction specified from the reactor block. to do this from/to a turtles inventory, try the narcissistic turtle from openperipherals, i believe those will work with the push/pull commands
 
So, what command would I use to pull an item from, say, slot 9 of the reactor into the turtle's inventory? (Narcissistic of course)
 
should be, assuming the turtle is south of the reactor block, and assuming you want the item in the turtles first inventory slot: reactor.pushItem("south", 9, 1, 1)
 
Ok, after much research and experimentation, I found the solution. I need to wrap one inventory as a peripheral, and have the other inventory right next to it, and the "direction" is relative to those two, not to where the computer is. I saw a video of someone using the push/pull commands and for the life of me I could not figure out how it was all hooked up. Maybe I should make a video of it to explain this since there are probably others like me who didn't get that part.