Advertisement
ecco7777

CC Chat Quiz

Mar 20th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. c=peripheral.wrap("right")
  2.  
  3. function fileToTable(file)
  4. if fs.exists(file)~=true then
  5. c.say("file"..file.." not found")
  6. return(false)
  7. end
  8. fp=fs.open(file,"r")
  9. line={}
  10. i=1
  11. line[i]=fp.readLine()
  12. if line[i]==nil then return(false) end
  13. while line[i]~=nil do
  14. i=i+1
  15. line[i]=fp.readLine()
  16. end
  17. output={line,i}
  18. return(output)
  19. end
  20.  
  21. qu=fileToTable("qu")[1]
  22. quLen=fileToTable("qu")[2]
  23. i=1
  24. while qu[i]~=nil do
  25. c.say(qu[i].."?") sleep(0.5)
  26. c.say("a)"..qu[i+1]) sleep(0.5)
  27. c.say("b)"..qu[i+2]) sleep(0.5)
  28. c.say("c)"..qu[i+3]) sleep(0.5)
  29. c.say("d)"..qu[i+4])
  30. e,player,message = os.pullEvent("chat")
  31. while message~=qu[i+5] do
  32. e,player,message = os.pullEvent("chat")
  33. end
  34. c.say(player.." du hast recht!")
  35. sleep(1)
  36. i=i+6
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement