Reloaded Posted March 16, 2010 Share Posted March 16, 2010 So i started to make an auto admin bot and i need it to monitor the game chat (through the webadmin page). What it needs to do is:1) Look through all the chat and compare it to a dictionary list (contains bad words)2) If it finds any, go to the beginning of the string and find AND store: "PERSONS NAME: " (the : is there so it will 99% of the time end up at the PERSONS NAME and not anywhere else in the chat.That is all i want help with so far, the next part would be getting into the list of players and searching for their name then grabbing their IP that is in the list but that i want to try on my own. So what im having trouble with is "walking" through the lines of code. So far i tried everything that is in these categories in the help file:Function Reference > String ManagementUDFs > Array ManagementUDFs > String ManagementHere is my code, followed by the HTML source for that players chat (should be helpful), followed by a SS of it. Btw the Username & Pass included into the source is not an actual log in if i was to give out the login my gaming clan would rip my head off.expandcollapse popup#cs ---------------------------------------------------------------------------- Title: |ELITE| AdminBot CodeName: Hydra Version: 1.0 Author: |ELITE|Reloaded Website: http://www.eliteswat.com Date Created: 2-23-2010 Date Last Modified: 3-15-2010 Email: reloaded@eliteswat.com OR harrisjason10@yahoo.com Copyright: |ELITE| The Clan that Makes a Difference! #ce ---------------------------------------------------------------------------- #Include <Array.au3> #Include <EditConstants.au3> #Include <GUIConstants.au3> #Include <GUIConstantsEx.au3> #Include <IE.au3> #Include <String.au3> Opt('MustDeclareVars', 1) Opt('GUIOnEventMode', 1) Global $ip, $port, $username, $password, $gotUsername, $gotPass, $http $http = "http://" Global $startBot, $svrFlush GUICreate("|ELITE| AdminBot - Hydra", 250, 180) GUISetOnEvent($GUI_EVENT_CLOSE, "close") ;IP edit GUICtrlCreateLabel("WebAdmin IP:", 67, 20, 200, 20) GUICtrlCreateLabel("http://", 32, 42, 50, 20) $ip = GUICtrlCreateInput("", 67, 40, 150, 20) ;PORT edit ;GUICtrlCreateLabel("Port:", 157, 20, 60, 20) ;$port = GUICtrlCreateInput("", 157, 40, 60, 20) ;USERNAME edit GUICtrlCreateLabel("Username:", 32, 70, 120, 20) $username = GUICtrlCreateInput("", 32, 90, 120, 20) ;PASSWORD edit GUICtrlCreateLabel("Password:", 157, 70, 60, 20) $password = GUICtrlCreateInput("", 157, 90, 60, 20, BitOr($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) ;START BOT button $startBot = GUICtrlCreateButton("Start Bot", 75, 130, 100, 30) GUICtrlSetOnEvent(-1, "startBot") GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd Func close() Exit EndFunc Func checkFields() ;Get the IP and store it Local $gotIP = $ip ;Get the Username and store it $gotUsername = GUICtrlRead($username) ;Get the Password and store it $gotPass = GUICtrlRead($password) Select ;Check if the IP is invalid (format: ***.***.***.***) Case $gotIP = 0 MsgBox(0, "Invalid IP", "IP must be in this format: ***.***.***.***" & @CR & "Only characters ""0-9"" and "".""") ;For now used as a test to see if it runs this code when it shouldn't Case $gotIP = 1 MsgBox(0, "", "Start Bot func going to execute") ;startBot() EndSelect EndFunc Func startBot() ;============================Variables============================= ; Local $svrWebAdmin, $logInForm, $logInUserField, $logInPassField, $oIE ;Store the IP ;eg. 192.168.1.1:10490 $svrWebAdmin = "http://81.19.215.40:10490" ;$http & GUICtrlRead($ip) ;Get the username and store it $gotUsername = "someUsername" ;GUICtrlRead($username) ;Get the password and store it $gotPass = "somePass" ;GUICtrlRead($password) ;================================================================== ;================================================================== ;Open up IE and connect to WebAdmin and LogIn ; $oIE = _IECreate($svrWebAdmin, 0, 1, 0, 1) ;Make sure page is fully loaded before continuing _IELoadWait($oIE) $logInUserField = _IEGetObjById($oIE, "user") _IEFormElementSetValue($logInUserField, $gotUsername) $logInPassField = _IEGetObjById($oIE, "pw") _IEFormElementSetValue($logInPassField, $gotPass) $logInForm = _IEFormGetCollection($oIE, 0) _IEFormSubmit($logInForm) ;Make sure page is fully loaded before continuing ;We can't use _IELoadWait here because the Frames constantly ;reload the browser! Sleep(5000) ;================================================================== ;============================Variables============================= ;Variables that need to be defined after IE is opened ; Local $consoleButton, $console, $playerList, $playerChat $consoleButton = _IEGetObjByName($oIE, "consolebutton") $console = _IEGetObjByName($oIE, "consoleinput") $playerChat = _IEGetObjById($oIE, "console") $playerList = _IEGetObjById($oIE, "players") ;================================================================== ;============================HERE IS WHERE I NEED HELP THANKS FOR HELPING IF YOU CAN AUTOIT FORUM USERS :D============================= ; ;Let me explain some things before you look at the code below, so far i haven't worked on making the dictionary list, ;at the moment im trying to just find <RANDOM_NAME: > without < > ofc. The name will only appear when someone in-game talks. ; ;Grab ALL the chat without HTML tags Local $a = _IEPropertyGet($playerChat, "innertext") ;This is just something i tried but couldnt get it to work (don't remember what i was trying to accomplish with it, sry) ;Local $b = _StringExplode($a, @CR, 0) ;Find the persons NAME, tell it to look for a STRING between the start of the line and : Local $c = _StringBetween($a, "", ": ", -1) MsgBox(0, "", @Error) ;If $c was found (RANDOM_NAME: ) then display it If $c Then _ArrayDisplay($c, "Test") EndIf ;================================================================== ;----Start Monitoring ;$console = _IEGetObjById($oIE, "console") ;$playerChat = _IEBodyReadText($console) EndFunc<table width="100%" height="750" class="listtable"> <tbody> <tr> <td valign="top" id="console"> <font color="#00ff00"><b>|ELITE|Reloaded^Maj(SPEC)</b>: Test for AutoIt forum help</font><br> <font color="#00ff00"><b>|ELITE|Reloaded^Maj(SPEC)</b>: Test for AutoIt forum help</font><br> <font color="#00ff00"><b>|ELITE|Reloaded^Maj(SPEC)</b>: Test for AutoIt forum help</font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=No Spamming The Server=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=English Langauge Only=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do Not Team Shoot=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do Not Team Tazer=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do Not Team Nade=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do Not Steal Somones Arrest=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do Not Kill Arrest=-</u></b><u></u></font><br> <font color="#ffff00"><b>ok7</b> disconnected (94.181.5.237).</font><br> <font color="#ffff00"><b>ok7</b> dropped from the server.</font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do not use exploits=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do not use glitches=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Do not use hacks=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=No Noob Calling=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=No Name Calling=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=No Abusive Langauge=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Please Follow The Server Rules=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Welcome to |ELITE| European Server 1!-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Contact: dutch@eliteswat.com or Legend@eliteswat.com=-</u></b><u></u></font><br> <font color="#ffff00"></font><font color="#ffffff"><b><u>-=Any problems and no ELITE on the server=-</u></b><u></u></font></td> </tr> </tbody> </table> Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 16, 2010 Share Posted March 16, 2010 Hi, Bots are not supported on this forum. As for your string management, I would have a look at StringRegExp or _StringBetween. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Reloaded Posted March 16, 2010 Author Share Posted March 16, 2010 Hi,Bots are not supported on this forum. As for your string management, I would have a look at StringRegExp or _StringBetween.MegaIm really bad at StringRegExp i can't get mine to work, if i post it can you help me out please? Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 16, 2010 Share Posted March 16, 2010 Im really bad at StringRegExp i can't get mine to work, if i post it can you help me out please?Sure, post the string and what you need from it. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Reloaded Posted March 16, 2010 Author Share Posted March 16, 2010 Sure, post the string and what you need from it.Is a loop needed in order to "walk" though multiple lines Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 16, 2010 Share Posted March 16, 2010 Is a loop needed in order to "walk" though multiple linesWith regex - No it is not! Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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