maxsar

chest reciv

Apr 15th, 2021 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. modem = peripheral.wrap( "top" );
  2. modem.open(14);
  3.  
  4. red = 0;
  5. diax = 0;
  6. sili = 0;
  7. crys = 0;
  8. gold = 0;
  9. function clear()
  10. term.setBackgroundColor(colours.black)
  11. term.clear()
  12. term.setCursorPos(1,1)
  13. end
  14.  
  15. while true do
  16. local event, modemSide, senderChannel,
  17. replyChannel, message, senderDistance = os.pullEvent("modem_message")
  18. clear();
  19. red = 0;
  20. diax = 0;
  21. sili = 0;
  22. crys = 0;
  23. gold = 0;
  24. tabela = message;
  25. if(type(tabela) == "table") then
  26. for id1 ,content1 in pairs(tabela) do
  27. if string.find(content1["name"], "redstone") then
  28. red = content1["count"] + red;
  29. end
  30.  
  31. if string.find(content1["name"], "diamond") then
  32. diax = content1["count"] + diax;
  33. end
  34.  
  35. if string.find(content1["name"], "silicon") then
  36. sili = content1["count"] + sili;
  37. end
  38.  
  39. if string.find(content1["name"], "crystal") then
  40. crys = content1["count"] + crys;
  41. end
  42.  
  43. if string.find(content1["name"], "gold") then
  44. gold = content1["count"] + gold;
  45. end
  46. end
  47. end
  48.  
  49. print("redstone: " ..tostring(red));
  50. print("silicon: " ..tostring(sili));
  51. print("diamond: " ..tostring(diax));
  52. print("crystal: " ..tostring(crys));
  53. print("gold: " ..tostring(gold));
  54. end
  55.  
  56.  
Add Comment
Please, Sign In to add comment