Dodedodo33

Basecontrol v1.0

May 24th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("button")
  2. m=peripheral.wrap("left")
  3. rednet.open("back")
  4. m.clear()
  5.  
  6. function drawHeading()
  7.    button.heading("--------- BaseControl v1.0 ---------")
  8. end
  9.  
  10. function drawButtons()
  11.    button.setTable("Sheep on",sheepon,3,13,3,5)
  12.    button.setTable("Sheep off",sheepoff,16,26,3,5)
  13.    button.setTable("Sugar on",sugaron,3,13,8,10)
  14.    button.setTable("Sugar off",sugaroff,16,26,8,10)
  15.    button.setTable("DigRig on",digon,30,40,3,5)
  16.    button.setTable("DigRig off",digoff,43,53,3,5)
  17.    button.setTable("XP on",xpon,30,40,8,10)
  18.    button.setTable("XP off",xpoff,43,53,8,10)
  19.    button.setTable("Meat on",meaton,57,67,3,5)
  20.    button.setTable("Meat off",meatoff,70,80,3,5)
  21.    button.screen()
  22. end
  23.  
  24. function drawText()
  25.    --button.label(x,y,"Sheep farm:")
  26.    --button.label(x,y,"Sugar Cane farm:")
  27.    --button.label(x,y,"Digging Rig:")
  28.    --button.label(x,y,"XP Farm:")
  29.    --button.label(x,y,"Meat Farm:")
  30.    button.label(69,12,"by: dodedodo33")
  31. end
  32.  
  33. function sheepon()
  34.    button.flash("Sheep on")
  35.    shell.run("redset","right","yellow","true")
  36. end
  37.  
  38. function sheepoff()
  39.    button.flash("Sheep off")
  40.    shell.run("redset","right","yellow","false")
  41. end
  42.  
  43. function sugaron()
  44.    button.flash("Sugar on")
  45.    shell.run("redset","right","red","true")
  46. end
  47.  
  48. function sugaroff()
  49.    button.flash("Sugar off")
  50.    shell.run("redset","right","red","false")
  51. end
  52.  
  53. function digon()
  54.    button.flash("DigRig on")
  55.    shell.run("redset","right","green","true")
  56. end
  57.  
  58. function digoff()
  59.    button.flash("DigRig off")
  60.    shell.run("redset","right","green","false")
  61. end
  62.  
  63. function xpon()
  64.    button.flash("XP on")
  65.    shell.run("redset","right","blue","false")
  66. end
  67.  
  68. function xpoff()
  69.    button.flash("XP off")
  70.    shell.run("redset","right","blue","true")
  71. end
  72.  
  73. function meaton()
  74.    if meatactive == "inactive" then
  75.       button.toggleButton("Meat on")
  76.       shell.run("sendmsg","89","place")
  77.       id,msg,dist = rednet.receive()
  78.       meatactive = "active"
  79.       button.toggleButton("Meat on")
  80.    end
  81. end
  82.  
  83. function meatoff()
  84.    if meatactive == "active" then
  85.      button.toggleButton("Meat off")
  86.      shell.run("sendmsg","89","remove")
  87.      id,msg,dist = rednet.receive()
  88.      button.toggleButton("Meat off")
  89.      meatactive = "inactive"
  90.    end
  91. end
  92.  
  93. function getClick()
  94.    event,side,x,y = os.pullEvent("monitor_touch")
  95.    button.checkxy(x,y)
  96. end
  97.  
  98. drawHeading()
  99. drawText()
  100. drawButtons()
  101. while true do
  102.    getClick()
  103. end
Advertisement
Add Comment
Please, Sign In to add comment