Advertisement
Pinkishu

gtest

Jun 9th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. -- Function decToHex (renamed, updated): http://lua-users.org/lists/lua-l/2004-09/msg00054.html
  2. local function decToHex(IN)
  3.     local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
  4.     while IN>0 do
  5.         I=I+1
  6.         IN,D=math.floor(IN/B),math.fmod(IN,B)+1
  7.         OUT=string.sub(K,D,D)..OUT
  8.     end
  9.     return OUT
  10. end
  11.  
  12. -- Function rgbToHex: http://gameon365.net/index.php
  13. local function rgbToHex(c)
  14.     local output = decToHex(c["r"]) .. decToHex(c["g"]) .. decToHex(c["b"]);
  15.     return output
  16. end
  17.  
  18. glass = peripheral.wrap("right")
  19. glass.clear()
  20. os.pullEvent=os.pullEventRaw
  21. local strs = {"Hello?","Anyone?","help","Help me!","I'm stuck","AAAHHH","Please help"}
  22. local txts = {}
  23. local i=1
  24. local p=1
  25. while true do
  26.     if txts[i] == nil then
  27.         txts[i] = glass.addText(math.random(1,850),math.random(1,600) , strs[math.random(#strs)], tonumber(rgbToHex({r=math.random(0,255),g=math.random(0,255),b=math.random(0,255)}),16))
  28.     else
  29.         txts[i].setText(strs[math.random(#strs)])
  30.         txts[i].setX(math.random(0,850))
  31.         txts[i].setY(math.random(0,500))
  32.     end
  33.     os.sleep(math.min(1-(p/250),0.05))
  34.     i=i+1
  35.     if p < 250 then p=p+1 end
  36.     if i > 250 then i=1 end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement