Advertisement
Guest User

serveur cafe

a guest
Jul 24th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.16 KB | None | 0 0
  1. function closecafe()
  2.     m.clear()
  3.     m.setTextColor(1)
  4.     m.setTextScale(5)
  5.     m.setCursorPos(5,4)
  6.     m.write("Le cafe")
  7.     m.setCursorPos(4,5)
  8.     m.write("est fermer")
  9. end
  10.  
  11. function carte()
  12.     m.clear()
  13.     m.setTextColor(1)
  14.     m.setTextScale(2)
  15.     m.setCursorPos(1,1)
  16.     m.write("La carte")
  17.     m.setCursorPos(1,6)
  18.     m.write("Smoothie :")
  19.     for i=1,10 do
  20.         if i==1 or i==2 then
  21.             a=i+2
  22.         else
  23.             a=i+5
  24.         end
  25.         if p[i] == "Empty" then
  26.             m.setCursorPos(4,a)
  27.             m.write("..............................Empty")
  28.         else
  29.             m.setCursorPos(4,a)
  30.             m.write("................................."..p[i].."$")
  31.         end
  32.         m.setCursorPos(4,a)
  33.         if i==1 then
  34.             m.write("Espresso")
  35.         end
  36.         if i==2 then
  37.             m.write("Carrot Juice")
  38.         end
  39.         if i==3 then
  40.             m.write("Banana")
  41.         end
  42.         if i==4 then
  43.             m.write("Lime")
  44.         end
  45.         if i==5 then
  46.             m.write("Pomegranate")
  47.         end
  48.         if i==6 then
  49.             m.write("Peach")
  50.         end
  51.         if i==7 then
  52.             m.write("Mango")
  53.         end
  54.         if i==8 then
  55.             m.write("Blackberry")
  56.         end
  57.         if i==9 then
  58.             m.write("Melon")
  59.         end
  60.         if i==10 then
  61.             m.write("Lemon")
  62.         end
  63.     end
  64. end
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. p={1,"?",5,5,5,5,5,5,5,"Empty"}
  72. rednet.open("top")
  73. m = peripheral.wrap("left")
  74. term.redirect(m)
  75. term.clear()
  76. closecafe()
  77. while true do
  78.     id,message = rednet.receive()
  79.     if id == 11 or id == 14 then
  80.         if message=="closecafe" then
  81.             closecafe()
  82.         end
  83.         if message=="reset screen" then
  84.             term.clear()
  85.         end
  86.         if message=="affiche carte" then
  87.             carte()
  88.         end
  89.         if message=="modif prix" then
  90.             id,message = rednet.receive()
  91.             for i=1,10 do
  92.                 if i==1 then
  93.                     boisson="Espresso"
  94.                 end
  95.                 if i==2 then
  96.                     boisson="Carrot Juice"
  97.                 end
  98.                 if i==3 then
  99.                     boisson="Banana"
  100.                 end
  101.                 if i==4 then
  102.                     boisson="Lime"
  103.                 end
  104.                 if i==5 then
  105.                     boisson="Pomegranate"
  106.                 end
  107.                 if i==6 then
  108.                     boisson="Peach"
  109.                 end
  110.                 if i==7 then
  111.                     boisson="Mango"
  112.                 end
  113.                 if i==8 then
  114.                     boisson="Blackberry"
  115.                 end
  116.                 if i==9 then
  117.                     boisson="Melon"
  118.                 end
  119.                 if i==10 then
  120.                     boisson="Lemon"
  121.                 end
  122.                 if message == boisson then
  123.                     id,message = rednet.receive()
  124.                     p[i] = message
  125.                 end
  126.             end
  127.         end
  128.     end
  129. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement