Advertisement
Guest User

5

a guest
Nov 30th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1.  
  2. tableId= {}
  3. tableName= {}
  4. tableFix= {}
  5. tableFix[0]= 0
  6. tableFix[1]= " "
  7. tableFix[2]= "  "
  8. tableFix[3]= "   "
  9. function getButtonInfo()
  10.   term.clear()
  11.   term.setCursorPos(1,1)
  12.   print("How Many Buttons?")
  13.   butNum = read()
  14.   term.clear()
  15.     for i=1, butNum do
  16.       term.setCursorPos(1,1)
  17.       print(string.format("Name of Button %d", i))
  18.       tableName[i] = read()
  19.       term.clear()
  20.       end
  21.     for i=1, butNum do
  22.       term.setCursorPos(1,1)
  23.       print(string.format("ID of computer %d", i))
  24.       tableId[i] = read()
  25.       term.clear()
  26.       end
  27.     end
  28. function FixNameNum()
  29.   for i=1, butNum do
  30.     NameFixNum = 6 - string.len(tableName[i])
  31.       if NameFixNum == 0 then
  32.         tableName[i] = (tableName[i].." Door")
  33.        else
  34.     tableName[i] = (tableName[i]..tableFix[NameFixNum].." Door")
  35.     print(myTable[i])
  36.     end
  37.     end
  38.     end
  39. function BasicDraw()
  40.   term.clear()
  41.   if tonumber(butNum) == 1 then
  42.     for i=1, butNum do
  43.       term.setCursorPos(1, i)
  44.       term.setBackgroundColor(colors.blue)
  45.       term.write(tableName[i])
  46.       term.setBackgroundColor(colors.black)
  47.       term.setCursorPos(12,i)
  48.       term.write(" Open ")
  49.       term.setCursorPos(18,i)
  50.       term.write("Close ")
  51.         end
  52.   elseif tonumber(butNum) == 2 then
  53.     for i=1, butNum do
  54.       term.setCursorPos(1, i)
  55.       term.setBackgroundColor(colors.blue)
  56.       term.write(tableName[i])
  57.       term.setBackgroundColor(colors.black)
  58.       term.setCursorPos(12,i)
  59.       term.write(" Open ")
  60.       term.setCursorPos(18,i)
  61.       term.write("Close ")
  62.         end
  63.   elseif tonumber(butNum) == 3 then
  64.     for i=1, butNum do
  65.       term.setCursorPos(1, i)
  66.       term.setBackgroundColor(colors.blue)
  67.       term.write(tableName[i])
  68.       term.setBackgroundColor(colors.black)
  69.       term.setCursorPos(12,i)
  70.       term.write(" Open ")
  71.       term.setCursorPos(18,i)
  72.       term.write("Close")
  73.       end
  74.     end
  75.   end
  76.    
  77.    
  78.          getButtonInfo()
  79.          FixNameNum()
  80.          BasicDraw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement