Zarox Posted July 6, 2007 Share Posted July 6, 2007 (edited) And for those people wondering if there are hacks to this game. There supposedly is one but it is an auto clicker (clicks for you). There is some other glitches and ways to lose less money if your going to die or lose a battle. And he will probably fix this as soon as he can so people that should have died or ran away would have lost money... Time to end it. Its Game Over. Edited July 14, 2007 by Zarox Link to comment Share on other sites More sharing options...
enaiman Posted July 6, 2007 Share Posted July 6, 2007 (edited) WoW - I wish my first script to look like this. for a start you can make a function and put this part into MouseClick("left", 400, 670, 1); Click Fight MouseClick("left", 460, 585, 70); Click Attack/Defend Sleep(2000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) $PressButton1 = True; Starts It Over Because it is the same and you're using it like 4-5 times - just make a function and call it. Another idea - replace that long If-Else with a Switch or Select - it will look more ... elegant Edited July 6, 2007 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
MisterBates Posted July 6, 2007 Share Posted July 6, 2007 I was just wondering if someone could look through this code and see if there was a way to tidy it upexpandcollapse popupHotKeySet("{ESC}", "Terminate") $PressButton1 = True $firefox = WinActivate("Pet Me - Mozilla Firefox", "") If $firefox = 0 Then Exit 0 Else While True WinActivate("Pet Me - Mozilla Firefox", "") If $PressButton1 Then MouseClick("left", 525, 340, 1); Click Kill Monsters Sleep(2000) MouseClick("left", 500, 640, 1); Click Evade Sleep(2000) $PressButton1 = False; EndIf ClipPut( "!" ) WinActivate("Pet Me - Mozilla Firefox", "") Sleep(250) Send ( "^a" ) Sleep(250) Send ( "^c" ) $paste = ClipGet () $array1 = StringSplit ( $paste , 'Level ', 1 ) $enemylevel = StringLeft ( $array1[3] , 2 ) $yourlevel = StringLeft ( $array1[4] , 2 ) $almost = StringTrimLeft ( $array1[2] , 3 ) $array2 = StringSplit ($almost , "." ) $enemytype = $array2[1] If $enemytype = "Ant" And $enemylevel-1 <= $yourlevel Then MouseClick("left", 400, 670, 1); Click Fight MouseClick("left", 460, 585, 70); Click Attack/Defend Sleep(2000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) $PressButton1 = True; Starts It Over ElseIf $enemytype = "Spider" And $enemylevel+1 <= $yourlevel Then MouseClick("left", 400, 670, 1); Click Fight MouseClick("left", 460, 585, 90); Click Attack/Defend Sleep(2000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) $PressButton1 = True; Starts It Over ElseIf $enemytype = "Mantis" And $enemylevel+1 <= $yourlevel Then MouseClick("left", 400, 670, 1); Click Fight MouseClick("left", 460, 585, 70); Click Attack/Defend Sleep(2000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) $PressButton1 = True; Starts It Over ElseIf $enemytype = "Scorpion" And $enemylevel+3 <= $yourlevel Then MouseClick("left", 400, 670, 1); Click Fightbeta MouseClick("left", 460, 585, 70); Click Attack/Defend Sleep(2000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) MouseClick("left", 525, 260, 20); Click Feed Sleep(1000) $PressButton1 = True; Starts It Over Else WinActivate("Pet Me - Mozilla Firefox", "") MouseClick("left", 500, 670, 1); Click Dodge Sleep(1000) EndIf WEnd EndIf Func Terminate(); Exit Function Exit 0 EndFunc ;==>TerminateHmmmm. The $PressButton1 stuff looks mighty familiar - glad to see that you got your first script completed! Couple other ideas that aren't really necessary to do, but would be a chance to learn some more ... In this code, you may be able to use StringRegExp to do all the splitting and trimming in one statement, but it's difficult to say without seeing what comes back from the clipboard: $paste = ClipGet () $array1 = StringSplit ( $paste , 'Level ', 1 ) $enemylevel = StringLeft ( $array1[3] , 2 ) $yourlevel = StringLeft ( $array1[4] , 2 ) $almost = StringTrimLeft ( $array1[2] , 3 ) $array2 = StringSplit ($almost , "." ) $enemytype = $array2[1] And adding to enaiman's feedback, implement the function, and you may find the complex if ... elseif ... elseif ... turns into a single if, like the following: If ($enemytype = "Ant" And $enemylevel-1 <= $yourlevel) or _ ($enemytype = "Spider" And $enemylevel+1 <= $yourlevel) or _ ( ... ) Then CALL FUNCTION Else WinActivate("Pet Me - Mozilla Firefox", "") MouseClick("left", 500, 670, 1); Click Dodge Sleep(1000) EndIf Have fun with AutoIt! [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
lespoils Posted July 6, 2007 Share Posted July 6, 2007 (edited) I'm making a facebook pet's script too and i have the folowing problem: i dont want to use the mouse click, i'm using the _IEAction() function. for now i am able to click on kill monster, then on the next page i can figure out wehter it's an ant if so click fight it if not click evade. My problem is on the page where u click the fight/defend button. i can't get the focus on the actio button. First let me explain how i did until now. i looked into the html code of the Pet game. let me use the fight or evade if not ant scenario. (i dont have my code with me as i'm at work presently, but i'll do my best to be accurate) here's the html code i'm interrested in: CODE <form action="http://neo2.hotornot.com/facebook/pet/?"> <--------here i cut the link it's too long <input type="hidden" name="form_action" value="pet.do_fight" /> <input type="hidden" name="mcid" value="4" /> <input type="hidden" name="level" value="20" /> <input type="hidden" name="type" value="fightmonster" /> <input type="submit" class="fight" value="Fight It!" /> </form> <form action="http://neo2.hotornot.com/facebook/pet/?> <--------here i cut the link it's too long <input type="hidden" name="form_action" value="pet.do_fight" /> <input type="hidden" name="type" value="evademonster" /> <input type="submit" class="evade" value="Evade" /> </form> so there are two forms here the first (0) is the one for the Fight It button and the second (1) is the one for evade. so now with the _IEPropertyGet function i put the "innertext" in a string and with StringRegExp i look if the word 'ant' is there If yes, i want to click on fight it. here's how i do it, this code sample i found on another post in this forum (Thanks Dale) $oForm = _IEFormGetCollection($oIE,0) <-- 0 is to say that it's the first form that i want, then $oElement = _IEFormElementGetCollection($oForm,4) <---- so $oElement references to the submit "fight it" button, then _IEAction($oElement,"click") <-- to click on the button automaticaly Now this works fine, it does all i want with no mouseclick coordinate thing. Now here's my problem. When u click on fight it a new page opens to handle the fight and u need to click on the fight (or defend) button repeatedly. But when i look into the html code, i can't seem to find any form or a way to work as i used to, i see a button that seems to be what i want but i can't focus on it. i'm no html expert but i think it's in a script here's the html so u can look at it and help me, i deleted the long html part that i was pretty sure had nothing to do with it: CODE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Pet Me</title> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" href="/facebook/pet/css/pet.css?10" type="text/css" /><script type='text/javascript' src='/facebook/pet/js/ufo. js?10'></script><script type='text/javascript' src='/facebook/pet/js/moo.js?10'></script><script type='text/javascript' src='/facebook/ pet/js/pet.js?10'></script><script type='text/javascript' src='/facebook/pet/js/fight.js?10'></script></head> <body> <div id="nav"> </div> <div class="nav-status"> <span style="float:left;">Currently playing with: <a href="http://neo2.hotornot.com/facebook/pet/showpet?pid=597349&fb_sig_in_iframe=1&fb_sig_time=1183690011.9784&fb_sig_user=563071092&fb_sig_profile_update_time=1183685517 &fb_sig_session_key=657ab495b400e392aa3d47c9-771e&fb_sig_added=1&fb_sig=685974e8673780f0793f4dff746d6d1f&cpid=5973 49&msg="><b>PetFace</b></a></span> <span style="float:right;">Location: <a href="http://neo2.hotornot.com/facebook/pet/askfight?loc=3&fb_sig_in_iframe=1&fb_sig_time=1183690011.9784&fb_sig_user=563071092&fb_sig_profile_update_time=1183685517&fb_ sig_session_key=657ab495b400e392aa3d47c9-c73d766279a46f0aaac1d104771e&fb_sig_added=1&fb_sig=685974e8673780f0793f 4dff746d6d1f&cpid=597349&msg="><b>Greenwich Forest</b></a></span> <p style="clear:both;" /> </div> <div id="the_msg" style="height:30px;"></div> <table> <tr> <td> <div id="enemy_lifebar"></div> </td> <td valign="top"> <img src="http://pix.hotornot.com/img/facebook/pet/monsters/crop/crop_monster3.png"/> <div class="pet-avatar-class"> Level 17 Ant </div> </td> <td valign="top"> <div class="pet-avatar-no-border"> <script type="text/javascript"> var FO = { movie:"http://neo2.hotornot.com/facebook/pet/swf/pet2.swf?10", width:"250", height:"250", majorversion:"8", build:"0", flashvars:"host=http://pix.hotornot.com/img/facebook/pet&pet=5&face=182&armor=5&foot=225&hand=10&weapon=45" }; UFO.create(FO, "avatar509274"); </script><div id="avatar509274" style="width:250px;height:250px;"></div> <div class="pet-avatar-name"> PetFace </div> <div class="pet-avatar-class"> Level 19 Purpabit </div> </td> <td> <div id="pet_lifebar"></div> </td> </tr> <tr> <td></td> <td> <div id="enemy_stats"></div> </td> <td> <div id="pet_stats"></div> </td> <td></td> </tr> </table> <div style="text-align:center;margin:4px;" id="fight_btns"></div> <script type="text/javascript"> var FIGHT = { 'id' : 47973843, 'turn' : 0, 'enemy' : { 'name' : 'Ant', 'level' : 17, 'cur_hp' : 4298, 'hp' : 4298, 'min_damage' : 208, 'max_damage' : 312, 'armor' : 52}, 'pet' : { 'cur_hp' : 4109, 'hp' : 4190, 'min_damage' : 368, 'max_damage' : 554, 'armor' : 224} }; var life0img = "http://pix.hotornot.com/img/facebook/pet/life0.gif"; var life1img = "http://pix.hotornot.com/img/facebook/pet/life1.gif"; var life2img = "http://pix.hotornot.com/img/facebook/pet/life2.gif"; var FORM_ACTION = "http://neo2.hotornot.com/facebook/pet/?fb_sig_in_iframe=1&fb_sig_time=1183690011.9784&fb_sig_user =563071092&fb_sig_profile_update_time=1183685517&fb_ig_session_key=657ab495b400e392aa3d47c9-ded=1&fb_sig=68597 4e8673780f0793f4dff746d6d1f&cpid=597349&msg="; renderFight(); renderMsg(""); </script> <br /><br /> </div> </body> </html> Okay now i know this was long, but i wanted to be as precise as possible. Really looking foward to reading replies ! Best Regards Lespoils Edited July 6, 2007 by lespoils Link to comment Share on other sites More sharing options...
Zarox Posted July 7, 2007 Author Share Posted July 7, 2007 (edited) I did the first part that had to do with making Functions to make the script simpler overall. Then I attempted to the second part suggested by MisterBates below: And adding to enaiman's feedback, implement the function, and you may find the complex if ... elseif ... elseif ... turns into a single if, like the following: Thanks for all the help guys. Especially MisterBates lol Edited July 14, 2007 by Zarox Link to comment Share on other sites More sharing options...
MisterBates Posted July 7, 2007 Share Posted July 7, 2007 I did the first part that had to do with making Functions to make the script simpler overall. Then I attempted to the second part suggested by MisterBates below: I ended up with this and it will only attack Mantis and no other species.It may be the operator precedence rules on your condition. Try this: If ($enemytype = "Ant" And $enemylevel-1 <= $yourlevel) or _ ($enemytype = "Spider" And $enemylevel+1 <= $yourlevel) or _ ($enemytype = "Mantis" And $enemylevel+2 <= $yourlevel) or _ ($enemytype = "Scorpion" And $enemylevel+3 <= $yourlevel) Then FightAttackFeed() Else WinActivate("Pet Me - Mozilla Firefox", "") MouseClick("left", 625, 675, 1); Click Dodge Sleep(1000) EndIf Note the inserted parentheses. If that don't work, then you could try enaiman's suggestion, and write it as a select statement instead: Select case $enemytype = "Ant" And $enemylevel-1 <= $yourlevel FightAttackFeed() case $enemytype = "Spider" And $enemylevel+1 <= $yourlevel FightAttackFeed() ... case Else WinActivate("Pet Me - Mozilla Firefox", "") MouseClick("left", 625, 675, 1); Click Dodge Sleep(1000) Endselect I like the naming of the functions - makes it clear what all the clicks are meant to achieve [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
Zarox Posted July 7, 2007 Author Share Posted July 7, 2007 It may be the operator precedence rules on your condition. Try this: If ($enemytype = "Ant" And $enemylevel-1 <= $yourlevel) or _ ($enemytype = "Spider" And $enemylevel+1 <= $yourlevel) or _ ($enemytype = "Mantis" And $enemylevel+2 <= $yourlevel) or _ ($enemytype = "Scorpion" And $enemylevel+3 <= $yourlevel) Then FightAttackFeed() Else WinActivate("Pet Me - Mozilla Firefox", "") MouseClick("left", 625, 675, 1); Click Dodge Sleep(1000) EndIf Thanks, that works! This has been an interesting project for my first script and I will be adding more to it. I like the naming of the functions - makes it clear what all the clicks are meant to achieve Haha, Thanks. I like to keep things literal and easy to remember. Link to comment Share on other sites More sharing options...
Zarox Posted July 7, 2007 Author Share Posted July 7, 2007 (edited) I was wondering how to change the $strings part now, I will post everything needed to know, hopefully it will be enough information. I am wondering if I can simplify it, so it would look neater and better. This is the ClipPut/ClipGet I want it to find -Level 24 (Level of me, zarox) -Level 26 (Level of monster) -Mantis (Type of monster) -Put them into Strings -Thank you guys for your help, as I learn this language. -Zarox. Edited July 14, 2007 by Zarox Link to comment Share on other sites More sharing options...
Zarox Posted July 7, 2007 Author Share Posted July 7, 2007 I want it to find -Level 24 (Level of me, zarox)-Level 26 (Level of monster)-Mantis (Type of monster)-Put them into StringsTo Clarify:-Find just the number "24" not "Level 24"-Samething with th level of the monster-Whole name Mantis, Ant, Scorpian, or Spider - Depending on which appears.Thanks,Zarox Link to comment Share on other sites More sharing options...
ashley Posted July 7, 2007 Share Posted July 7, 2007 open sciTE and press cirl + F5 that will tell you were to tidy... Free icons for your programs Link to comment Share on other sites More sharing options...
Zarox Posted July 7, 2007 Author Share Posted July 7, 2007 open sciTE and press cirl + F5 that will tell you were to tidy...How does this work, and I am sure it doesn't show different ways to do it but just taking out code you dont need. Are oyu sure this works, because it did nothing for me. I'd rather stick to getting advice from other people. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 8, 2007 Share Posted July 8, 2007 How does this work, and I am sure it doesn't show different ways to do it but just taking out code you dont need. Are oyu sure this works, because it did nothing for me. I'd rather stick to getting advice from other people.Tidy does not remove any code. It only formats for indentation and tests basic sequence, like having a WEnd for every While. You really shouldn't bother anyone with code you haven't bothered to Tidy yet. It indicates you haven't made even basic efforts to check the code yourself. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Zarox Posted July 8, 2007 Author Share Posted July 8, 2007 Tidy does not remove any code. It only formats for indentation and tests basic sequence, like having a WEnd for every While. You really shouldn't bother anyone with code you haven't bothered to Tidy yet. It indicates you haven't made even basic efforts to check the code yourself. Well, I know that the code works. I just need to know if there is a simpler way to find the three things listed above. I am sorry I didn't know what Tidy was, as I just started using this about 3 days ago.-Zarox Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 8, 2007 Share Posted July 8, 2007 Well, I know that the code works. I just need to know if there is a simpler way to find the three things listed above. I am sorry I didn't know what Tidy was, as I just started using this about 3 days ago.No problem, I still don't use half the tricks SciTE can do, just because I haven't learned them all yet. And welcome to AutoIt! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Zarox Posted July 8, 2007 Author Share Posted July 8, 2007 No problem, I still don't use half the tricks SciTE can do, just because I haven't learned them all yet. And welcome to AutoIt! Hehe thanks.-Zarox Link to comment Share on other sites More sharing options...
defrag Posted July 8, 2007 Share Posted July 8, 2007 (edited) I only get errors running this script. When I run it, it clicks "Kill Monsters", then the "Evade" button. It then moves slightly to the right, highlights all the text, and I get an error box saying this: Line 0 (File "C:\xxx\xxx\desktop\pets.exe"): $enemylevel = StringLeft ($array1[3] , 2) $enemylevel = StringLeft ( ^ ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. Does this have anything to do with my screen resolution? I'm running 1280 x 1024. If this is the case, I would love getting some guidelines on how to adjust whatever values. I've never done any coding in my life. Edited July 8, 2007 by defrag Link to comment Share on other sites More sharing options...
Zarox Posted July 8, 2007 Author Share Posted July 8, 2007 (edited) Instructions (Only Tested in Firefox): 1. Open up the page with your Pet. 2. Right click the frame. 3. Go to This Frame -> Open Frame in New Tab. 4. Make sure there is another tab open. 5. Click Feed. 6. Run Script. Script: Also, This is for 1280 x 1024. Edited July 14, 2007 by Zarox Link to comment Share on other sites More sharing options...
Zarox Posted July 8, 2007 Author Share Posted July 8, 2007 (edited) My buddy and I were wondering what is the RegExp with .* but it needs to include new lines. Edited July 8, 2007 by Zarox Link to comment Share on other sites More sharing options...
Zarox Posted July 8, 2007 Author Share Posted July 8, 2007 My buddy and I were wondering what is the RegExp with .* but it needs to include new lines.Anyone know? Link to comment Share on other sites More sharing options...
lespoils Posted July 8, 2007 Share Posted July 8, 2007 Hi, this is my first try at making script with autoit, and it's a FaceBook's pet game automation. i don't use any mouseclick command, so u can do other stuff on your comp while the script is running. In general it works well. it only fights with Ant that are not 2 lvl higher than the pet. There's a little glitch tho, after some time running i get errors from IE.au3. What i'd like is to make it more robust. since this post is mostly about facebook pet game i devided to post it here Please post comments, ideas or corrections ! expandcollapse popup;Title: Facebook Pets Game bot ;Filename: IE.au3 ;Description: This script plays the Pet game on Facebook. It will do so on and on. ;Author: Patrick Sirois ;Version: 1.0 ;Last Update: july 8th, 2006 ;Requirements: A Facebook account, the Pet game installed, firefox And IE 6.0(not tested with v.7), Autoit v3.2.4.9 ;READ ME ;To make the script work: ; -log on facebook into the pets game page. ; -Go to the main screen where you click Feed,Kill Monster, buy/sell items,... ; -Rightclick in the Pet game frame and choose: this frame -> Open in a new window ; -copy paste the url in a Internet Explorer window, now we have a webpage with only the Petgame inside ; -Run the script, (shift+alt+s) ; -Press Esc to terminate script #include <IE.au3> Global $Paused HotKeySet("{ESC}", "Terminate") HotKeySet("+!s", "Start") ;the script goes on until the ESC key is pressed While 1 Sleep(100) WEnd ;;;;;;;; ;Terminates the script Func Terminate() Exit 0 EndFunc ;This is where all the core functions a called in an eternal loop Func Start() while 1 = 1 Feed() sleep(500) KillMonster() sleep(500) fight() sleep(500) WEnd EndFunc ;Decides wether a monster is to be fought or not ;A monster can only be an Ant and can only be 2 lvl higher func FightOrEvade() $oIE = _IEAttach ("Pet me") $sText = _IEPropertyGet($oIE,"innertext") dim $iEnemyLvl dim $iPetLvl ; This loop keeps on going until a monster is chosen to be fought. ;A monster can only be an Ant and can only be 2 lvl higher $while = 0 while $while = 0 ;This is where the decision begins if StringRegExp($sText, 'Ant') then $oIE = _IEAttach ("Pet me") sleep(500) $sText = _IEPropertyGet($oIE,"innertext") $oTextTable = StringSplit (_IEPropertyGet($oIE,"innertext")," ") $oPetName = $oTextTable[1] ;this is the only way i found to be able to get a ;specific text string (the levels) from the web page for $i = 2 to $oTextTable[0] if StringRegExp($oTextTable[$i], 'Level') then if StringRegExp($oTextTable[$i-2], 'encountered') = 0 Then if StringRegExp($oTextTable[$i-1], $oPetName)=0 Then $iEnemyLvl = $oTextTable[$i+1] $iPetLvl = $oTextTable[$i+5] EndIf EndIf EndIf next ;checks the level difference. ;If it is okay, the Fight it button is clicked ;If it is not okay, the Evade button is clicked $iLvlDiff = $iPetLvl - $iEnemyLvl if $iLvlDiff > -2 then $while = 1 ;this is how i choose a specific button from the page $oForms = _IEFormGetCollection ($oIE,0) $oElement = _IEFormElementGetCollection($oForms,4) _IEAction($oElement,"click") Else ;this is how i choose a specific button from the page $oForms = _IEFormGetCollection ($oIE,1) $oElement = _IEFormElementGetCollection($oForms,2) _IEAction($oElement,"click") $oIE = _IEAttach ("Pet me") sleep(500) $sText = _IEPropertyGet($oIE,"innertext") EndIf Else ;this is how i choose a specific button from the page $oForms = _IEFormGetCollection ($oIE,1) $oElement = _IEFormElementGetCollection($oForms,2) _IEAction($oElement,"click") $oIE = _IEAttach ("Pet me") sleep(500) $sText = _IEPropertyGet($oIE,"innertext") EndIf WEnd EndFunc ;Feeds until energy is full func Feed() $oIE = _IEAttach ("Pet me") sleep(500) $sText = _IEPropertyGet($oIE,"innertext") while StringRegExp($sText, 'Your pet has full hit points, no need to eat ') = 0 ;this is how i choose a specific button from the page $oForms = _IEFormGetCollection ($oIE,1) $oElement = _IEFormElementGetCollection($oForms,3) _IEAction($oElement,"click") sleep(500) $oIE = _IEAttach ("Pet me") $sText = _IEPropertyGet($oIE,"innertext") WEnd EndFunc ;Click on the Kill monster button from the main page func KillMonster() $oIE = _IEAttach ("Pet me") sleep(500) $oForms = _IEFormGetCollection ($oIE,3) $oElement = _IEFormElementGetCollection($oForms,0) _IEAction($oElement,"click") sleep(500) FightOrEvade() EndFunc ;Fights until monster dies than loots ;Losing a battle is not an option... func Fight() $oIE = _IEAttach ("Pet me") sleep(500) $sText = _IEPropertyGet($oIE,"innertext") while StringRegExp($sText, 'You have killed a') = 0 ;this is how i choose a specific button from the page $oForms = _IEFormGetCollection ($oIE,0) $oElement = _IEFormElementGetCollection($oForms,0) _IEAction($oElement,"click") $oIE = _IEAttach ("Pet me") $sText = _IEPropertyGet($oIE,"innertext") WEnd sleep(500) if StringRegExp($sText, 'You have killed a') then ;this is how i choose a specific button from the page $oForms = _IEFormGetCollection ($oIE,0) $oElement = _IEFormElementGetCollection($oForms,4) _IEAction($oElement,"click") EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now