Advertisement
Guest User

startup

a guest
Apr 20th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. c = peripheral.wrap("bottom")
  2. f = "Friday"
  3. x = 0.1
  4. t = {}
  5. e = "Ekxx"
  6.  
  7. while true do
  8.  
  9.  event, name, msg = os.pullEvent("chat")
  10.  print(msg)
  11.  t[#t+1]= msg
  12.  
  13.  for key, value in ipairs(t) do
  14.   print(key..' '..value)
  15.    
  16.    if name == e and t[#t] == "cobble" then
  17.     sleep(x)
  18.     c.say("How much cobble would you like?",-1,true,f)
  19.     sleep(x)
  20.     t[#t+1] = 1
  21.    
  22.    elseif name == e and t[#t-2] == "cobble" and t[#t] == "8" then
  23.     sleep(x)
  24.     c.say("Sending 8 cobble",-1,true,f)
  25.     sleep(x)
  26.     redstone.setOutput("back",true)
  27.     sleep(0.4)
  28.     redstone.setOutput("back",false)
  29.     sleep(x)
  30.     t = {}
  31.    
  32.    elseif name == e and t[#t-2] == "cobble" and t[#t] == "16" then
  33.     sleep(x)
  34.     c.say("Sending 16 cobble",-1,true,f)
  35.     redstone.setOutput("back",true)
  36.     sleep(0.8)
  37.     redstone.setOutput("back",false)
  38.     t = {}
  39.    
  40.    elseif name == e and t[#t-2] == "cobble" and t[#t] == "32" then
  41.     sleep(x)
  42.     c.say("Sending 32 cobble",-1,true,f)
  43.     redstone.setOutput("back",true)
  44.     sleep(1.6)
  45.     redstone.setOutput("back",false)
  46.     t = {}
  47.    
  48.    elseif name == e and t[#t-2] == "cobble" and t[#t] == "64" then
  49.     sleep(x)
  50.     c.say("Sending 64 cobble",-1,true,f)
  51.     redstone.setOutput("back",true)
  52.     sleep(3.2)
  53.     redstone.setOutput("back",false)
  54.     t = {}
  55.    
  56.        
  57.    elseif
  58.     t[#t-2] == "cobble" and name == e then
  59.     sleep(x)
  60.     c.say("That is not a valid number. You can select 8, 16, 32 or 64. Please try again.",-1,true,f)
  61.    
  62.     t = {}
  63.    
  64.     else
  65.      sleep(x)
  66.   end
  67.  end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement