Questions

Could someone explain to a non coder working on line how to get an npc to ask a question to which the player must reply a place name. I can only see yes no options.
Thank you.


There are three ways to ask the player a question: Ask (yes/no), ShowMenu (gives a menu), and GetInput (expects the player to type a line of text, which you can then handle in whatever way you want).

I'm not sure what the GUI editor calls these options; but in the code editor it would look something like:

msg ("Where do you come from?")
get input {
  if (result = "Blackpwl") {
    msg ("Oh, me too!")
  }
  else {
    msg ("I never heard of that place")
  }
}

Thank you mrangel. I already used the method you showed , but not understanding coding I just used the quest buttons.But when i attempted to play it, I got an error message . Unidentified character in result ( line one column 10) which was put in using the oppropriate boxes and buttons. if result = “ Murphy
“ print correct , open exit or incorrect do nothing.( the question being . Who owns the bar. Correct answer allows access.
Sorry I am unable to explain in proper jargon but I hope I write games better than I code them.
Line 1 column 10 seems to relate to the inverted commas before Murphy .
I already found out the code to standardise the answer to lower case and containing the key word. I am wary of putting that in unless I mess up even more.
I believe that you have commented on other games of mine by the way.
This is my first attempt at questions.


but not understanding coding I just used the quest buttons

If you don't understand coding, you should still be able to switch to code view, paste in the code I gave you, and switch back again. Then you can see what the same code should look like in the GUI editor

Sorry I am unable to explain in proper jargon but I hope I write games better than I code them.

Can you try posting the code you've got? It's very hard trying to work out what's wrong with it without seeing it. If you switch to code view, you can copy the relevant lines and paste it here on the forums.

When pasting code on the forum, it usually helps if you can stop the forum from mangling it. You can do this by putting a line of three backticks (```) above and below your code, on a line of their own. For example:

```
code goes here
```

That way we can see what you're working with, and have a better understanding of what the problem might be.


Sorry but I have never tried cut and paste. One thing I found peculiar was the inverted commas, excuse my ignorance but should they be curved “” like this. Mine both curve in the same direction. I have fiddled with the spaces but can’t get them to alter. I’m probably doing something extremely stupid, probably because I was born far too long ago.


I already looked at code view and it copies your code exactly I rechecked the inverted commas and I was mistaken. They are ok . I created a short test game . The same error appeared ( unexpected character in result statement line 1 column 10.


\\ msg ("What is his name")
get input {
if (result = “Murphy“) {
msg ("Correct")
}
else {
msg ("No") \
Hope I’ve done this right this code results in error unknown character in statement result line 1 column 10


You've got normal double quotes (") around most of your strings; but smart quotes ( and ) around Murphy.

You need to replace them with normal quotes.
Unfortunately in this case the error message was a bit hard to read. It says Error running script: Error compiling expression 'result = “Murphy”': SyntaxError: Unexpected character: “Line: 1, Column: 10
When really it should have said:

Error running script:
Error compiling expression 'result = “Murphy”':
SyntaxError: Unexpected character: “
Line: 1, Column: 10

With the error message broken up into multiple lines, you can see more easily that the unexpected character it's talking about is a “
I wish Quest could put line breaks in its error messages.


I didn’t realise there were two kinds of quotes. How would I avoid smart quotes. My iPad only seems to do smart. Is there an adjustment I can do. I’ve never had this problem before. Anyway thanks for sorting it out .
Father Thyme


Ok . figured out how to change quotes. Thanks Mrangel


Log in to post a reply.

Support

Forums