Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function decToHex (renamed, updated): http://lua-users.org/lists/lua-l/2004-09/msg00054.html
- local function decToHex(IN)
- local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
- while IN>0 do
- I=I+1
- IN,D=math.floor(IN/B),math.fmod(IN,B)+1
- OUT=string.sub(K,D,D)..OUT
- end
- return OUT
- end
- -- Function rgbToHex: http://gameon365.net/index.php
- local function rgbToHex(c)
- local output = decToHex(c["r"]) .. decToHex(c["g"]) .. decToHex(c["b"]);
- return output
- end
- glass = peripheral.wrap("right")
- glass.clear()
- os.pullEvent=os.pullEventRaw
- local strs = {"Hello?","Anyone?","help","Help me!","I'm stuck","AAAHHH","Please help"}
- local txts = {}
- local i=1
- local p=1
- while true do
- if txts[i] == nil then
- 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))
- else
- txts[i].setText(strs[math.random(#strs)])
- txts[i].setX(math.random(0,850))
- txts[i].setY(math.random(0,500))
- end
- os.sleep(math.min(1-(p/250),0.05))
- i=i+1
- if p < 250 then p=p+1 end
- if i > 250 then i=1 end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement