Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("bottom")
- mon.setTextScale(0.5)
- os.loadAPI("data") -- Yes. I wrote my own API :D
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mX, mY = mon.getSize()
- frameName = "frame"
- frameCount = 1
- delay = 0.25
- wipeBeforeWrite = false
- wipeColor = colors.black
- itemText = {
- "Chrome"
- }
- function getPictureWidth(picDef)
- pictureBuff = data.linesTable(picDef)
- oldC = 1
- for i=1,#pictureBuff do
- oldC = math.max(oldC, string.len(pictureBuff[i]))
- end
- return oldC
- end
- function loadFrames()
- frames = {}
- for i=1,frameCount do
- table.insert(frames, paintutils.loadImage(frameName..tostring(i)))
- end
- end
- function drawFrame(frameNumberC,textNR, xPosP, yPosP)
- terminal = term.current()
- term.redirect(mon)
- textStartPos = (getPictureWidth(frameName..tostring(textNR))/2) - (string.len(itemText[textNR])/2)
- term.setCursorPos(textStartPos+xPosP,1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.write(itemText[textNR])
- paintutils.drawImage(frameNumberC,xPosP,yPosP)
- term.redirect(terminal)
- end
- function main()
- for i=1,frameCount do
- if fs.exists("CloseShop") == false then
- if wipeBeforeWrite == true then
- mon.setBackgroundColor(wipeColor)
- mon.clear()
- end
- drawFrame(frames[i],i, mX/2 ,3)
- sleep(delay)
- else
- fs.delete("CloseShop")
- shell.switchTab(2)
- os.queueEvent("terminate")
- end
- end
- end
- loadFrames()
- while true do
- main()
- sleep(delay)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement