Jump to content

Help Needed Making IE Web Text Based RPG Bot


Recommended Posts

I'm new into AutoIt, and have been looking through the IE UDF examples online and in the AutoIt help file, and I haven't been able to find anything as of yet that will quite do what I need. I can login to a site just fine, I just need a way to test for different text on the page, and depending on what it sees navigate to a certain link. For example, a page loads and on the page is the text "You failed." When it sees that I would want it to click the try again link. Then it waits for new page to load and then it goes through the else if nest or loop or whatever to see what matches and if, for instance, "You failed," comes up again it clicks try again, or if "You were successful," comes up after who knows how many times it will click return to clan halls link or whatever. If someone could please help with this it'd be very appreciated. Thanks in advance.

Link to comment
Share on other sites

That clicks on text yes, but what if when you click on a link several different variations of things can happen? So I need some sort of code that can bring up a page, wait for it to load, then go through an array or loop or something that says, if it sees apple, click bananna, if it sees grape click orange. That kind of thing. The page is in php so the text isn't constant basically.

Link to comment
Share on other sites

That code goes through testing for different variations of text but as far as I could tell it only clicked on one link. Let me try to explain what I need better.

Browser goto url: http://www.dragonmachine.com

login with username and password

Wait for page to load.

If it says on the page, "It is a new day!", click the Continue link.

Wait for new page to load.

Click Forest link.

Wait for new page to load.

Click Search Suicidally link.

Wait for new page to load.

If it sees Until End link clikc it.

Wait for new page to load.

If it doesn't then check to see if it says Search Suicidally again. If it does go back to that line of code and keep doing the Search Suicidally link, wait until new page loads, Until End.

Kind of hard to explain, but hopefully this kind of helps. I appologize for any confusion, but I learn best by example. So thanks so much for your help.

Link to comment
Share on other sites

Looks like the funtion you are missing is _IEBodyReadText (and perhaps _IELoadWait)

$sText = _IEBodyReadText($oIE)
If StringInStr($sText, "It is a new day!") Then
    ; do stuff
EndIf

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: It is a new day! - Microsoft Internet Explorer

Class: IEFrame

Size: X: 0 Y: 0 W: 800 H: 570

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 34 Y: 230

Cursor ID:0

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x494949 Dec: 4802889

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 0 Y: 53 W: 792 H: 470

http://www.dragonmachine.com/newday.php?re...;type=ghostdart

But the last part can change depending on if it's a normal new day or what caused it. So basically just the newday.php part will be the same.

Link to comment
Share on other sites

Is there a way I can have AutoIt use an already loaded page? For instance, I want to test some code on the already loaded IE page. The game I'm playing is random so I need to be able to test different variations of things when I see them, so I can be sure it's doing what I need it to. Thanks so much for your guys's help.

Link to comment
Share on other sites

See _IEAttach

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...