mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2014
Posts: 48
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Jul 2014
Posts: 48
Hello,
I have 2 questions I'm looking for help with scripting commands...
First:
I got bored and am trying to make a sort of question command for my script. So far got it working where you can do !question (question here), and it will respond with predetermined responses based on random number assigned. (I guess similar to like an 8 Ball)

My problem is that you can access the command even without asking a question. Like "!question green grass is green", and it will still respond. My issues are that that isn't a question, and it shouldn't technically respond to that. What is the proper syntax for trying to verify a question is being asked? I know you can compare letters or words from their responses, but I can't figure out how to determine if a question was asked. The closest I got was checking for special characters such as !,%,? but then the command stopped working.




Second:
I want to make it so that certain keywords are picked up when people access the question command, so that the given answer will no longer be a random response, but an exact response every time. Is this just too far out of the way for me to put time towards doing, or is this easier than I am thinking it to be?


TIA,
Aeon

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
You're a dealing with one of the hardest part of programming, analysing a spoken language. This is not easy, if you want a cheap way of doing it, it would still often be wrong. This is usually done with regular expression, if you are not familiar with them, you're going to have a bad time.
Basic ideas are to check for a '?' at the end, you can also check if the first word are interrogative words such as 'what' 'how' 'which' etc.
Then if you want to make an answer according to the question, yeah it's obviously even more complicated
Quote:
Is this just too far out of the way for me to put time towards doing
It is.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2014
Posts: 48
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Jul 2014
Posts: 48
I have been trying to learn regular expressions, but I'm currently struggling with syntax. Sometimes I can get stuff to work, sometimes not.


I am thinking about making it where I just evaluate the first word instead for the keywords (What, Where, When, Why, How, Is, Are, etc.)

Still no idea on what to do with the specific keywords (like where it will give a determined response instead of a random one), but assuming regex will help with that, if I can learn it properly.



As an FYI, I am not trying to analyze language to know exactly if a question is being asked, or what type of question. Just trying to make it more specific/specialized to where someone can't go "!question pickle lard", and it will respond with "Yes"
I understand people can still troll it, but for the most part, it will only pick up on legit questions.


Link Copied to Clipboard