Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap( "top" );
- modem.open(14);
- red = 0;
- diax = 0;
- sili = 0;
- crys = 0;
- gold = 0;
- function clear()
- term.setBackgroundColor(colours.black)
- term.clear()
- term.setCursorPos(1,1)
- end
- while true do
- local event, modemSide, senderChannel,
- replyChannel, message, senderDistance = os.pullEvent("modem_message")
- clear();
- red = 0;
- diax = 0;
- sili = 0;
- crys = 0;
- gold = 0;
- tabela = message;
- if(type(tabela) == "table") then
- for id1 ,content1 in pairs(tabela) do
- if string.find(content1["name"], "redstone") then
- red = content1["count"] + red;
- end
- if string.find(content1["name"], "diamond") then
- diax = content1["count"] + diax;
- end
- if string.find(content1["name"], "silicon") then
- sili = content1["count"] + sili;
- end
- if string.find(content1["name"], "crystal") then
- crys = content1["count"] + crys;
- end
- if string.find(content1["name"], "gold") then
- gold = content1["count"] + gold;
- end
- end
- end
- print("redstone: " ..tostring(red));
- print("silicon: " ..tostring(sili));
- print("diamond: " ..tostring(diax));
- print("crystal: " ..tostring(crys));
- print("gold: " ..tostring(gold));
- end
Add Comment
Please, Sign In to add comment