Clipboard.

  • 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

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
MagictheLols1.png
 
  • Like
Reactions: xTordX

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
Code:
--declare all variables
--configuration
--chest coontaining the presses and the circuits. This is also the output(highest slot in gui)
local configPressChest        = "container_chest_9"
--the chest containing the printed silicon (lowest slot in the gui)
local configSiliconChest    = "container_chest_8"
--the chest containing the other materials(the middle slot in the gui)
local configMaterialChest    = "container_chest_11"
--not yet implemented
local sleepTime             = 1
--time in seconds needed to craft
local craftTime                = 10
--need better implementation (for all chests)
local materialChestSide     = "west"   
--amount of slots in the machine(inscriber has 4)
local machineSlots            = 4
--get all the peripherals
local chests={}
chests['top']                = peripheral.wrap(configPressChest)
chests['bottom']            = peripheral.wrap(configSiliconChest)
chests[materialChestSide]    = peripheral.wrap(configMaterialChest)

--tables
--crafting recipes
local crafting={}
--silicon
crafting['printedSilicon']        ={'Inscriber Silicon Press',"Silicon"}
--printed circuits
crafting['printedLogic']        ={'Inscriber Logic Press','Gold Ingot'}
crafting['printedCalculation']    ={'Inscriber Calculation Press','Pure Certus Quartz Crystal'}
crafting['printedEngineering']    ={'Inscriber Engineering Press','Diamond'}
--processors
crafting['logicProcessor']        ={'Printed Logic Circuit','Redstone','Printed Silicon'}
crafting['calculationProcessor']={'Printed Calculation Circuit','Redstone','Printed Silicon'}
crafting['EngineeringProcessor']={'Printed Engineering Circuit','Redstone','Printed Silicon'}
--used to get the direction items need to be pushed or pulled from
local useableDirection={north="SOUTH",east="WEST",south="NORTH",west="EAST",top="DOWN",bottom="UP"}
--functions

function craft(ingredients)
    local items={}
    local amount=0
    local errorMessage=nil
    local succes=nil
    local errorMessage=nil
    --remove all items from the machine
    cleanup(machineSlots)
    --loop over all the items that need to be inserted
    for key,value in pairs(ingredients) do
        --insert the item
        succes,errorMessage=itemToInscriber(key,value)
        --if something went wrong give the error message
        if not succes then
            print(errorMessage)
            return false, errorMessage
        end
    end
    --wait until it is done and then all the items need to be removed from the machine
    sleep(craftTime)
    cleanup(machineSlots)
    return true
end
--put the item in the inscriber
function itemToInscriber(slot,needed)
    print("inserting ",needed)
    local pushed=0
    --loop over all the chests, to look if it has the needed items and insert them
    for chestKey, chest in pairs (chests) do
        --get a table with all the items in the current chest
        local items =chest.getAllStacks(false)
        --loop over all the items
        for key,value in pairs(items) do
            --check if the needed item is found
            if value['display_name']==needed then
                --if the current chests place does not match one of the possibilities give an error
                if useableDirection[chestKey] ==nil then
                    return false , chestKey.." is not a valid place for the chest to be."
                end
                --push the item to the machine, and get the amount of items that got pushed
                pushed=chest.pushItem(useableDirection[chestKey],key,1)
                --the amount of pushed items does match one, stop return true and no error message as there was no error to be seen
                if pushed==1 then
                    return true, nil
                end
            end
        end
    end
    --the needed item was not found or was found but couldn't be inserted, give error + error message
    return false,needed.." was not found in the chests"
end
--used to clean the inscriber up
function cleanup (slots)
    print("cleaning the machine")
    --loop over all the chests
    for chestKey,chest in pairs(chests) do
        --loop over all the items the machine has
        for times=1,slots do
            --make sure the chest has an usable direction
            if useableDirection[chestKey]~=nil then
                chest.pullItem(useableDirection[chestKey],times,64)
            end
        end
    end
end
       
--other variables
local what=nil

--main loop
while true do
    print("Welcome to LC's inscribe'omatic. How can I help you?")
    what=io.read()
    if crafting[what]~=nil then
        print("How much do you want to be made?")
        amount=io.read()
        print("I'm on it. Making this would require ",((craftTime*amount)+(sleepTime*amount))," seconds to make. Sorry for the inconvenience, I hope you can forgive me.")
        for make=1,amount do
            craft(crafting[what])
            sleep(sleepTime)
        end
        print("Sir, I am happy to say that your order is done. Look in the press chest to find your crafted items.")
    else
        print("I am so sorry sir, but I don't know how to make ",what,". I however do know how to make the following:")
        for key,value in pairs(crafting)do
            print(key)
        end
        print("I hope you can forgive me.")
    end
end
Oh, look my script to automate ae2 inscribers using only one of them for all their recipes (except the cloning)
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
_end = 0,
_byte = 1,
_short = 2,
_int = 3,
_long = 4,
_float = 5,
_double = 6,
_byte_array = 7,
_string = 8,
_list = 9,
_compound = 10,
_int_array = 11
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
you mean
All hail, king of the losers!

that is an aoe2 taunt that I have in my clipboard
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Code:
template<class T>
tag_primitive<T>::operator T() const
{
  return value;
}
hehe
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
"Son, let's set up 2 stools on the platform. You and I can just model how a father and son should talk through these issues. It'll be great."

My father was giving a talk about sex and related things at a church camp. Thankfully, I didn't have to do this.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
+rep You are wrong
-rep There is a giant anvil on your head.

because writing + rep and -rep takes less time then copy paste and remove :p
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
anaemia
because I am too lazy to remember how it so I just go to google translate to translate "bloed armoede"