Jump to content




Computronics Christmas Tree Lights


2 replies to this topic

#1 WolfyXK

  • Members
  • 10 posts

Posted 23 December 2015 - 10:43 PM

Thats the program finally done now. Big thanks to Lupus590, zguystudios and Dragon53535 for helping me out.

This program is designed to make any connected colorful lamps from the computronics mod flash in random colours.
Make sure you connect all the colorful lamps you are going to use to the computer using wired modems.

Quote

pastebin get bJ0j2NYT lights

Posted Image

print("|WolfOS| Christmas Light Controller")
local tbl = {} -- Declare tbl as a table to store lamps in
--#Find and automatically wrap lights.
for a,v in pairs(peripheral.getNames()) do -- Start loop
  if (peripheral.getType(v) == "colorful_lamp" ) then -- If lights are detected then continue
	tbl[#tbl + 1] = peripheral.wrap(v) -- Add lamps to table
  end
end
while true do -- Start loop
local color = math.random(0,32767) -- Chooses a random colour
local random = math.random(1,#tbl) -- Select a lamp at random
tbl[random].setLampColor(color) -- Set selected lamp to random colour
print("Lamp " .. random .. " changed to color " .. color) -- Print selected lamp and colour it has been changed to
sleep(0.5) -- Wait half a second then change the next lamp
end


#2 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 25 December 2015 - 12:19 AM

Nice, very festive! :D

#3 WolfyXK

  • Members
  • 10 posts

Posted 25 December 2015 - 01:15 AM

You can see the factory that the christmas tree is housed in if anyone is interested :)

http://www.computerc...rolled-factory/





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users