Guest User

FeildGUI

a guest
May 26th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. --farm buttons
  2. --edit 2, added more notes on what the scripts doing and cleaned up a bit.
  3.  
  4. os.loadAPI("APIbutton") -- The name of the API
  5. m = peripheral.wrap("monitor_0") --Set where the monitor is on the network or state the side(top, left , right etc)
  6. m.clear()
  7.  
  8. function fillTable() --name, function, active, position(left to right then top to bottom)
  9.        APIbutton.setTable("Test1", test1, false, 10,20,3,5)
  10.        APIbutton.setTable("Test2", test2, false, 22,32,3,5)
  11.        APIbutton.setTable("Test3", test3, false, 10,20,8,10)
  12.        APIbutton.setTable("Test4", test4, false, 22,32,8,10)
  13.        APIbutton.screen()
  14.         end
  15.  
  16.         function getClick()
  17.                 event,side,x,y = os.pullEvent("monitor_touch") --this line seems to have caused the problems on the copys out there.
  18.                 APIbutton.checkxy(x,y)
  19.         end
  20.  
  21. -- functions for all buttons to go here.
  22.  
  23. function test1()  -- a flash is a only on why pressing (think push button)
  24.         APIbutton.flash("Test1")
  25.         print("Test1 was a flash button")
  26. end
  27.  
  28. function test2()  --toggle is a on and off button (think lever)
  29.         APIbutton.toggleButton("Test2")
  30.         print("Test2 was a toggle button")
  31. end
  32.  
  33. function test3()
  34.         print("Test3")
  35. end
  36.  
  37. function test4()
  38.         print("Test4")
  39. end
  40.  
  41. --End of button function area.
  42.  
  43. fillTable()
  44. APIbutton.heading("Crop Control GUI") --heading at top of the page
  45. APIbutton.label(1,5,"Demo")    --label at the left side of page.
  46.  
  47. while true do
  48.         getClick()
  49. end
Advertisement
Add Comment
Please, Sign In to add comment