Sign in to follow this  
Followers 0
Assault

Get text and respond o.O

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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")

It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

Share this post


Link to post
Share on other sites

The chat is an application like MIRC.

I dont under stand how to use StringRegExpReplace, could you explain?


Share this post


Link to post
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


It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

Share this post


Link to post
Share on other sites

Ok so I would use something like this(just the basic idea)?:

$txt = wingettext()

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


Share this post


Link to post
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.


It's my job to comfort the disturbed and to disturb the comfortable.
My Projects: Profiler, MakeSFX, UserInfo

Share this post


Link to post
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
Sign in to follow this  
Followers 0