Jump to content

Welcome to FTB Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Need help with automating Railcraft unloaders


No replies to this topic

#1
TheCreepySheep

TheCreepySheep

    Newbie

  • Members
  • Pip
  • 1 posts
  • IGN:TheCreepySheep
  • Modpack:FTB Infinity

 Hello,
I am looking for a way to interact with Railcraft Item Loaders (and Unloaders) via a CC Computer. The goal here being the ability to unload coal at will.

More specifically, I have a train that collects supplies from around the base and brings them to the main station to be transported to my underground storage facility. Since some of the "farms" around the base use machines that run on charcoal power, I want to able to decide whether to unload said coal from the train.
I am rather familiar with lua and coding in general so that should not an issue.

Some code:

chest = peripheral.wrap("top")

function getAmount()
    local amount = 0
    for i=1, chest.getInventorySize() do
        slotinfo = chest.getStackInSlot(i)
        if slotinfo then
            if slotinfo.name == "coal" then
                amount = amount + slotinfo.qty
            end
        end
    end
    return amount
end
print(getAmount)

-- Now the pseudo part

if getAmount < 64 then
    --Add (64 - getAmount) to Unloader filter and set mode to "Transfer"
end
 
Thanking in advance,
TheCreepySheep
 

 





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users