Advertisement
Guest User

startup

a guest
Feb 9th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. os.loadAPI("twitchapi")
  2. m = peripheral.find("monitor")
  3. m.setTextScale(2) --Getting around a CC bug
  4. m.setTextScale(1)
  5. liveX = 5
  6. notLiveX = 1
  7. startY = 1
  8. streamers = {
  9.   "lokbatch",
  10. }
  11. function nextY()
  12.   x,y = m.getCursorPos()
  13.   newY = y + 1
  14. end
  15. function streamerloop(streamer)
  16.   nextY()
  17.   m.setCursorPos(notLiveX,newY)
  18.   if twitchapi.checkLive(streamer) then
  19.     --m.setTextColor(colors.green)
  20.     m.write(streamer.." is live!")
  21.     --m.setTextColor(colors.white)
  22.     nextY()
  23.     m.setCursorPos(liveX,newY)
  24.     m.write(streamer.."'s Most Recent Viking: "..twitchapi.lastFollower(streamer))
  25.     nextY()
  26.     m.setCursorPos(liveX,newY)
  27.     m.write(streamer.."'s Viewer Count: "..twitchapi.viewerCount(streamer))
  28.   else
  29.     --m.setTextColor(colors.red)
  30.     m.write(streamer.." is not live!")
  31.     --m.setTextColor(colors.white)
  32.   end
  33. end
  34. function main()
  35.   while true do
  36.     m.clear()
  37.     for k,v in pairs(streamers) do
  38.       streamerloop(streamers[k])
  39.       sleep(5)
  40.     end
  41.   sleep(30)
  42.   m.setCursorPos(1,1)
  43.   end
  44. end
  45. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement