Advertisement
TomWaa

[Lua][WIP] CC client thing idk

Mar 26th, 2022
1,494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. protocol = "mainServerComs"
  2.  
  3. -- Start setup
  4. rednet.open("top")
  5. serverID = rednet.lookup(protocol, "main_server")
  6. if serverID == nil then
  7.     error("Can't connect to the main server")
  8. end
  9.  
  10. rednet.send(serverID, "connected", protocol)
  11.  
  12. while true do
  13.     local eventValues = { os.pullEvent() }
  14.  
  15.     if eventValues[1] == "key_up" then
  16.         if eventValues[2] == keys.q then
  17.             break
  18.        
  19.         elseif eventValues[2] == keys.l then
  20.             rednet.send(serverID, "lights", protocol)
  21.             print("Toggling lights")
  22.         end
  23.     end
  24. end
  25.  
  26. -- Cleanup
  27. rednet.send(serverID, "disconnected", protocol)
  28. rednet.close("top")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement