Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI('itw-core/texthelp')
- os.loadAPI('itw-core/tracker')
- os.loadAPI('itw-core/content')
- local function updateText(station)
- if station.state == true then
- if station.data.videoLink then
- print('video link found')
- local loc = "x="..station.x..",y="..station.y..",z="..station.z
- commands.tellraw('@a[r=10,'..loc..']','["",{"text":"Press T and "},{"text":"click here","underlined":true,"color":"aqua","clickEvent":{"action":"open_url","value":"'..station.data.videoLink..'"}},{"text":" to watch a video"}]')
- end
- texthelp.printToScreen(station.monitor,station.data.onText,station.w-2,station.data.onKeys,2,2)
- else
- texthelp.printToScreen(station.monitor,station.data.offText,station.w-2,station.data.offKeys,2,2)
- end
- end
- function init()
- local station = {}
- station.monitor = peripheral.wrap('left') or peripheral.wrap('right')
- station.monitor.setTextScale(2)
- station.w,station.h = station.monitor.getSize()
- station.state = false
- station.data = {
- onText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla eros nisl, rhoncus sed ex vitae, fermentum finibus metus. Aliquam iaculis risus ut orci venenatis auctor. Pellentesque non odio in purus egestas mattis in at neque.",
- onKeys = {
- {word="nisl",color="red"},
- {word="finibus",color="blue"},
- {word="risus",color="green"}
- },
- offText = "DEFAULT PROVIDER /n /n This is a text provider. You can read the hidden text by standing on the diamond block.",
- offKeys = {
- {word='diamond',color='lightBlue'},
- {word='hidden',color='magenta'},
- {word='standing',color='green'}
- }
- }
- station.x,station.y,station.z = commands.getBlockPosition()
- stationFromContent = tracker.findClosestStation(station.x,station.y,station.z)
- if stationFromContent then station.data = stationFromContent.data end
- return station
- end
- local timer = 0
- function updateStation(station)
- updateText(station)
- while true do
- local signal = redstone.getInput("back")
- if not signal == station.state then
- station.state = signal
- updateText(station)
- end
- if station.state and timer>10 then
- timer = 0
- updateText(station)
- end
- timer = timer +1
- sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement