Advertisement
Muzze77

RandomGame

Jan 19th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.98 KB | None | 0 0
  1. ----------------------------------
  2. --- (c)Muzze77 Gewinnspiel 1.0 ---
  3. ----------------------------------
  4.  
  5. --±++++++++ variables ++++++++++--
  6.  
  7. maxzahl = 3 -- Maximale Gewinnchane in Zahlen ( math.random(3) zb ist 1,2,3 math.random(5) 1,2,3,4,5)
  8. minzahl = 1 -- Bleibt einfach Stehen !
  9. ID = math.random(minzahl, maxzahl)
  10. Item1 = "Rubin" -- ItemName für Item 1
  11. Item2 = "Saphir" -- ItemName für Item 2
  12. Item3 = "Smaragt" -- ItemName für Item 3
  13. -- Mit maxItems kann die MaximalMenge auch erhöht werden (
  14. --±+++++++++++++++++++++++++++++--
  15. ----------------------------------
  16. --±++++++++ functions ++++++++++--
  17. local function randomGame()
  18.     ID2 = tonumber(io.read()) -- Liest Deine Eingabe
  19.     print(ID .. " = " .. ID2) -- Print ob ID Gleich ist mit ID2
  20.     if ID == ID2 then   -- Wenn es das ist
  21.         if ID == 1 then -- ItemName for Item 1      -- Wenn ID gleich 1 war
  22.         rs.setBundledOutput("top", colors.red)
  23.         print("Gewonnen ! , Item : ".. Item1)
  24.         sleep(4)
  25.         rs.setBundledOutput("top", 0)
  26.         sleep(20)
  27.         shell.run("redpulse left 1 1")
  28.         elseif ID == 2 then             -- Wenn ID gleich 2 war
  29.         print("Gewonnen ! , Item : ".. Item2)
  30.         rs.setBundledOutput("top", colors.blue)
  31.         sleep(4)
  32.         rs.setBundledOutput("top", 0)  
  33.         sleep(20)
  34.         shell.run("redpulse left 1 1")
  35.         elseif ID == 3 then             -- Wenn ID gleich 3 war
  36.         print("Gewonnen ! , Item : ".. Item3)
  37.         rs.setBundledOutput("top", colors.green)
  38.         sleep(4)
  39.         rs.setBundledOutput("top", 0)
  40.         sleep(20)
  41.         shell.run("redpulse left 1 1")
  42.         end
  43.     else
  44.         print("Du hast Verloren!")
  45.     end
  46. end
  47. --±+++++++++++++++++++++++++++++--
  48. ----------------------------------
  49. --±++++++++ programms ++++++++++--
  50. print("----------------------------------\n--- (c)Muzze77 Gewinnspiel 1.0 ---\n----------------------------------")
  51. print("Gebe eine Zahl zwischen " .. minzahl .. " & " .. maxzahl .. " ein: ")
  52. randomGame()
  53.  
  54.  
  55. --±+++++++++++++++++++++++++++++--
  56. ----------------------------------
  57. --±+++++ end / comentary +++++++--
  58.  
  59. --±+++++++++++++++++++++++++++++--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement