Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- local function printUsage()
- print ( "Usages:" )
- print ( "reactor <inputSide> <outputSide> <onTime> <offTime>")
- end
- if #tArgs == 4 then
- local sIn = tArgs[1]
- local sOut = tArgs[2]
- local nOnCycle = tonumber( tArgs[3] ) or 60
- local nOffCycle = tonumber( tArgs[4] ) or 20
- local bTick = true
- while redstone.getInput( sIn ) do
- if bTick then
- io.write ( "\nOn Cycle Start\n" )
- io.write ( nOnCycle )
- redstone.setOutput( sOut, true )
- for n = 0, nOnCycle , 1 do
- if n % 5 == 0 then
- io.write ( "\n" )
- io.write ( n )
- io.write ( "/" )
- io.write ( nOnCycle )
- end
- if redstone.getInput( sIn ) == false then break end
- sleep ( 1 )
- end
- bTick = false
- else
- io.write ( "\nOff Cycle Start" )
- redstone.setOutput ( sOut, false )
- for n = 0, nOffCycle, 1 do
- if n % 5 == 0 then
- io.write ( "\n" )
- io.write ( n )
- io.write ( "/" )
- io.write ( nOffCycle )
- end
- if redstone.getInput( sIn ) == false then break end
- sleep ( 1 )
- end
- bTick = true
- end
- end
- io.write ( "\nNo redstone input from " )
- io.write ( sIn )
- io.write ( " side." )
- else
- printUsage()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement