DabDaddy6223

jukebox_frontend_startup

Jun 19th, 2026 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. JUKEBOX_ID = 1
  2. JUKEBOX_BACKEND_ID = -1
  3.  
  4. function main()
  5.     peripheral.find("modem", rednet.open)
  6.  
  7.     term.clear()
  8.     term.setCursorPos(1, 1)
  9.     print("Jukebox OS Alpha //")
  10.     print("Loading...")
  11.  
  12.     local protocol = "jukebox_" .. tostring(JUKEBOX_ID)
  13.     repeat
  14.         local id, message = rednet.receive(protocol)
  15.         if message == "ping" then
  16.             JUKEBOX_BACKEND_ID = id
  17.             rednet.send(JUKEBOX_BACKEND_ID, "pong", protocol)
  18.         end
  19.     until JUKEBOX_BACKEND_ID ~= -1
  20.  
  21.     textutils.slowPrint("####################")
  22.     sleep(1)
  23.     shell.run("jukebox_frontend", JUKEBOX_ID, JUKEBOX_BACKEND_ID)
  24. end
  25.  
  26. main()
Advertisement
Add Comment
Please, Sign In to add comment