Advertisement
LBPHacker

Solution of "ask" for Chre903

Jun 5th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. function clear()
  2.     term.setCursorPos(1,1)
  3.     term.clear()
  4. end
  5.  
  6. function getAction()
  7.     write("Please enter: ")
  8.     ask = read()
  9. end
  10.  
  11. function done()
  12.     local ask = 0
  13. end
  14.  
  15. function key()
  16.     bRead = true
  17.     while(bRead) do
  18.         local sEvent, param = os.pullEvent("key")
  19.         if(sEvent == "key") then
  20.             clear()
  21.             done()
  22.             getAction()
  23.             break
  24.         end
  25.     end
  26. end
  27.  
  28. clear()
  29. done()
  30.  
  31. print("To Ask Villiger #4 a Question, type in the Number of the Question.")
  32. print(" ")
  33. print("1 Where are we now?")
  34. print("2 What i am supposed to do?")
  35. print("3 How am i supposed to do something?")
  36. print("4 Can't i go back?")
  37. print("5 What do you mean with Bonus?")
  38. print(" ")
  39.  
  40. getAction()
  41.  
  42. while true do
  43.     if ask == "1" then
  44.         print("1111.")
  45.         print("1111")
  46.         key()
  47.     elseif ask == "2" then
  48.         print("2222")
  49.         print("2222")
  50.         print("2222")
  51.         key()
  52.     elseif ask == "3" then
  53.         print("3333")
  54.         print("3333")
  55.         key()
  56.     elseif ask == "4" then
  57.         print("4444")
  58.         key()
  59.     elseif ask == "5" then
  60.         print("5555")
  61.         print("5555")
  62.         key()
  63.     else
  64.         print("What did you say?")
  65.         key()
  66.     end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement