Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bedrockPath='/' if OneOS then OneOS.LoadAPI('/System/API/Bedrock.lua', false)elseif fs.exists(bedrockPath..'/Bedrock')then os.loadAPI(bedrockPath..'/Bedrock')else if http then print('Downloading Bedrock...')local h=http.get('http://pastebin.com/raw.php?i=0MgKNqpN')if h then local f=fs.open(bedrockPath..'/Bedrock','w')f.write(h.readAll())f.close()h.close()os.loadAPI(bedrockPath..'/Bedrock')else error('Failed to download Bedrock. Is your internet working?') end else error('This program needs to download Bedrock to work. Please enable HTTP.') end end if Bedrock then Bedrock.BasePath = bedrockPath Bedrock.ProgramPath = shell.getRunningProgram() end
- local monitor = peripheral.wrap('monitor_299')
- term.redirect(monitor)
- monitor.setTextScale(1)
- -- Variables
- local dragonRunning = false
- local dragonRunTimes = 1
- function init()
- program = Bedrock:Initialise()
- program:Run(function()
- program:LoadView("main")
- dragonDelay = program:GetObject('dragonDelay')
- dragonCount = program:GetObject('dragonCount')
- submitBtn = program:GetObject('Submit')
- program:GetObject('dragonDelay_add1m').OnClick = function(self, event, side, x, y)
- dragonDelay.Value = dragonDelay.Value + 60
- end
- program:GetObject('dragonDelay_add1h').OnClick = function(self, event, side, x, y)
- dragonDelay.Value = dragonDelay.Value + 3600
- end
- program:GetObject('dragonDelay_subtract1m').OnClick = function(self, event, side, x, y)
- dragonDelay.Value = dragonDelay.Value - 60
- end
- program:GetObject('dragonDelay_subtract1h').OnClick = function(self, event, side, x, y)
- dragonDelay.Value = dragonDelay.Value - 3600
- end
- submitBtn.OnClick = function(self, event, side, x, y)
- if ( not dragonRunning ) then
- program:DisplayAlertWindow('Are you sure?', 'This could cause lag...', {'Yes', 'No'}, function(value)
- if value == 'Yes' then
- setFarmingState(true)
- end
- end)
- else
- setFarmingState(false)
- end
- end
- end)
- end
- function setFarmingState(active)
- if ( not dragonRunning and active ) then
- dragonRunTimes = 1
- dragonRunning = true
- submitBtn.Text = 'STOP'
- submitBtn.BackgroundColour = 'red'
- dragonDelay.Enabled = false
- dragonCount.Enabled = false
- dragonTimer = program:StartRepeatingTimer(doFarm, dragonDelay.Value)
- elseif ( not active and dragonRunning and dragonTimer ) then
- program.Timers[dragonTimer] = nil
- submitBtn.Text = 'Start'
- submitBtn.BackgroundColour = 'green'
- dragonDelay.Enabled = true
- dragonCount.Enabled = true
- dragonRunTimes = 1
- dragonRunning = false
- end
- end
- function doFarm()
- if ( dragonRunning ) then
- rs.setOutput('back', true)
- sleep(0.5)
- rs.setOutput('back', false)
- if ( dragonCount.Value == 1 ) then
- setFarmingState(false)
- return false
- end
- dragonCount.Value = dragonCount.Value - 1
- dragonRunTimes = dragonRunTimes + 1
- end
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment