SilverDeath Posted August 5, 2010 Share Posted August 5, 2010 I'm working a script for the browser game Evony, which will alert you of Incoming attacks via Audible alert or Cell Phone Text. Im having a few problems though, only one part of the script works, depending on which one comes first. If I switch the one that does sound to come before the one that does text, the sound works and vise versa. See below: While 1 While $TOn = True Do $coord = PixelSearch( $CoordX, $CoordY, $CoordX, $CoordY, 0xAA150E, 20 ) If Not @error Then _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) Until Not @error Sleep(3600000) WEnd WEnd While 1 While $AOn = True $coord = PixelSearch( $CoordX, $CoordY, $CoordX, $CoordY, 0xAA150E, 20 ) If Not @error Then Alert($coord, $AlarmSound) WEnd WEnd Not quite sure what Im doing wrong but any help to point me in the right direction would be great. The Whole scipt and config file is below: expandcollapse popup;################################## ; Include ;################################## #Include<file.au3> ;################################## ; Audio Hotkey Startup ;################################## HotKeySet("{F5}", "AStartStop") $AOn = False ;################################## ; Text/Email Hotkey Startup ;################################## HotKeySet("{F6}", "TStartStop") $TOn = False ;################################## ; Variables ;################################## Global $CellEmail = IniRead("Config.ini", "Text", "CellPhoneEmail", "NotFound") Global $SmtpServer = "smtp.mail.yahoo.com" Global $FromName = "Evony Attack Alarm" Global $FromAddress = "***********@yahoo.com" Global $ToAddress = $CellEmail Global $Subject = "You're Being Attacked!" Global $Body = "Please log into Evony right away, You are being attacked by an Enemy!" Global $AttachFiles = "" Global $CcAddress = "" Global $BccAddress = "" Global $Importance = "High" Global $Username = "*******" Global $Password = "*******" Global $IPPort = 465 Global $ssl = 1 Global $CoordX = IniRead("Config.ini", "CordX", "x", "NotFound") Global $CoordY = IniRead("Config.ini", "CordY", "y", "NotFound") Global $AlarmSound = IniRead("Config.ini", "Alarm", "Alarm", "NotFound") While 1 While $TOn = True Do $coord = PixelSearch( $CoordX, $CoordY, $CoordX, $CoordY, 0xAA150E, 20 ) If Not @error Then _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) Until Not @error Sleep(3600000) WEnd WEnd While 1 While $AOn = True $coord = PixelSearch( $CoordX, $CoordY, $CoordX, $CoordY, 0xAA150E, 20 ) If Not @error Then Alert($coord, $AlarmSound) WEnd WEnd ;################################## ; Audio Hotkey Function ;################################## Func AStartStop() If $AOn = False Then $AOn = True MsgBox(0, "Evony Attack Alarm", "Audible Alarm Enabled.") Else $AOn = False MsgBox(0, "Evony Attack Alarm", "Audible Alarm Disabled.") EndIf EndFunc ;################################## ; Text Hotkey Function ;################################## Func TStartStop() If $TOn = False Then $TOn = True MsgBox(0, "Evony Attack Alarm", "Text Message Alarm Enabled.") Else $TOn = False MsgBox(0, "Evony Attack Alarm", "Text Message Alarm Disabled.") EndIf EndFunc ;################################## ; Audible Alert Function ;################################## Func Alert($coord, $ColAlert = "Alert") Local $temp, $File $temp = StringReplace($ColAlert & " " & $ColAlert, " ", "+") $File = StringRegExpReplace($ColAlert, "([ .,!])", "") If Not FileExists(@TempDir & "\" & $File & ".mp3") Then _ InetGet("http://translate.google.com/translate_tts?q=" & $temp, _ @TempDir & "\" & $File & ".mp3") SoundPlay(@TempDir & "\" & $File & ".mp3", 1) Return EndFunc ;==>Alert ;################################## ; Text/Email Script ;################################## Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf ;################################## ; Text/Email Function ;################################## Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;################################## ; Error Function ;################################## Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc [CordX] x=315 [CordY] y=727 [Alarm] Alarm=Enemy Attack! [Text] CellPhoneEmail=**********@yahoo.com Link to comment Share on other sites More sharing options...
riceking Posted August 5, 2010 Share Posted August 5, 2010 http://www.autoitscript.com/forum/index.php?showannouncement=11&f=2 Have you read that? \ Link to comment Share on other sites More sharing options...
SilverDeath Posted August 5, 2010 Author Share Posted August 5, 2010 (edited) http://www.autoitscript.com/forum/index.php?showannouncement=11&f=2Have you read that?I would hardly call it a bot, it doesent automate one thing in that game. It Just looks for pixel changes at a certain coord on the screen. So not really sure how that rule applies to this, looking at the code should tell you that.I'm asking for help, to point me in the right direction. Edited August 5, 2010 by SilverDeath Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 5, 2010 Moderators Share Posted August 5, 2010 SilverDeath,it doesent automate one thing in that game. It Just looks for pixel changes at a certain coord on the screenSounds like a bot to me! What else would you call a script which does something you should be doing yourself when you play? I'm asking for helpAnd as the announcement makes quite clear, you are not going to receive any here. For your own sake, please do not persist. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SilverDeath Posted August 5, 2010 Author Share Posted August 5, 2010 Thats fine if you say it automates the game, then ok. Please delete this topic. Ill repost a new one with the evony stuff ommitted. I had a change of heart afterall, I now intend to use this script to alert me when a intant message window pops up. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 5, 2010 Developers Share Posted August 5, 2010 Thats fine if you say it automates the game, then ok. Please delete this topic.Ill repost a new one with the evony stuff ommitted. I had a change of heart afterall, I now intend to use this script to alert me when a intant message window pops up. Nah, just leave is better. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jkarlos Posted June 27, 2022 Share Posted June 27, 2022 On 8/5/2010 at 9:44 AM, Melba23 said: Hola. Interesante tu codigo, estoy buscando algo que detecte los colores Pero tengo duda con estas lineas, que es el "config.ing" Ojala me puedan ayudar Saludos Global $CoordX = IniRead("Config.ini", "CordX", "x", "NotFound") MrKm 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted June 27, 2022 Developers Share Posted June 27, 2022 12 years further and you needed to resurrect the topic with a none English post? ... MrKm 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts