Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- me = peripheral.find("meBridge")
- -- first line: item name
- -- second line: maxAmount
- -- third line: unitCost
- local handle = fs.open("values.txt", "r")
- if handle then
- name = handle.readLine()
- print("Name is " .. name)
- maxAmount = handle.readLine()
- print("Max amount is " .. maxAmount)
- unitCost = handle.readLine()
- print("Unit cost is " .. unitCost)
- else
- print("File not found...")
- quit()
- end
- handle.close()
- melist = me.listItems()
- for i=1, #melist do
- print(melist[i].name)
- if melist[i].name == name then
- listIndex = melist[i]
- print(name .. " found at index " .. i)
- else
- print(name .. " not found.")
- end
- end
- print(listIndex.name .. " " .. listIndex.amount)
- --maxAmount = 4000
- print("Max amount " .. maxAmount)
- --unitCost = 1024
- print("Cost at 50% " .. unitCost)
- percent = (listIndex.amount / maxAmount) * 100
- print("Current percent " .. percent)
- shrinkAmount = (percent-50)/25
- print("Shrink result " .. shrinkAmount)
- sigmoid = shrinkAmount/(1+math.abs(shrinkAmount))
- print("Sigmoid " .. sigmoid)
- finalCost = math.floor(unitCost * (1 - (sigmoid * 1.5)))
- print("Final cost " .. finalCost)
- SellPrice = math.floor(finalCost * 0.9)
- print("Sell cost " .. SellPrice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement