A2020

Computer with the monitor to place orders

Jan 20th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.43 KB | None | 0 0
  1. --This goes on the Computer that will handle the orders
  2. --Always name/label computers before working with them example: label set Orders
  3. --To import into the computer use pastebin get xxxxxx startup
  4. --startup will be the name of the program and in this case startup will auto execute everytime the computer reboot or the server restarts
  5. --Wireless modem goes on top by default
  6. --Use a 4 wide 3 tall advanced monitor on bottom by default
  7. --Use advanced computer as well
  8.  
  9.  
  10. mon = peripheral.wrap("bottom") --change here if you want monitor in other location right, left, top, bottom
  11. modem = peripheral.wrap("top") --same here
  12. local orderChannel = 55 --random channel from 1 to 65000 don't touch unless conflicts with other computers on server
  13. modem.open(orderChannel)
  14.  
  15.  
  16. function burger()
  17.  
  18. modem.transmit(orderChannel, orderChannel, "Burger") --Keyword to get burgers
  19.   mon.setBackgroundColor(128)
  20.   mon.setCursorPos(4,10)
  21.   mon.write("--Processing--")
  22. sleep(0.75)
  23.  
  24. modem.transmit(orderChannel, orderChannel, "Clear") --Liberating the system
  25.   mon.setCursorPos(4,10)
  26.   mon.write("----Ready-----")
  27. end --burger function
  28.  
  29.  
  30. function fries()
  31.  
  32. modem.transmit(orderChannel, orderChannel, "Fries") --Keyword to get fries
  33.  
  34.   mon.setBackgroundColor(128)
  35.   mon.setCursorPos(4,10)
  36.   mon.write("--Processing--")
  37. sleep(0.75)
  38.  
  39. modem.transmit(orderChannel, orderChannel, "Clear") --Liberating the system
  40.   mon.setCursorPos(4,10)
  41.   mon.write("----Ready-----")
  42.  
  43. end --fries function
  44.  
  45. function soda()
  46.  
  47. modem.transmit(orderChannel, orderChannel, "Soda") --Keyword to get sodas
  48.   mon.setBackgroundColor(128)
  49.   mon.setCursorPos(4,10)
  50.   mon.write("--Processing--")
  51. sleep(0.75)
  52.  
  53. modem.transmit(orderChannel, orderChannel, "Clear") --Liberating the system
  54.   mon.setCursorPos(4,10)
  55.   mon.write("----Ready-----")
  56.  
  57. end --soda function
  58.  
  59.  
  60.  
  61. function welcome()
  62.  
  63. mon.setBackgroundColor(2048)
  64. mon.clear()
  65.  
  66. mon.setTextScale(2)
  67. mon.setCursorPos(5,1)
  68. mon.write("Welcome to")
  69.  
  70. mon.setCursorPos(5,2)
  71. mon.write("BamsBurgers")
  72.  
  73.  
  74. mon.setCursorPos(7,4)
  75. mon.write("Home of")
  76. mon.setCursorPos(4,5)
  77. mon.write("the BamBurger")
  78. mon.setCursorPos(5,6)
  79. mon.write("Can I take")
  80. mon.setCursorPos(5,7)
  81. mon.write("your order?")
  82.  
  83. mon.setCursorPos(5,9)
  84. mon.setBackgroundColor(32768)
  85. mon.write("Place order")
  86.  
  87.  
  88. while true do
  89.  
  90.  event, side, xPos, yPos = os.pullEvent("monitor_touch")
  91.  
  92.   if xPos <=15 and xPos >= 5 and yPos <=9 and yPos >=9 then
  93.   mon.setBackgroundColor(2048)
  94.   mon.clear()
  95.  
  96.   mon.setTextScale(2)
  97.  
  98.   mon.setCursorPos(6,1)
  99.   mon.write("Right click")
  100.   mon.setCursorPos(5,2)
  101.   mon.write("item to order")
  102.  
  103.   mon.setBackgroundColor(32768)
  104.   mon.setCursorPos(2,4)
  105.   mon.write("Burger")
  106.  
  107.   mon.setCursorPos(2,6)
  108.   mon.write("Fries")
  109.  
  110.   mon.setCursorPos(2,8)
  111.   mon.write("Soda")    
  112.  
  113.   mon.setCursorPos(20,1)
  114.   mon.write("X")
  115.  
  116.   while true do
  117.  
  118.  event, side, xPos, yPos = os.pullEvent("monitor_touch")
  119.  
  120.   if xPos <=7 and xPos >= 2 and yPos <=4 and yPos >=4 then
  121.   burger()
  122.   end --if burger
  123.  
  124.   if xPos <=6 and xPos >= 2 and yPos <=6 and yPos >=6 then
  125.   fries()
  126.   end --if fries
  127.  
  128.   if xPos <=5 and xPos >= 2 and yPos <=8 and yPos >=8 then
  129.   soda()
  130.   end --if soda
  131.  
  132.   if xPos <=20 and xPos >= 20 and yPos <=1 and yPos >=1 then
  133.   welcome()
  134.   end --if X  
  135.  
  136.   end --waiting selection
  137.  
  138.   end --place order clicked
  139.  
  140. end --waiting place order click
  141.  
  142. end --welcome function
  143.  
  144.  
  145.  
  146. welcome()
Advertisement
Add Comment
Please, Sign In to add comment