Triggering Scripts from Multiple Keywords

Forgewright
16 Oct 2015, 22:07
I don't expect anyone to take the time to answer the question. I just need some specific research direction.
How can I get multiple keywords in a user input to trigger a response from a script?

If the user inputs, "Ask Bill if he knows where the Greeks are hiding." or any form of the question containing the keywords, ask, Bill, where, Greeks, hiding. A response would require these specific keywords. A script would trigger differently for the input, "Ask Bill where the Romans are going."

I can't imagine this as not feasible. I do not care for out-putting a question to answer a question or showing a menu of topics for the user to pick from.
I want to research how to pick apart an input from the user and come up with a reasonable response without relying on an exact match scenario. If it is as simple as creating a variable of the input and then using an ...if(var contains whatever) statement then I can probable move ahead easily enough.

I find it difficult to discover lengthy explanations online. It would be to much for you guys to show me and since I am unwilling to take a course in JavaScript, I will rely on the old, "Come to a problem and stop everything your doing and hunt down the answer on Google" approach. Hence, the need for research material, preferably in video form.

Just some links to possible references would be great, or if what I ask is not so complex as I think, then feel free to share some ideas.

HegemonKhan
16 Oct 2015, 22:33
look up regex (regular expressions), delegates (almost the same as functions in terms of their capabilities~power~usefulness, but they're scripts; aka: special script Attributes, Script Attributes can be 'called upon' via the 'invoke' command), and~or using 'Commands', within the quest doc

basically, what you're doing is parsing, so another possible path (aside from or along with the above) would be:

you can store input as a string, and then use the string functions, for~foreach~split~join, and etc, to iterate through the string for various keywords, and etc. again look up in quest doc (such as for all of the string functions and etc)

------

lastly, if you're a good coder~programmer, you can look at quest's source~core files and see how Alex' has done the parsing for the quest language~engine itself, using these methods for what you want to do.

-------

if you can't find any of these in the quest doc, let me know, and I can~will find them (provide their links) for you.

The Pixie
17 Oct 2015, 06:54
Create a command:
ask #object# #text#

In the script, the object variable will be Bill, and the text variable will be a string, "if he knows where the Greeks are hiding".Convert it to lower case, text = LCase(text), and then you can then use IsRegexMatch or even just Instr.

http://docs.textadventures.co.uk/quest/ ... ching.html
http://docs.textadventures.co.uk/quest/ ... match.html
http://docs.textadventures.co.uk/quest/ ... instr.html