Discord
Login
Community
DARK THEME

I need help with system.prompt

I'm making a horror game, but I can't get the code to work. Can you help?

Here's the code:

      if mouse.release then
        randomriddle = random.nextInt(5)
        if randomriddle == 1 then
          answer = system.prompt("What loses its head every morning, but gets it back every night?", text)
          if answer == "a pillow" then
                            food = 32
            water = 32
          else
                              system.say("WRONG. Hint: no caps or periods")
              difficulty += 0.5
            end
        end
        if randomriddle == 2 then
          answer = system.prompt("If violence isn't the answer, why does nature follow the rule: Survival of The Fittest?", text)
          if answer == "violence is the answer" then
                            food = 32
            water = 32
            else
              system.say("WRONG. Hint: no caps or periods")
              difficulty += 0.5
              end
        end
        if randomriddle == 3 then
          answer = system.prompt("What fears the dark?", text)
          if answer == "dweller" or answer == "me" then
            food = 32
            water = 32
            else
              system.say("WRONG. Hint: no caps or periods")
              difficulty += 0.5
          end
        end
        if randomriddle == 4 then
          answer = system.prompt("What fears the light?")
                        if answer == "dweller" or answer == "death" then
            
            else
              system.say("WRONG. Hint: no caps or periods")
              difficulty += 0.5
          end
          end
        end

Here's the project link:

https://microstudio.io/codecat1/sweetnightmares4/

Is anyone able to help?

to my understanding, you need something like this;

system.prompt("Name:", callback) callback = function(ok, text) if ok then player.name = text end end

Thanks

I have a question what code did you put in the game its fascinating I have never seen a game kick you out of the tab

system.exit()

Is anyone able to help? I'm not sure if I'm able to figure out how to do the riddle thing. I'll invite you to the project if you want me to.

Also, I should tell you that the game heavily relies on sound, so I would play it with volume on.

Yeah sure I could try to help

I invited you

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community