Guest User

startup

a guest
Oct 2nd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.62 KB | None | 0 0
  1. local mon = peripheral.wrap("back") -- S??lectionez le cot?? de votre ??cran :3
  2. term.redirect(mon)
  3. os.loadAPI("json")
  4. term.clear()
  5. term.setTextColor(colors.gray)
  6. print("Obtention des tweets en cours... Merci de patienter")
  7. term.setCursorPos(3,1)
  8. Incr = 0
  9. term.setBackgroundColor( colors.black )
  10.  
  11. while true do
  12.  
  13.   local contenu = http.get("http://theo33500.tech/toath/twitteroauth/test.php")
  14.   --Ici changer Bill par le pseudo a surveiller.
  15.  while contenu == nil do
  16.   if Int == nil then
  17.    Int = 0
  18.   end
  19.   term.clear()
  20.   term.setTextColor(colors.gray)
  21.   term.setCursorPos(3,1)
  22.   print("Impossible d'obtenir les tweets.. Nouvelle tentative")
  23.   Int = Int + 1
  24.   sleep(2)
  25.   contenu = http.get("http://theo33500.tech/toath/twitteroauth/test.php")
  26.   if Int == 10 then
  27.   redstone.setOutput("top", true)
  28.   error("Impossible d'obtenir les tweets")
  29.   end
  30.  end
  31.    
  32.     local data = contenu.readAll()
  33.  
  34.   decode = json.decode(data)
  35.   i = 10
  36.   ii = 0
  37.  
  38.     while ii <= 10 do
  39.       if decode.statuses[i] ~= null then
  40.          local text = decode.statuses[i].text
  41.          text = text:gsub("u00e9","e")
  42.          text = text:gsub("u00e0","a")
  43.          text = text:gsub("u00a0"," ")
  44.         local from = decode.statuses[i].user.name
  45.         local at = decode.statuses[i].user.screen_name
  46.         local long = string.len(from)
  47.         local I = 74 - long
  48.  
  49. --if from = ModFriends_
  50. --  color = colors.white
  51. --end
  52.                        
  53.       if Incr==0 then
  54.         color = colors.orange
  55.       elseif Incr == 1 then
  56.         color = colors.orange
  57.       elseif Incr == 2 then
  58.         color = colors.magenta
  59.       elseif Incr == 3 then
  60.         color = colors.yellow
  61.       elseif Incr == 4 then
  62.         color = colors.lime
  63.       elseif Incr == 5 then
  64.         color = colors.pink
  65.       elseif Incr == 6 then
  66.         color = colors.gray
  67.       elseif Incr == 7 then
  68.         color = colors.cyan
  69.       elseif Incr == 8 then
  70.         color = colors.purple
  71.       elseif Incr == 9 then
  72.         color = colors.blue
  73.       elseif Incr == 10 then
  74.         color  = colors.brown
  75.       elseif Incr == 11 then
  76.         color = colors.green
  77.       else
  78.         Incr = 0
  79.       end
  80.  
  81.     Incr = Incr + 1
  82. if at == "theo33500" then
  83.   color = colors.white
  84. end
  85. term.setTextColor(color)
  86.          print("+--------------------------------------------------------------------------------+")
  87.         print("+\n+ "..text)
  88.         write("+\n+ de : " ..from)      
  89.         print("+--------------------------------------------------------------------------------+")
  90.       end
  91.  
  92.     i = i - 1
  93.     ii = ii + 1
  94.     sleep(0.1)
  95.     end
  96.  
  97.     sleep(45)
  98. end
Advertisement
Add Comment
Please, Sign In to add comment