Jump to content

Get text and respond o.O


Assault
 Share

Recommended Posts

I have no clue where to start I have looked around and saw a few commands that could work but I am probably just over complicating things so...

I would like to have a bot that responds to some questions in a chat room, like "Where can I find a car?" and then have it access an answer and say where. So...

<Car Guy> Where can i find a car?

<BOT> You can find a car at a dealership.

But with a lot more questions and answers.

I was thinking ControlGetText then try to match it with a question which leads to an answer but I confused myself in planning it out. : /

Thank you,

Assault

P.S. Is their like a get between function? I couldnt find one.

I.E.

GetBetween("<",">")

Edited by Assault
Link to comment
Share on other sites

I was thinking ControlGetText then try to match it with a question

This depends on the type of chat you're trying to use. Is it an application like MIRC? Or a web browser?

P.S. Is their like a get between function? I couldnt find one.

I.E. GetBetween("<",">")

For example

$a = StringRegExpReplace("<html>", "<(.*?)>","\1")

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

Okay, so you'll have to get the chat-text from the application, most likely with WinGetText.

About the StringRegExReplace: it uses three parameters:

1) the text to be filtered, in my example line "<html>

2) the regular expression which defines what text shall be searched. In our case, we are searching for any amount of characters (which is represented by ".*?") standing between the two brackets

3) the definition of the output string, in our case \1 which causes the command to give out the text between the brackets

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

Quite so, except for the ""& - part :)

$txt = wingettext()
$ansr = StringRegExpReplace($txt , "<(.*?)>","\1")

You'd get the html-codes between < and > as a result, text of the chat will be removed.

If you want to get the plain text without the html-codes, simply change the two brackets in the RegEx.

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...