Advertisement
cing5000

Numberpad API

Apr 24th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.28 KB | None | 0 0
  1. if fs.exists("touchpoint") then
  2.     print("yes")
  3. else
  4.     print("Downloading touchpoint")
  5.     local h = http.get( "http://pastebin.com/raw.php?i=pFHeia96" ) --#get the raw paste
  6.     if h then
  7.     local f = fs.open( "touchpoint", "w" ) --#open the 'touchpoint' file in write mode
  8.     f.write( h.readAll() ) --#write the contents of the raw paste to the file
  9.     f.close() --#close the file handle
  10.     h.close() --#close the web handle
  11.     end
  12. end
  13.  
  14. os.loadAPI("touchpoint")
  15. t = touchpoint.new("right")
  16.  
  17. function numberPad(xMin,yMin,xMax,yMax,colorActive,colorInactive)
  18.     local column1 = {xMin,((xMax-xMin)/5)+xMin}
  19.     local column2 = {(((xMax-xMin)/5)*2)+xMin,(((xMax-xMin)/5)*3)+xMin}
  20.     local column3 = {(((xMax-xMin)/5)*4)+xMin,xMax}
  21.     local row1 = {yMin, ((yMax-yMin)/7)+yMin}
  22.     local row2 = {(((yMax-yMin)/7)*2)+yMin,(((yMax-yMin)/7)*3)+yMin}
  23.     local row3 = {(((yMax-yMin)/7)*4)+yMin,(((yMax-yMin)/7)*5)+yMin}
  24.     local row4 = {(((yMax-yMin)/7)*6)+yMin,yMax}   
  25.  
  26. -- --[[
  27.     print(column1[1].." - "..column1[2])
  28.     print(column2[1].." - "..column2[2])
  29.     print(column3[1].." - "..column3[2])   
  30.     print(row1[1].." - "..row1[2])
  31.     print(row2[1].." - "..row2[2])
  32.     print(row3[1].." - "..row3[2])
  33.     print(row4[1].." - "..row4[2])
  34. -- ]]--
  35.    
  36.     if colorActive == rainbow then
  37.         print("RAINBOW!!!")
  38.         colors = {
  39.             colors.red,
  40.             colors.orange,
  41.             colors.green,
  42.             colors.blue,
  43.             colors.purple,
  44.         }  
  45.     else
  46.         colors = {
  47.             colorActive,
  48.             colorActive,
  49.             colorActive,
  50.             colorActive,
  51.             colorActive,
  52.         }
  53.     end
  54.    
  55.     t:add("7", Seven,column1[1],row1[1],column1[2],row1[2],colors[1],colorInactive)
  56.     t:add("8", Eight,column2[1],row1[1],column2[2],row1[2],colors[2],colorInactive)
  57.     t:add("9", Nine,column3[1],row1[1],column3[2],row1[2],colors[3],colorInactive) 
  58.     t:add("4", Four,column1[1],row2[1],column1[2],row2[2],colors[2],colorInactive)
  59.     t:add("5", Five,column2[1],row2[1],column2[2],row2[2],colors[3],colorInactive)
  60.     t:add("6", Six,column3[1],row2[1],column3[2],row2[2],colors[4],colorInactive)  
  61.     t:add("1", One,column1[1],row3[1],column1[2],row3[2],colors[3],colorInactive)
  62.     t:add("2", Two,column2[1],row3[1],column2[2],row3[2],colors[4],colorInactive)
  63.     t:add("3", Three,column3[1],row3[1],column3[2],row3[2],colors[5],colorInactive)
  64.     t:add("0", Zero,column2[1],row4[1],column2[2],row4[2],colors[5],colorInactive)
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement