irnotbeowulf

mainvend.lua

May 10th, 2021 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local vend = require("vendapi")
  2.  
  3. vend.clearScreen()
  4. vend.centerWrite(vend.getRealTime())
  5. vend.newLine()
  6. --[[
  7. p = vend.getPlayers()
  8. for i=1, #p do
  9.     print(p[i])
  10. end
  11. --]]
  12.  
  13. --Pull command from chat and verify identity
  14. local function getChatCommand()
  15.         local event, param1, param2 = os.pullEvent("chat")
  16.                 if(param2 == "porkchop") and (param1 == "irnotbeowulf") then
  17.                     vend.centerWrite("The other white meat")
  18.                     vend.dispense(vend.getBarrel(3))
  19.                 elseif(param2 == "close") then
  20.                     vend.centerWrite("closed")
  21.                 else
  22.                     vend.centerWrite("enter open or closed")
  23.                 end
  24.  
  25. end
  26. local function timer1()
  27.     sleep(4)
  28.     print("timer1 done")
  29. end
  30. while true do
  31.     parallel.waitForAny(getChatCommand, timer1)
  32. end
Add Comment
Please, Sign In to add comment