Hey
I´m playing around with AutoIt since a few Weeks, now I wanted to try to make a Bot for Ogame(yeah a another one...)
Well as the Theme says I have a few Prolems, which I couldn´t eliminate with Google and the Helpfile.
So hoping that someone of you can help me.
PHP Code:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $loginButton
Global $name = GUICtrlRead($userField)
Global $pass = GUICtrlRead($passField)
Global $uni = GUICtrlRead($uniField)
Global $ip = getIP()
Global $post = getPost()
If $sPost = '' Then
$sPacket = 'GET /' & $sSeite & ' HTTP/1.1' & @CRLF
Else
$sPacket = 'POST /' & $sSeite & ' HTTP/1.1' & @CRLF
EndIf
$sPacket &= 'Host: ' & $sHost & @CRLF & _
'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)' & @CRLF & _
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' & @CRLF & _
'Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3' & @CRLF & _
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' & @CRLF & _
'Keep-Alive: 300' & @CRLF & _
'Content-Type: application/x-www-form-urlencoded' & @CRLF & _
'Connection: keep-alive' & @CRLF
If $sReferer <> '' Then
$sPacket &= 'Referer: ' & $sReferer & @CRLF
EndIf
If $sCookies <> '' Then
$sCookies = StringStripCR($sCookies)
$sCookies = StringStripWS($sCookies, 8)
$sPacket &= 'Cookie: ' & $sCookies & @CRLF
EndIf
If $sPost <> '' Then
$sPacket &= 'Content-Length: ' & StringLen($sPost) & @CRLF
EndIf
$sPacket &= @CRLF
If $sPost <> '' Then
$sPacket &= $sPost
EndIf
If $Msg = 1 Then
MsgBox(0, "Packet", $sPacket)
EndIf
TCPStartup()
If @error Then Return SetError(1, 0, "")
$iSocket = TCPConnect($sIp, 80)
If @error Then Return SetError(2, 0, "")
TCPSend($iSocket, $sPacket)
If @error Then Return SetError(3, 0, "")
$iTimer = TimerInit()
Do
$sRecv = TCPRecv($iSocket, 1024)
If TimerDiff($iTimer) > $iMaxTime Then Return SetError(4, 0, "")
Until $sRecv <> ""
Do
$sRecv &= TCPRecv($iSocket, 1024)
Until @error Or StringInStr($sRecv, '</html>')
TCPCloseSocket($iSocket)
TCPShutdown()
Return $sRecv
EndFunc ;==>TCPRequest
At First I am getting this:
Code:
D:\AutoIt Scripts\ogameBot0.1.au3(233,118) : ERROR: TCPRequest() called by a previous line with 1 arg(s). Min = 2. First previous line calling this Func is 65.
Func TCPRequest($sIp, $sHost, $Msg = 0, $sSeite = "", $sPost = '', $sCookies = '', $sReferer = '', $iMaxTime = 10000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
And the Programm exits when I am pressing the Login Button.
Erm, I modified the Code a little bit, before that I was able to comte to the Main Function and in the Labels the Metal was setted up.
But, I got the whole time a 0 from the getMetal function.
Then I modified the Code in getSession() and now there is an error thrown, but only in the Console.
Code:
Subscript used with non-Array variable.
The Line is the MSGBox in the getSession-Method.
But I know that StringBetween is deliviering a Array.
And why isn´t the window closing when I pressing the X-Button on the Main Frome? The Code should be correct.
It´s the same thing with the AccountForm, when I press on the MainFrame on the Taskbar to the MenuItem nothing happens.
And yes, the Variables are correct.
Ähh soll ich jetzt noch mal alles auf deutsch schreiben?
Zum ersten Fehler : Überprüfe mal, ob du TCPRequest mit genügend Parametern aufrufst.
Zum zweiten Fehler : Nenn mir mal den Wert von @error nach dem Aufrufen von StringBetween
Also, beim Ersten kann ich bestätigen, das uni, post und ip von den Methoden zurückgeliefert werden.
Dabei muss ich anmerken, dass das gleiche Script läuft wenn ich die ganzen Getter weg schmeiße.
Und ich kann es eingenzen auf vor die login() Funktion.
Wenn ich dort eine msg ausgeben möchte gehts nicht.
Hmm error-handling hab ich micht nicht wirklich beschäftigt...
jedenfalls wenn ich schreibe @error=1 gibt er mir die MsgBox zw. der if-bedingung aus bei 2,3,4 usw nicht.
Und das Helpfile sagt mir jetzt auch net viel.
Hmm hat den keiner eine Ahnung wo ungefähr mein Fehler liegen könnte?
Langsam wirds frustrierend immer wieder Funktionen umzuschreiben und am Ende das gleiche Ergebnis zu erhalten.
Ich glaube, dass ich am Besten nochmal alles in einer Wurst runterschreibe.
jedenfalls wenn ich schreibe @error=1 gibt er mir die MsgBox zw. der if-bedingung aus bei 2,3,4 usw nicht.
Und das Helpfile sagt mir jetzt auch net viel.
@error wird automatisch gesetzt. Zum Beispiel :
PHP Code:
#include <String.au3>
StringBetween("blabla","1","2")
MsgBox(0,"Test","@error hat den Wert " & @error)
[AutoIt] Problem: Non-Script-Login überwinden (für Browsergamebot) 02/10/2011 - AutoIt - 3 Replies Hallo epvp*coders,
ich will einen kleinen IE-Bot für das Browsergame Die Stämme schreiben.
Mein Bot fügt Benutzername und Passwort in die Inputs ein und betätigt den Login-Button.
Jetzt soll ein vorher angegebene Server ausgewählt werden. (z.B.: de61)
*g* Leider scheitere ich an diesem "non_script_login":
<div id="non_script_login">
<label for="server_select" id="server_select_label">
<strong >Welt:</strong>
<select id="server_select"...
AutoIt - Unable to parse line 05/22/2010 - AutoIt - 3 Replies Hallo leute,
ich hab da ne problem mit auto it undzwar, den error unable to parse line. Ich hat mir ne paar tutorials angeschaut und ein wenig mit auto it rum gespielt. Hab mir jetzt ne bot gebastelt der Fragen stellt und antwortet, und hab in der Seite dieses Kastens noch eine Spieleseite angegeben aus Spaß, sodass man darüber online spiele Spilene kann, und hab die Adresse dort so eingeben $FENSTERURL = FileRead (Spele.nl - De leukste spelletjes site van Nederland!) Nur beim complien kommt...
[HELP] Parse error: parse error in C:\wamp\www\co\config.php on line 140 03/14/2010 - CO2 Private Server - 5 Replies Im getting this error when i try to go to my reg page:
Parse error: parse error in C:\wamp\www\co\config.php on line 140
It says that ^
Here is the code:
<?php
// Configurations
$myhost='localhost'; // MySQL database address // :33006
$mypass='test'; // MySQL server login