NNickey

Mineral

Nov 19th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. mineral = {
  2. ["Native Copper"]="Rusty looking",
  3. ["Graphite"]="Black/Dirt looking",
  4. ["Dolomite"]="White/crystal-like",
  5. ["Calcite"]="Clear/Crystal like",
  6. ["Pyrite"]="Gold looking",
  7. ["Chalcopyrite"]="Gold looking",
  8. ["Alabaster"]="No desc. Alabaster",
  9. ["Selenite"]="Crystal glass like",
  10. ["Satin spar"]="Pink shing",
  11. ["Barite"]="Shiny",
  12. ["Crystalline Quartz"]="Diamond look",
  13. ["Rose Quartz"]="Pinkish/Crystal look",
  14. ["Chert"]="Yellow/Tan color",
  15. ["Chalcedony"]="Crystal look",
  16. ["Orhtoclase Feldspar"]="Pinkish",
  17. ["Plagioclase Feldspar"]="Yellowish",
  18. ["Biotite Mica"]="Brown/Black flaky",
  19. ["Muscovite Mica"]="Shiny/Flaky",
  20. ["Talc"]="Grey", ["Kaolin"]="White/Chalky",
  21. ["Hornblende"]="No desc. Hornblende",
  22. ["Spodumene"]="White/grey",
  23. ["Tourmaline"]="Green/blue color",
  24. ["Magnetite"]="No desc. Magnetite",
  25. ["Hematite"]="Rusty",
  26. ["Limonite"]="Dark brown",
  27. ["Bauxite"]="Orange/brown color",
  28. ["Fluorite"]="Sea green",
  29. ["Halite"]="Crystal like plastic",
  30. ["Apatite"]="Food lol."
  31. }
  32.  
  33.  
  34.  
  35. local function getRandomIndex(t)
  36. local count = 0
  37.  
  38. for i,v in pairs(t) do
  39. count = count + 1
  40. end
  41.  
  42. local rand = math.random(1, count)
  43. local num = 1
  44.  
  45. for index, _ in pairs(t) do
  46. if rand == num then
  47. return index
  48. end
  49. num = num + 1
  50. end
  51. end
  52.  
  53. term.clear()
  54. term.setCursorPos(1,1)
  55. while true do
  56. sel = math.random(1,3)
  57. num = 0
  58. numq = getRandomIndex(mineral)
  59. numw = getRandomIndex(mineral)
  60. nume = getRandomIndex(mineral)
  61. print("The mineral description is!")
  62. print(mineral[numq].." ..")
  63. print("")
  64. print("The three ones are")
  65. if sel == 1 then
  66. print(numq)
  67. num = "1"
  68. print(numw)
  69. print(nume)
  70. elseif sel == 2 then
  71. print(numw)
  72. num = "2"
  73. print(numq)
  74. print(nume)
  75. else
  76. print(numw)
  77. num = "3"
  78. print(nume)
  79. print(numq)
  80. end
  81. resp = read()
  82. if resp == numq or resp == num then
  83. print("Correct!")
  84. print(numq .. " (".. num ..")")
  85. sleep(4)
  86. else
  87. print("Wrong.. The right one is..")
  88. print(numq .. " (".. num ..")")
  89. sleep(6)
  90. end
  91. term.clear()
  92. term.setCursorPos(1,1)
  93. end
Advertisement
Add Comment
Please, Sign In to add comment