Guest User

Untitled

a guest
Jun 10th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. local function drawVertLine(x, sy, ey)
  2.   local incr = (sy > ey and -1 or 1) -- direction to loop
  3.   for i = sy, ey, incr do
  4.     term.setTextColor(cl3)
  5.     term.setCursorPos(x, i)
  6.     write('I')
  7.     sleep(spd/2)
  8.     term.setTextColor(cl2)
  9.     term.setCursorPos(x, i)
  10.     write('|')
  11.     sleep(spd/2)
  12.   end
  13. end
  14.  
  15. local function drawHorizLine(sx, ex, y)
  16.   local incr = (sx > ex and -1 or 1)
  17.   for i = sx, ex, incr do
  18.     term.setTextColor(cl3)
  19.     term.setCursorPos(i, y)
  20.     write('=')
  21.     sleep(spd/2)
  22.     term.setTextColor(cl2)
  23.     term.setCursorPos(i, y)
  24.     write('-')
  25.     sleep(spd/2)
  26.   end
  27. end
  28.  
  29. local function centerText(msg, y)
  30.   term.setCursorPos( math.floor((totalx - #msg)/2) + (#msg % 2 == 0 and 1 or 0) , y)
  31.   write(msg)
  32. end
  33.  
  34. local function advert() -- you don't need the params, you have them defined up the top of the script, just use those
  35.   while true do -- since you have parallel.waitForAny, just put a loop, it will stop this when the other function stops
  36.     -- clear the screen
  37.     term.setBackgroundColor(cl4)
  38.     term.clear()
  39.     -- draw the lines
  40.     term.setBackgroundColor(cl1)
  41.     drawHorizLine(2, totalx - 1, 1)
  42.     drawVertLine(totalx, 1, totaly)
  43.     drawHorizLine(totalx - 1, 2, totaly)
  44.     drawVertLine(1, totaly, 1)
  45.     -- draw the text
  46.     term.setBackgroundColor( colors.orange )
  47.     centerText("Casino", totaly / 2)
  48.     sleep(1)
  49.     -- draw the center line
  50.     drawHorizLine(2, totalx - 1, totaly / 2 + 1)
  51.     -- draw the rest of the text
  52.     centerText("Slots", totaly / 2 + 2)
  53.     sleep(2)
  54.   end
  55.   term.clear()
  56.   term.restore()
  57. end
  58.  
  59. term.redirect( mon ) -- redirect to the monitor so we can just use term calls
  60. parallel.waitForAny(advert, function() coined(pside) end)
  61. term.restore() -- restore the terminal from the monitor to the computer
Advertisement
Add Comment
Please, Sign In to add comment