Storing user input
Aerdureth
15 May 2014, 01:49Hello,
I have a little question, which is probably slightly stupid, but I spent all day writing things and now my brain is fried.
I am planning to let the player talk to a NPC and would like to store his answer to the NPC for later use since the outcome of the game will change according to it. Basically, if they tell the cyclops that their name is nobody, they will be able to escape unscatched later on, after the blinded him, while all other answers will lead to their death. I tried to orientate myself at the code for the introduction, so now it looks like this:
But I have no idea, what I should put in the 'if' and 'else' brackets. Help would be very appreciated.
Best wishes,
Aerdureth
I have a little question, which is probably slightly stupid, but I spent all day writing things and now my brain is fried.
I am planning to let the player talk to a NPC and would like to store his answer to the NPC for later use since the outcome of the game will change according to it. Basically, if they tell the cyclops that their name is nobody, they will be able to escape unscatched later on, after the blinded him, while all other answers will lead to their death. I tried to orientate myself at the code for the introduction, so now it looks like this:
get input {
game.cycname = result
msg ("> " + game.cycname)
if (IsRegexMatch ("niemand", LCase (result))) {
}
else {
}
msg ("\"Aha...\", die Kreatur kratzt sich am Kopf, \"" + game.cycname + " sein nett. Vielleicht werde ich dich besonders zubereiten.\"")
}
But I have no idea, what I should put in the 'if' and 'else' brackets. Help would be very appreciated.
Best wishes,
Aerdureth

jaynabonne
15 May 2014, 03:07Since you want to just remember the state for later, I think you can just set a flag in the game object. Or, since you're already storing the entered name, you could just do nothing else, and then do your check for "nobody" at the point where you need to make a decision. So the if/else would happen then, not at this point, since you have nothing to do at this time anyway.
I also don't know if you need to go the "regex" route since you're not using regular expressions in your test. You can just say:
I also don't know if you need to go the "regex" route since you're not using regular expressions in your test. You can just say:
if (LCase (result) = "niemand")
Aerdureth
15 May 2014, 11:17Thank you very much!
Now, I just need to figure out how the GIVE <object> TO <other object> syntax is called in the German translation so I can test my script. Is there a way to view all the translated commands?
Also, could somebody please tell me, which programming language the code view uses? As far as I can tell, it's neither Java nor PHP. So far, I have used it intuitively but since I am writing the game for my thesis, I should probably explain the coding process in greater detail than 'I used Quest.'.
Now, I just need to figure out how the GIVE <object> TO <other object> syntax is called in the German translation so I can test my script. Is there a way to view all the translated commands?
Also, could somebody please tell me, which programming language the code view uses? As far as I can tell, it's neither Java nor PHP. So far, I have used it intuitively but since I am writing the game for my thesis, I should probably explain the coding process in greater detail than 'I used Quest.'.

jaynabonne
15 May 2014, 13:02You can look at all the core files that ship with Quest. The language files are in there. Just find where Quest is installed (e.g. C:\Program Files (x86)\Quest 5). The core files are under Core, and the language ones are under Language under that (e.g Deutsch.aslx).
The Quest scripting language is a custom thing. It's not PHP or anything like that. It's Alex's own invention.
You might not have much choice besides saying the Quest scripting language.
The Quest scripting language is a custom thing. It's not PHP or anything like that. It's Alex's own invention.

HegemonKhan
16 May 2014, 00:43Is it somewhat similar to 'XML' (eXtensible Markup Language), or is actual 'XML' very different from quest ???, as I use 'XML' for notepad++ 's code language, and it seems to be accurate with quest's coding. I'm still unclear on this, and am wanting to better understand the programming languages, at least slightly better for now (actually learning a programming language will take a lot longer, obviously, and in the future, when I got the time and~or money~for classes to do so, hehe).

jaynabonne
16 May 2014, 01:24XML is a generic way of representing data. It can be used for anything from bank records to movie metadata to HTML queries over the internet to Visual Studio projects to... Quest games. It doesn't really specify the content - only a form for how you can store the content. So while an ASLX file is an XML file, that tells you how the data is structured but not what the data is. The actual tags used, the form of the attributes, etc are all what make an ASLX file what it is. It would be a bit like equating a book with the English language. Sure, the book is written in English, but saying it's English doesn't tell you anything at all about what the book is about - just how it's expressed.
And the script part (which is stored as textual content in various XML tags) is not formatted as XML at all - it's just text. And that's the active part of the Quest ASLX file, beyond the data stored in the XML elements.
I hope I understood your question and helped a bit.
And the script part (which is stored as textual content in various XML tags) is not formatted as XML at all - it's just text. And that's the active part of the Quest ASLX file, beyond the data stored in the XML elements.
I hope I understood your question and helped a bit.

Aerdureth
16 May 2014, 12:10Thank you so much! The XML part helped a lot!
We use it quite often for different purposes (though mainly for marking up texts with TEI-stuff) so it'll be a good way to explain the language to my instructors.
My game is now up and running and worked perfectly fine when I played it on the desktop version, but now that I uploaded it, people (including me) sometimes get stuck during my scripts which results in freezing. Maybe, I am textwalling too much
Or are there other reasons, why the game would freeze during scripts?

My game is now up and running and worked perfectly fine when I played it on the desktop version, but now that I uploaded it, people (including me) sometimes get stuck during my scripts which results in freezing. Maybe, I am textwalling too much


jaynabonne
16 May 2014, 12:57If it has to do with timers, timeouts, etc. then you've probably stumbled onto the problem the web player has with such things. If it's something else, then it would be helpful to see what you're doing.
Aerdureth
25 May 2014, 11:42Thank you so much for all the help! Now, my game is almost finished and I can hand in my thesis tomorrow 
Just one last question: one of my testers, who works as a teacher, suggested that I should include more possible answers than just 'yes' and 'no' since his students are unlikely to choose one of the traditional terms. So I set up the following:
But somehow, it does not recognise any of those answers now.

Just one last question: one of my testers, who works as a teacher, suggested that I should include more possible answers than just 'yes' and 'no' since his students are unlikely to choose one of the traditional terms. So I set up the following:
if (LCase (result) = "ja|jop|klaro|logo|freilich|yep|na klar|klar")
But somehow, it does not recognise any of those answers now.

jaynabonne
25 May 2014, 14:11That "if" will only match if they type in the string literally as you have it, will *all* the options and the "|" characters as well - they'd have to type that entire, exact string, which is not what you want.
What you have is more a regular expression. Try this instead:
What you have is more a regular expression. Try this instead:
if (IsRegexMatch(LCase (result), "ja|jop|klaro|logo|freilich|yep|na klar|klar"))