View difference between Paste ID: nsSrfYeK and NFdi5vqM
SHOW: | | - or go back to the newest paste.
1-
-- @param attacks between inventory dump
1+
-- @param pulse length in ticks
2-
local t = 256
2+
local pulseLength = 5
3
4-
-- @param level to do enchantments
4+
-- @param clock speed in ticks
5-
local enchantLevel = 30
5+
local clockSpeed = 20
6
7-
-- @param monitor direction (can be nil if no monitor)
7+
-- @param pulse direction
8-
local monitorSide = "left"
8+
local pulseSide = "down"
9
local inputSide = "front"
10-
-- @param experience per kill (use 0 if you don't know)
10+
11-
local XPperKill = 5
11+
-- @param redstone signal to disable clock
12
-- true = redstone turns on
13-
-- wrap all peripherals
13+
-- false = redstone turns off
14-
local xp = peripheral.wrap("right")
14+
-- nil = ignore redstone
15-
local mtr = term
15+
local redstone = nil
16
17-
-- if the monitor side was set, wrap it
17+
18-
if monitorSide ~= nil then
18+
	-- use redstone signal to determine if the clock is on or off
19-
  mtr = peripheral.wrap(monitorSide) 
19+
    while redstone == nil or redstone == rs.getInput(inputSide) do
20-
end
20+
        rs.setOutput(pulseSide, true)
21
        sleep(pulseLength / 20)
22-
local color = mtr.isColor()
22+
23
        rs.setOutput(pulseSide, false)
24-
local name = "Tim the Enchanter v1.0"
24+
        sleep((clockSpeed - pulseLength) / 20)
25-
local enchants = 0
25+
    end
26-
local totalXP = xp.get()
26+
27
	-- if we dropped out of the clock loop, wait for redstone
28-
xp.setAutoCollect(false)
28+
    event = os.pullEvent("redstone")
29-
mtr.setCursorBlink(false)
29+