Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.01 KB | None | 0 0
  1. Sticks = 0
  2. Logs = 0
  3. Rope = 0
  4. Stonerocks = 0
  5. Ironrocks = 0
  6. Goldrocks = 0
  7. Forge = 0
  8. Stoneaxe = 0
  9. Ironaxe = 0
  10. Stonepickaxe = 0
  11. Ironpickaxe = 0
  12. Goldingot = 0
  13. Ironingot = 0
  14.  
  15. function menuSelect()
  16. print("Please make a selection.")
  17. sel = {}
  18. sel[1] = "[Gather (Wood)]"
  19. sel[2] = "[Gather (Ore)]"
  20. sel[3] = "[Go to (Forge)]"
  21. sel[4] = "[Inventory]"
  22. print(sel[1] , sel[2] , sel[3] , sel[4])
  23. local choice = io.read()
  24. if choice == "Wood" then
  25. gatherWood()
  26. elseif choice == "Ore" then
  27. gatherOre()
  28. elseif choice == "Forge" then
  29. atForge()
  30. elseif choice == "Inventory" then
  31. inVentory()
  32. else menuSelect()
  33. end
  34.  
  35. end
  36.  
  37. function inVentory()
  38. print("--------------------")
  39. print("Player Inventory")
  40. print("[Return] [Crafting]")
  41. print("Sticks: " .. Sticks)
  42. print("Logs: " .. Logs)
  43. print("Rope: " .. Rope)
  44. print("Stone Rocks: " .. Stonerocks)
  45. print("Iron Rocks: " .. Ironrocks)
  46. print("Gold Rocks: " .. Goldrocks)
  47. print("Stone Axe: " .. Stoneaxe)
  48. print("Iron Axe: " .. Ironaxe)
  49. print("Stone Pickaxe: " .. Stonepickaxe)
  50. print("Iron Pickaxe: " .. Ironpickaxe)
  51. print("Forge: " .. Forge)
  52. print("Iron Ingot: " .. Ironingot)
  53. print("Gold Ingot: " .. Goldingot)
  54. print("--------------------")
  55. local choice = io.read()
  56. if choice == "Return" then
  57. menuSelect()
  58. elseif choice == "Crafting" then
  59. cRaft()
  60. else inVentory()
  61. end
  62. end
  63.  
  64. function cRaft()
  65. print("Crafting Menu")
  66. print("[Stone Axe] [Iron Axe] [Iron Pickaxe] [Forge] [Return]")
  67. local choice = io.read()
  68.  
  69. if choice == "Stone Axe" and Sticks >= 1 and Rope >= 1 and Stonerocks >= 1 then
  70. print("Stone Axe Crafted!")
  71. Stoneaxe = Stoneaxe + 1
  72. Rope = Rope - 1
  73. Stonerocks = Stonerocks - 1
  74. Sticks = Sticks - 1
  75. cRaft()
  76. elseif choice == "Stone Axe" and Sticks < 1 or Rope < 1 or Stonerocks < 1 then
  77. print("Not enough materials!")
  78. cRaft()
  79.  
  80. elseif choice == "Iron Axe" and Sticks >= 1 and Rope >= 1 and Ironingot >= 1 then
  81. print("Iron Axe Crafted!")
  82. Ironaxe = Ironeaxe + 1
  83. Ironingot = Ironingot - 1
  84. Rope = Rope - 1
  85. Sticks = Sticks - 1
  86. cRaft()
  87. elseif choice == "Iron Axe" and Sticks < 1 or Rope < 1 or Ironingot < 1 then
  88. print("Not enough materials!")
  89. cRaft()
  90.  
  91. elseif choice == "Iron Pickaxe" and Sticks >= 1 and Ironingot >= 1 then
  92. print("Iron Pickaxe Crafted!")
  93. Ironpickaxe = Ironpickaxe + 1
  94. Ironingot = Ironingot - 1
  95. Sticks = Sticks - 1
  96. cRaft()
  97. elseif choice == "Iron Pickaxe" and Sticks < 1 or Ironingot < 1 then
  98. print("Not enough materials!")
  99. cRaft()
  100.  
  101. elseif choice == "Forge" and Stonerocks >= 5 then
  102. print("Forge Crafted")
  103. Forge = Forge + 1
  104. Stonerocks = Stonerocks - 5
  105. cRaft()
  106. elseif choice == "Forge" and Stonerocks < 5 then
  107. print("Not enough materials!")
  108. cRaft()
  109.  
  110.  
  111. elseif choice == "Return" then
  112. inVentory()
  113. else cRaft()
  114. end
  115. end
  116.  
  117. function gatherWood()
  118. print("Please make a selection.")
  119. print("[Gather (Sticks)] [Gather (Logs)] [Gather (Rope)] [Return]")
  120. local choice = io.read()
  121. if choice == "Sticks" then
  122. gatherSticks()
  123. elseif choice == "Logs" then
  124. gatherLogs()
  125. elseif choice == "Rope" then
  126. gatherRope()
  127. elseif choice == "Return" then
  128. menuSelect()
  129. else gatherWood()
  130. end
  131. end
  132.  
  133. function gatherSticks()
  134. print("You venture into the woods to collect some sticks...")
  135. math.randomseed(os.time())
  136. local chance = math.random(0 , 100)
  137. if chance >= 40 then
  138. print("You found 3 sticks!")
  139. Sticks = Sticks + 3
  140. menuSelect()
  141. elseif chance < 40 then
  142. print("You found 5 sticks!")
  143. Sticks = Sticks + 5
  144. menuSelect()
  145. end
  146. end
  147.  
  148. function gatherLogs()
  149. if Stoneaxe >= 1 then
  150. print("You venture into the woods to chop some trees...")
  151. print("You cut 6 logs!")
  152. Logs = Logs + 5
  153. menuSelect()
  154. end
  155. if Ironaxe >= 1 then
  156. print("You venture into the woods to chop some trees...")
  157. print("You cut 12 logs!")
  158. Logs = Logs + 5
  159. menuSelect()
  160. end
  161. if Stoneaxe < 1 or Ironaxe < 1 then
  162. print("You don't have an axe!")
  163. menuSelect()
  164. end
  165. end
  166.  
  167. function gatherRope()
  168. print("You venture into the woods to collect some rope...")
  169. math.randomseed(os.time())
  170. local chance = math.random(0 , 100)
  171. if chance >= 20 then
  172. print("You found 1 rope!")
  173. Rope = Rope + 1
  174. menuSelect()
  175. elseif chance < 20 then
  176. print("You found 3 rope!")
  177. Rope = Rope + 3
  178. menuSelect()
  179. end
  180. end
  181.  
  182. function gatherOre()
  183. print("Please make a selection.")
  184. print("[Gather (Stone Rocks)] [Gather (Iron Rocks)] [Gather (Gold Rocks)] [Return]")
  185. local choice = io.read()
  186. if choice == "Stone Rocks" then
  187. gatherStone()
  188. elseif choice == "Iron Rocks" then
  189. gatherIron()
  190. elseif choice == "Gold Rocks" then
  191. gatherGold()
  192. elseif choice == "Return" then
  193. menuSelect()
  194. else gatherOre()
  195. end
  196. end
  197.  
  198. function gatherStone()
  199. print("You venture into the woods to collect some stone...")
  200. math.randomseed(os.time())
  201. local chance = math.random(0 , 100)
  202. if chance >= 20 then
  203. print("You found 3 stone!")
  204. Stonerocks = Stonerocks + 3
  205. menuSelect()
  206. elseif chance < 20 then
  207. print("You found 5 stone!")
  208. Stonerocks = Stonerocks + 5
  209. menuSelect()
  210. end
  211. end
  212.  
  213. function gatherIron()
  214. print("You venture into the woods to collect some iron...")
  215. print("You found 3 iron ore!")
  216. Ironrocks = Ironrocks + 3
  217. menuSelect()
  218. end
  219.  
  220. function gatherGold()
  221. if Ironpickaxe >= 1 then
  222. print("You venture into the woods to collect some gold...")
  223. print("You found 2 gold ore!")
  224. Goldrocks = Goldrocks + 2
  225. menuSelect()
  226. elseif Ironpickaxe < 1 then
  227. print("You don't have a pickaxe!")
  228. menuSelect()
  229. end
  230. end
  231.  
  232. function atForge()
  233. if Forge >= 1 then
  234. print("Welcome to your forge!")
  235. forgeCraft()
  236. elseif Forge < 1 then
  237. print("You don't have a forge!")
  238. menuSelect()
  239. end
  240. end
  241.  
  242. function forgeCraft()
  243. print("[Iron Ingot] [Gold Ingot] [Return]")
  244. local choice = io.read()
  245. if choice == "Iron Ingot" and Ironrocks >= 3 then
  246. print("Smelted 1 iron ingot!")
  247. Ironingot = Ironingot + 1
  248. Ironrocks = Ironrocks - 3
  249. forgeCraft()
  250. elseif choice == "Iron Ingot" and Ironrocks < 3 then
  251. print("Not enough materials!")
  252. forgeCraft()
  253.  
  254. elseif choice == "Gold Ingot" and Goldrocks >= 5 then
  255. print("Smelted 1 gold ingot!")
  256. Goldingot = Goldingot + 1
  257. Goldrocks = Goldrocks - 5
  258. forgeCraft()
  259. elseif choice == "Gold Ingot" and Goldrocks < 5 then
  260. print("Not enough materials!")
  261. forgeCraft()
  262.  
  263. elseif choice == "Return" then
  264. menuSelect()
  265. else forgeCraft()
  266. end
  267. end
  268.  
  269. menuSelect()
  270.  
  271. io.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement