Advertisement
Guest User

client

a guest
Apr 8th, 2020
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. --[[
  2. DementedChicken_'s DSU Client
  3. Remember to make:
  4. 1) value.txt to store the item price
  5. 2) item.txt to store the item name
  6. --]]
  7.  
  8. component = require("component")
  9. event = require("event")
  10. dsu = component.deep_storage_unit
  11.  
  12. --vars
  13. channel = 0
  14.  
  15. file = io.open("item.txt","r")
  16. item = file:read("*all")
  17. file:close()
  18.  
  19. file2 = io.open("value.txt","r")
  20. value = file2:read("*all")
  21. value = tonumber(value)
  22. file2:close()
  23.  
  24. --modem connection
  25. print "Connecting to Server..."
  26. os.sleep(1)
  27. print "LOADING...27%"
  28. os.sleep(1)
  29. print "LOADING...74%"
  30. os.sleep(1)
  31. print "LOADING...98%"
  32. component.modem.open(channel)
  33. print "Connection Established"
  34.  
  35. --calculate
  36. while (1==1) do
  37.   store1 = dsu.getStoredCount()
  38.   os.sleep(1)
  39.   store2 = dsu.getStoredCount()
  40.   if store1 == store2 then
  41.     buffer = 0
  42.   end
  43.   if (store1 == store2) == false then
  44.     total = store2 * value
  45.     component.modem.broadcast(channel,item,total)
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement