Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- Jukebox = {--{{{
- currentTrack = 1,
- computerID = 7,
- }--}}}
- function Jukebox:currentSlot()--{{{
- print('Sending: ' .. tostring(self.currentTrack))
- rednet.send(self.computerID, "currentSlot " .. tostring(self.currentTrack))
- end--}}}
- function Jukebox:selectSlot(slot)--{{{
- self.currentTrack = slot
- turtle.suck()
- print(self.currentTrack)
- turtle.select(self.currentTrack)
- turtle.drop()
- self:currentSlot()
- end--}}}
- jukebox = Jukebox
- while true do
- event, messageFrom, message = os.pullEvent('rednet_message')
- if event == 'rednet_message' then
- if message == 'currentSlot' then
- jukebox:currentSlot()
- elseif string.find(message, 'selectSlot') then
- jukebox:selectSlot(tonumber(string.sub(message, 11)))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement