Advertisement
Guest User

startup

a guest
Jun 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.12 KB | None | 0 0
  1. c = peripheral.wrap("bottom")
  2. f = "Friday"
  3. x = 0.1
  4. t = {}
  5. e = "Ekxx"
  6. u = "stone" -- back output
  7. r = "dirt" -- right output
  8. ff = "cobble" -- front output
  9. l = "wood" -- left output
  10.  
  11. s8  = "Sending 8 "
  12. s16 = "Sending 16 "
  13. s32 = "Sending 32 "
  14. s64 = "Sending 64 "
  15. se  = "That is not a valid number. You can select 8, 16, 32 or 64. Please try again."
  16.  
  17. function rsc(item,side)
  18.  
  19.  delay = item/20
  20.  sleep(x)
  21.  redstone.setOutput(side,true)
  22.  sleep(delay)
  23.  redstone.setOutput(side,false)
  24.  sleep(x)
  25.  t = {}
  26.  
  27. end
  28.  
  29. -- Code --
  30.  
  31. while true do
  32.  
  33.  event, name, msg = os.pullEvent("chat")
  34.  print(msg)
  35.  t[#t+1]= msg
  36.  
  37.  for key, value in ipairs(t) do
  38.   print(key..' '..value)
  39.  
  40.    -- Up --
  41.    
  42.    if name == e and t[#t] == u then
  43.     sleep(x)
  44.     c.say("How much "..u.." would you like?",-1,true,f)
  45.     sleep(x)
  46.     t[#t+1] = 1
  47.          
  48.    elseif name == e and t[#t-2] == u and t[#t] == "8" then
  49.     sleep(x)
  50.     c.say(s8..u,-1,true,f)
  51.     rsc(8,"back")
  52.    
  53.    elseif name == e and t[#t-2] == u and t[#t] == "16" then
  54.     sleep(x)
  55.     c.say(s16..u,-1,true,f)
  56.     rsc(16,"back")
  57.    
  58.    elseif name == e and t[#t-2] == u and t[#t] == "32" then
  59.     sleep(x)
  60.     c.say(s32..u,-1,true,f)
  61.     rsc(32,"back")
  62.    
  63.    elseif name == e and t[#t-2] == u and t[#t] == "64" then
  64.     sleep(x)
  65.     c.say(s64..u,-1,true,f)
  66.     rsc(64,"back")
  67.    
  68.    elseif
  69.     t[#t-2] == u and name == e then
  70.     sleep(x)
  71.     c.say(se,-1,true,f)
  72.     t = {}  
  73.     -- Right --
  74.    
  75.    elseif name == e and t[#t] == r then
  76.     sleep(x)
  77.     c.say("How much "..r.." would you like?",-1,true,f)
  78.     sleep(x)
  79.     t[#t+1] = 1
  80.    
  81.    elseif name == e and t[#t-2] == r and t[#t] == "8" then    
  82.     sleep(x)
  83.     c.say(s8..r,-1,true,f)
  84.     rsc(8,"right")
  85.    
  86.    elseif name == e and t[#t-2] == r and t[#t] == "16" then
  87.     sleep(x)
  88.     c.say(s16..r,-1,true,f)
  89.     rsc(16,"right")
  90.            
  91.    elseif name == e and t[#t-2] == r and t[#t] == "32" then
  92.     sleep(x)
  93.     c.say(s32..r,-1,true,f)
  94.     rsc(32,"right")
  95.    
  96.    elseif name == e and t[#t-2] == r and t[#t] == "64" then
  97.     sleep(x)
  98.     c.say(s64..r,-1,true,f)
  99.     rsc(64,"right")
  100.                                                  
  101.    elseif
  102.     t[#t-2] == r and name == e then
  103.     sleep(x)
  104.     c.say(se,-1,true,f)
  105.     t = {}
  106.    
  107.    -- Down --
  108.    
  109.    elseif name == e and t[#t] == ff then
  110.     sleep(x)
  111.     c.say("How much "..ff.." would you like?",-1,true,f)
  112.     sleep(x)
  113.     t[#t+1] = 1
  114.    
  115.    elseif name == e and t[#t-2] == ff and t[#t] == "8" then
  116.     sleep(x)
  117.     c.say(s8..ff,-1,true,f)
  118.     rsc(8,"front")        
  119.    
  120.    elseif name == e and t[#t-2] == ff and t[#t] == "16" then
  121.     sleep(x)
  122.     c.say(s16..ff,-1,true,f)
  123.     rsc(16,"front")
  124.    
  125.    elseif name == e and t[#t-2] == ff and t[#t] == "32" then
  126.     sleep(x)
  127.     c.say(s32..ff,-1,true,f)
  128.     rsc(32,"front")
  129.    
  130.    elseif name == e and t[#t-2] == ff and t[#t] == "64" then
  131.     sleep(x)
  132.     c.say(s64..ff,-1,true,f)
  133.     rsc(64,"front")
  134.    
  135.    elseif
  136.     t[#t-2] == ff and name == e then
  137.     sleep(x)
  138.     c.say(se,-1,true,f)
  139.     t = {}  
  140.    
  141.    -- Left --
  142.      
  143.    elseif name == e and t[#t] == l then
  144.     sleep(x)
  145.     c.say("How much "..l.." would you like?",-1,true,f)
  146.     sleep(x)
  147.     t[#t+1] = 1
  148.    
  149.    elseif name == e and t[#t-2] == l and t[#t] == "8" then                                                                                            
  150.     sleep(x)
  151.     c.say(s8..l,-1,true,f)
  152.     rsc(8,"left")
  153.    
  154.    elseif name == e and t[#t-2] == l and t[#t] == "16" then
  155.     sleep(x)
  156.     c.say(s16..l,-1,true,f)
  157.     rsc(16,"left")
  158.    
  159.    elseif name == e and t[#t-2] == l and t[#t] == "32" then
  160.     sleep(x)
  161.     c.say(s32..l,-1,true,f)
  162.     rsc(32,"left")
  163.    
  164.    elseif name == e and t[#t-2] == l and t[#t] == "64" then
  165.     sleep(x)
  166.     c.say(s64..l,-1,true,f)
  167.     rsc(64,"left")
  168.    
  169.    elseif
  170.     t[#t-2] == l and name == e then
  171.     sleep(x)
  172.     c.say(se,-1,true,f)
  173.     t = {}
  174.    
  175.    elseif name == e and t[#t] == "clear" then
  176.     sleep(x)
  177.     c.say("Clearing cache",-1,true,f)
  178.     sleep(x)
  179.     t = {}
  180.    
  181.       else
  182.      sleep(x)
  183.   end
  184.  end
  185. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement