.
This commit is contained in:
		
							parent
							
								
									846dac82fe
								
							
						
					
					
						commit
						bb41aa8b61
					
				| @ -2,9 +2,9 @@ | |||||||
| local termWidth, termHeight = term.getSize() | local termWidth, termHeight = term.getSize() | ||||||
| local selectedItem = 1 | local selectedItem = 1 | ||||||
| local inMainMenu = true | local inMainMenu = true | ||||||
| local ActiveColor = 0 |  | ||||||
| local inLightsMenu = false | local inLightsMenu = false | ||||||
| local CableSite = "top" | local CableSite = "top" | ||||||
|  | local ActiveColor = rs.getBundledOutput(CableSite) | ||||||
| os.pullEvent = os.pullEventRaw | os.pullEvent = os.pullEventRaw | ||||||
| 
 | 
 | ||||||
| --[[Menu Methods]]-- | --[[Menu Methods]]-- | ||||||
| @ -27,29 +27,29 @@ function LightSystem() | |||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function LightOn() | function First() | ||||||
|   lightSystem("on", colors.white) |   lightSystem(colors.white) | ||||||
| end | end | ||||||
| function LightOff() | function SecondOn() | ||||||
|   lightSystem("off", colors.white) |   lightSystem(colors.orange) | ||||||
| end | end | ||||||
| function OrangeOn() | function Third() | ||||||
|   lightSystem("on", colors.orange) |   lightSystem(colors.magenta) | ||||||
| end | end | ||||||
| function OrangeOff() | function Fourth() | ||||||
|   lightSystem("off", colors.orange) |   lightSystem(colors.yellow) | ||||||
| end | end | ||||||
| function AlarmOn() | function Fifth() | ||||||
|   lightSystem("on", colors.red) |   lightSystem(colors.lime) | ||||||
| end | end | ||||||
| function AlarmOff() | function Sixth() | ||||||
|   lightSystem("off", colors.red) |   lightSystem(colors.pink) | ||||||
| end | end | ||||||
| function AllOn() | function Alarm() | ||||||
|   lightSystem("on", 65407) |   lightSystem(colors.red) | ||||||
| end | end | ||||||
| function AllOff() | function All() | ||||||
|   lightSystem("off", 65407) |   lightSystem(65407) | ||||||
| end | end | ||||||
| function LightsBack() | function LightsBack() | ||||||
|   inLightsMenu = false |   inLightsMenu = false | ||||||
| @ -98,15 +98,15 @@ mainMenu = { | |||||||
|   [8] = { text = "Exit",handler=Exit } |   [8] = { text = "Exit",handler=Exit } | ||||||
| } | } | ||||||
| lightsMenu={ | lightsMenu={ | ||||||
|   [1]= { text="Lights On", handler=LightOn }, |   [1] = { text = "First",handler=First }, | ||||||
|   [2]= { text="Lights Off", handler=LightOff }, |   [2] = { text = "Second",handler=SecondOn }, | ||||||
|   [3]= { text="Orange On", handler=OrangeOn }, |   [3] = { text = "Third",handler=Third }, | ||||||
|   [4]= { text="Orange Off", handler=OrangeOff }, |   [4] = { text = "Fourth",handler=Fourth }, | ||||||
|   [5]= { text="Alarm On", handler=AlarmOn }, |   [5] = { text = "Fifth",handler=Fifth }, | ||||||
|   [6]= { text="Alarm Off", handler=AlarmOff }, |   [6] = { text = "Sixth",handler=Sixth }, | ||||||
|   [7]= { text="All On", handler=AllOn }, |   [7] = { text = "Alarm",handler=Alarm }, | ||||||
|   [8]= { text="All Off", handler=AllOff }, |   [8] = { text = "All (Off)",handler=All }, | ||||||
|   [9]= { text="Back", handler=LightsBack } |   [9] = { text = "Back",handler=LightsBack } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| --[[Printing Methods]]-- | --[[Printing Methods]]-- | ||||||
| @ -144,20 +144,30 @@ function onItemSelected( menu ) | |||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --[[Light System]]-- | --[[Light System]]-- | ||||||
| function lightSystem( op, SetColors ) | function lightSystem(SetColors ) | ||||||
| --[[Color Conversion]]-- |   if SetColors == 65407 then | ||||||
|   ConvertColors = SetColors |     ActiveColor = 0 | ||||||
| --[[Color Change]]-- |     rs.setBundledOutput(CableSite,0) | ||||||
|   if op == "on" then |   elseif colors.test(ActiveColor, SetColors) then | ||||||
|     ActiveColor = colors.combine(ActiveColor, ConvertColors) |     ActiveColor = colors.subtract(ActiveColor, SetColors) | ||||||
|     rs.setBundledOutput(CableSite ,ActiveColor) |     rs.setBundledOutput(CableSite, ActiveColor) | ||||||
|   elseif op == "off" then |   else | ||||||
|     ActiveColor = colors.subtract(ActiveColor, ConvertColors) |     ActiveColor = colors.combine(ActiveColor, SetColors) | ||||||
|     rs.setBundledOutput(CableSite, ActiveColor) |     rs.setBundledOutput(CableSite, ActiveColor) | ||||||
|   else error("Light system error you tried to: Turn " .. op .. " Color: " .. SetColors .. " when the state of color in memory is: " .. ActiveColor) |  | ||||||
|   end |   end | ||||||
|   inLightsMenu = false |   SaveColors = ActiveColor | ||||||
|   selectedItem = 1 |   local file = io.open("lights", "w") | ||||||
|  |   file:write(SaveColors) | ||||||
|  |   file:close() | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | --[[Restore Light System]]-- | ||||||
|  | function RestoreLightSystem() | ||||||
|  |   local Restore = io.open("lights", "r") | ||||||
|  |   RestoredColors = tonumber(Restore:read()) | ||||||
|  |   rs.setBundledOutput(CableSite, RestoredColors) | ||||||
|  |   ActiveColor = rs.getBundledOutput(CableSite) | ||||||
|  |   Restore:close() | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --[[Main function]]-- | --[[Main function]]-- | ||||||
| @ -196,4 +206,5 @@ function login() | |||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | RestoreLightSystem() | ||||||
| login() | login() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user