Magic 8 Ball Project (Lua) - Optional Challenge 2

So I’ve been scratching my head and trying out different things with no result in regards to the Lua Magic 8 Ball Project - Optional Challenge 2.

It asks me to add a remainder/modulo operator, so any “number” higher that the available outputs/fortunes, will always equate to a number no higher than the number of available outputs/fortunes.

It doesn’t throw any errors, but it also doesn’t output. E.g the number with the modulo operator should equal 3. Outputting the answer on line 15.

This is what I have so far… And any help would be much appreciated.

https://i.imgur.com/6okBJTl.png

name = "Steve"
question = "Will I complete this task?"
number = 33
answer = " "

if number >= 6 then
  number = number % 5
elseif number == 0 then
  answer = "I have absolutely no idea."
elseif number == 1 then
  answer = "If you put the effort in."
elseif number == 2 then
  answer = "I can't say for sure."
elseif number == 3 then
  answer = "Yes!"
elseif number == 4 then
  answer = "Maybe." 
elseif number == 5 then
  answer = "Without a doubt."
end  

  print(name .. " asks: " .. question)
  print("Eight Ball says:" .. " " .. answer)

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.