- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
DataHunter
-
Content Count
3 -
Joined
-
Last visited
Posts posted by DataHunter
-
-
Good day
I am reading a chest full of items, and I want to store the items data for later use.
you can see the snippet of the program and I hope you see what I mean.
How do I store and recall a list of items?
local component = require("component")
local sides = require("sides")
local tp = component.transposer
slot = 1
for i = 1 , slot do
gis = tp.getItemInSlot(sides,east,i) --store item that is being read to recall later
if gis then
gp.label(i) == gis.label
gp.size(i) == gis.size
slot = slot + 1
endend
for i = 1 , slot do -- recall stored item and print
print(gp.label(i)
print(gp.size(i)
end
-
Good day all
I hope someone can help me. I am making a nice map with chalanges.
I have a case with a transposer, I want two chests on the east and west side of the transposer.
I want to put items in the west chest and the transposer should read all the items in the slot and the amount of it. I could read the item and the amount although the item is read in a code of some sort. How do I get the real name of the item to show? I think I can figure out how to compre the items in the chest although help with this would also be appreciated.
Thank you
for loop storing data
in Programming
Posted
Thanks alot
I will try this, Iam still a beginner trying to write an advanced program.
Although I think I will get this to help me.
There is still one question that I have left and that is, I am reading items from a chest and then I print it ona screen. How can I compare all the slots by gp[slot].label and if it is the same then I want to add the gp [slot].size together.
The slots might be scrambled so I need to check all the slots compare then and then save them. Will it look almost like this?
for i = 1, slot do
If gp [slot].label == gp .label then
gp [slot].size = gp [slot].size + gp.size
gp .label = nil --to remove the compared slot if it was the same
gp .size = nil
end --if
end --for