Jump to content

Travian


Jex
 Share

Recommended Posts

  • Replies 180
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I have one tactic for you. I made bot that evade attacks. But now i just put in the simple code so the bot uses all the resources for building army, and so i preserve most of my resources. Very good option for beginning of the game. :)

Hope that hint helps some one.

Be cool be travian. :)

Link to comment
Share on other sites

  • 2 weeks later...

Ok, here goes a screenshot of the last version:

He his able to queue all the items, i will work out a way to also build new items. all the gui in working with tabs, and context menus.

Also, the bot is able to escape with all troops to X,Y in case of attacked.

@dumbledor:

The tactic of a travian is hard to code it. In my bot, I prefer to put all the tactic on the player, because travian is a lot. I play for a year in 3 servers in the top alliance.

You can still use a bot for a lot a repetitive task, like upgrading, and other stuff.

Edited by Linux
You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Link to comment
Share on other sites

Ok, here goes a screenshot of the last version:

He his able to queue all the items, i will work out a way to also build new items. all the gui in working with tabs, and context menus.

Also, the bot is able to escape with all troops to X,Y in case of attacked.

@dumbledor:

The tactic of a travian is hard to code it. In my bot, I prefer to put all the tactic on the player, because travian is a lot. I play for a year in 3 servers in the top alliance.

You can still use a bot for a lot a repetitive task, like upgrading, and other stuff.

Uau. :) Nice gui. ;) I have one question about escapeing. How do you found out about attack? Becouse my have a mistake, becouse it interpreters reinforcments as attackers. But i am looking for internacional solution that works on every server. :D

Be cool be travian. :(

Link to comment
Share on other sites

There is a table in dorf 1 that have the troop movement.

Fist i test if there is any incoming, then i test if its an attack. but I need the corresponding "attack" string from the language.

I use a file to store that kind of data.

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Link to comment
Share on other sites

Heres a snippet on how i test for inncomming / outgoing.

$oTable = _IETableGetCollection ($oIE, 1)
    $aTableData = _IETableWriteToArray ($oTable)
    
    
    If UBound($aTableData,1) = 5  And UBound($aTableData,2) > 0 Then
    ;Troop activity checking.
    
        For $i = 1 To UBound($aTableData,2)
            
            If StringInStr($aTableData[1][$i-1],"»") = 1 And StringInStr($aTableData[2][$i-1],"Angrep") = 1 Then
                relogin($oIE,StringRegExpReplace($aTableData[4][$i-1],"\D",""))
;~              ConsoleWrite("<< Inncomming attack: " & $aTableData[4][$i-1] & @CRLF) ;But this should not be a problem as my bot is allready farming someone.
                If StringRegExpReplace($aTableData[4][$i-1],"\D","") < 500 Then
                    $evade = 1
;~                  $wait[2] = 0
;~                  ConsoleWrite("Im under attack and will now send away my troops." & @CRLF)
                EndIf
            EndIf
            
            If StringInStr($aTableData[1][$i-1],"»") = 1 And StringInStr($aTableData[2][$i-1],"Forsterkninger") = 1 Then
                relogin($oIE,StringRegExpReplace($aTableData[4][$i-1],"\D",""))
    ;~          ConsoleWrite("<< Reinforcements: " & $aTableData[4][$i-1] & @CRLF)
                Build($oIE)
;~              Return
            EndIf
            
            If StringInStr($aTableData[1][$i-1],"«") = 1 Then
                relogin($oIE,StringRegExpReplace($aTableData[4][$i-1],"\D",""))
    ;~          ConsoleWrite(">> Attacking: " & $aTableData[4][$i-1] & @CRLF)
                Build($oIE)
;~              Return
            EndIf
        Next
    
    EndIf
Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

There is a table in dorf 1 that have the troop movement.

Fist i test if there is any incoming, then i test if its an attack. but I need the corresponding "attack" string from the language.

I use a file to store that kind of data.

I have exatly same thing but in diffrent languages are diffrent options, so i am looking for something that doesnt connect to specified language.

Heres a snippet on how i test for inncomming / outgoing.

$oTable = _IETableGetCollection ($oIE, 1)
    $aTableData = _IETableWriteToArray ($oTable)
    
    
    If UBound($aTableData,1) = 5  And UBound($aTableData,2) > 0 Then
    ;Troop activity checking.
    
        For $i = 1 To UBound($aTableData,2)
            
            If StringInStr($aTableData[1][$i-1],"»") = 1 And StringInStr($aTableData[2][$i-1],"Angrep") = 1 Then
                relogin($oIE,StringRegExpReplace($aTableData[4][$i-1],"\D",""))
;~              ConsoleWrite("<< Inncomming attack: " & $aTableData[4][$i-1] & @CRLF) ;But this should not be a problem as my bot is allready farming someone.
                If StringRegExpReplace($aTableData[4][$i-1],"\D","") < 500 Then
                    $evade = 1
;~                  $wait[2] = 0
;~                  ConsoleWrite("Im under attack and will now send away my troops." & @CRLF)
                EndIf
            EndIf
            
            If StringInStr($aTableData[1][$i-1],"»") = 1 And StringInStr($aTableData[2][$i-1],"Forsterkninger") = 1 Then
                relogin($oIE,StringRegExpReplace($aTableData[4][$i-1],"\D",""))
    ;~          ConsoleWrite("<< Reinforcements: " & $aTableData[4][$i-1] & @CRLF)
                Build($oIE)
;~              Return
            EndIf
            
            If StringInStr($aTableData[1][$i-1],"«") = 1 Then
                relogin($oIE,StringRegExpReplace($aTableData[4][$i-1],"\D",""))
    ;~          ConsoleWrite(">> Attacking: " & $aTableData[4][$i-1] & @CRLF)
                Build($oIE)
;~              Return
            EndIf
        Next
    
    EndIf
If i understand right you are using a words to? "Forsterkninger"? << Reinforcements: ?

My code to attack detect:

Func attacktime();==> Gets attack time from source code
$oTable = _IETableGetCollection ($oIE,1)
$aTableData = _IETableWriteToArray ($oTable, True)
$i = $aTableData[0][1]
$attack = "» 1"
$AttackTime = "0:00:01"
if $i == $attack Then
    $AttackTime = $aTableData[0][4]
    $AttackTime = StringReplace( $attackTime, " ", "")
    $AttackTime = StringReplace( $attackTime, "h", "")
EndIf
ConsoleWrite("Attack in:"&$attacktime&@CR)
Return $AttackTime
EndFunc

I am using "» 1" from table to get attack, but it works for reinforcmets to.

Here i am adding one function i made to put all my resources in army if i get attack.

Global $link4 = "http://speed.travian.si/build.php?gid=20";==> link for stable

Func build_max_stable ()
$oIE = _IECreate ($link4, 0, 1)
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended

ConsoleWrite($iNumLinks&@CR) 
_IELinkClickByIndex ($oIE, 17)

$oForm = _IEFormGetCollection ($oIE, 0)
_IEFormSubmit ($oForm)
_IEQuit($oIE)
EndFunc

This piece clicks first available option in a stable and makes maximum of calvary. Put it in escape bot and you have quick and simple way of preserving resources and putting it in army. :)

Be cool be travian. ;)

Edited by dumbledor
Link to comment
Share on other sites

here is my solution:

Func parseTownUnderAttack()
    
; navigate to "/dorf1.php"
    $Source = IEgetSource()
    
    If StringInStr($Source, "att1.gif") Or StringInStr($Source, "att3.gif") Then
       ;TrayTip("Achtung", "Das Dorf wird angegriffen!", 5)
        Return True
    EndIf
    
    Return False
    
EndFunc
Edited by littleNewb
Link to comment
Share on other sites

Thought id just share this, i think its pretty nice, if anyone needs a way to navigate through the pages fast and clean.

Func _Navigate($oIE,$link,$force = 0)
    If _IEPropertyGet ($oIE, "locationurl") <> $link Or _IEPropertyGet ($oIE, "busy") <> 0 Or $force = 1 Then
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "no")
        _IENavigate($oIE,$link)
        _IELoadWait($oIE)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "yes")
    EndIf
EndFunc

i use this inn every function where i need to double check if the right page is loaded, if not then navigate to it, but i can also force function to uppdate page if page is allready viewed.

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Hi jokke!

that is used in Jex example. but it didnt use it that way.

if i get it right, you are doing this to speed up page navigating. and still be able able to use explorer.

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Link to comment
Share on other sites

  • 2 weeks later...

Hi guys,

pretty nice work ... what i've seen so far.

While I've been reading, I thought of a list of features of each bot in progress / done. What you think about that? Would be a nice overview and also... for some it would be a good collection of ideas, what they might be willing to try next ;)

I admire everyone not to share his bot to the public! It will ruin the game in some degree... (not speaking of friends or allymates ^^).

I've just started programming a bot on my own.

What it does?

Farming ^^

The bot checks if enough spys are in town, then attack a usergiven list of farms (~100 so far). Also it checks new spyreports and "goes farming". It keeps in mind densize, trapscount, defending troops and farmable ressources. If everything is fine, it sends enough troops to "take care" of the available resources :) Also it auto-deletes all spyreports, I don't need to know.

I also had the idea of an attack-warning, but I would try to use "plus-feature" townlist, therefore I would need only 1 request process. Anyone did or can say "not possible"?

It should remind me by icq, sms, igm or ^^ a phone-call ^^ (if i wish to... to propably wake me up) <- therefore it should check if its worth to wake me up^^

I'll do a cue-list like most of you already did, but there are only 2 possibilities for me: First one... I choose what to build next. Second one... topic related/optimized buildinglist (fastest growing/production optimized/fastest new town/culture point optimized)

Also I want to automate markets... there are a lot of features possible: feed off-/deff towns, auto-post-offers, auto delivery to towns in growing process etc.

I would NEVER do any timingscripts for attacking, in my opinion this is one of the aspects that marks "good players".

There are a lot more ideas in my head, I've been playing for a couple of years now... and can't quit with travian ^:D Therefore I need something to "cure" my leisuretime.

At least... I've sometimes read "anti-bot-detection" ... does someone of you REALLY know IF there is any recognition of this? If so, how is it surveilled? I only know the "Your acc is temporarily disabled. You clicked too fast, this ends in a couple of seconds. If this lasts, pls contact..."

Greetz, mrbijou

btw a hint: I would prefer using field-id instead of coordinates !

btw^2: Anyone spoke of a crop-finder, how did u managed it? I use the "inner view" to check if its 9 or 15 crops... no matter if its empty or already seattled.

Edited by mrbijou
Link to comment
Share on other sites

Public. Neads translation :) No coments no adds. If you good enuog it will work for you ;)

auto atack, Build list quea. All is doen just work aruond to make all functions workinkg. :D

to make all buttons work neads abuot 20 lines :(

functions_v3.au3

Global $oIE, $hListView_0[255]

Func inital_starup()
Global $hListView_0, $Link = InputBox("Serveris", "Serveris","http://s3.travian.lt"), $User = InputBox("Varototojas", "Vartotojo vardas",""), $Pass = InputBox("Varototojas", "Vartotojo slaptazodis", "","*")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "yes")
Global $oIE = _IECreate($Link, 1, 1)
_IENavigate ($oIE, $Link)
Login($User, $Pass)
data_update()
EndFunc


Func data_update()
_IENavigate ($oIE, $Link & "/dorf1.php")

;~ $oTable = _IETableGetCollection ($oIE, 0)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "0")
;~ $oTable = _IETableGetCollection ($oIE, 1)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "1")
;~ $oTable = _IETableGetCollection ($oIE, 2)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "2")
;~ $oTable = _IETableGetCollection ($oIE, 3)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "3")
;~ $oTable = _IETableGetCollection ($oIE, 4)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "4")
;~ $oTable = _IETableGetCollection ($oIE, 5)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "5")
;~ $oTable = _IETableGetCollection ($oIE, 6)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "6")
;~ $oTable = _IETableGetCollection ($oIE, 7)
;~ $aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "7")

    
Global $Label1, $Label4, $Label6, $Label8, $Label11, $Label12, $Label13, $Label16
;~ $Source = _IEDocReadHTML($oIE)
$Source = _INetGetSource($Link & "/dorf1.php")
;~ FW("souce",$Source)
$result = StringInStr($Source, "jimas:")
;~ MsgBox(1, "pulimas", $result )

if $result = 0 Then
$puolimas = 0
else 
$puolimas = 1   
EndIf


$oTable = _IETableGetCollection ($oIE, 1+$puolimas)
$aTableData2 = _IETableWriteToArray ($oTable, True)
$line = $aTableData2[0][2]
GUICtrlSetData($Label1,$line)

$line = $aTableData2[1][2]
GUICtrlSetData($Label4,$line)

$line = $aTableData2[2][2]
GUICtrlSetData($Label6,$line)

$line = $aTableData2[3][2]
GUICtrlSetData($Label8,$line)


$Source = _IEDocReadHTML($oIE)
$data = _StringBetween($Source, '<a href="?newdid=', '</a>')
if Not @Error Then
;~  ------------------------------------> JEIGU YRA DAUGIAU MIESTU
$oTable = _IETableGetCollection ($oIE, 2+$puolimas)
$aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "Armija")


$Source = _IEDocReadHTML($oIE)
$result = StringInStr($Source, "Statybos pabaiga")
if $result = 0 Then
$statybos = 0
else 
$statybos = 1   
EndIf

If $statybos = 0 Then
$line = ""
GUICtrlSetData($Label17,$line)
$oTable = _IETableGetCollection ($oIE, 3+$puolimas)
$aTableData3 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData3, "Miestai")
$kiek_miestu = UBound($aTableData3)+1
$oTable = _IETableGetCollection ($oIE, $kiek_miestu+3+$puolimas)
$aTableData3 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData3, "sandelis arba statybos 3")
$oTable = _IETableGetCollection ($oIE, $kiek_miestu+4+$puolimas)
$aTableData4 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData4, "jei statybos sandelis")

                Else
$oTable = _IETableGetCollection ($oIE, 4+$puolimas)
$aTableData3 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData3, "Miestai")
$kiek_miestu = UBound($aTableData3)+1


$oTable = _IETableGetCollection ($oIE, 3+$puolimas)
$aTableData3 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData3, "statybos")

$oTable = _IETableGetCollection ($oIE, $kiek_miestu+4+$puolimas)
$aTableData4 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData4, "sandelis")
EndIf
    

If $statybos = 0 Then
    $line = ""
GUICtrlSetData($Label17,$line)
$line = $aTableData3[0][1]
GUICtrlSetData($Label11,$line)
$line = $aTableData3[0][3]
GUICtrlSetData($Label12,$line)
$line = $aTableData3[0][5]
GUICtrlSetData($Label13,$line)
$line = $aTableData3[0][7] & " " & $aTableData3[0][8]
GUICtrlSetData($Label16,$line)
EndIf
If $statybos = 1 Then
$line = "Statoma: " & $aTableData3[0][1] & @CRLF & "Baigimo laikas: " & $aTableData3[0][3]
GUICtrlSetData($Label17,$line)
$line = $aTableData4[0][1]
GUICtrlSetData($Label11,$line)
$line = $aTableData4[0][3]
GUICtrlSetData($Label12,$line)
$line = $aTableData4[0][5]
GUICtrlSetData($Label13,$line)
$line = $aTableData4[0][7] & " " & $aTableData4[0][8]
GUICtrlSetData($Label16,$line)
EndIf

Else
;~ ------------------------------------> Jeigu nera daugiau miestu
$oTable = _IETableGetCollection ($oIE, 2+$puolimas)
$aTableData2 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData2, "Armija")
$oTable = _IETableGetCollection ($oIE, 3+$puolimas)
$aTableData3 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData3, "Sandelis arba Statybos")
$oTable = _IETableGetCollection ($oIE, 4+$puolimas)
$aTableData4 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData4, "Jei vyksta statybos tada sandelis")
$oTable = _IETableGetCollection ($oIE, 5+$puolimas)
$aTableData5 = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData5, "belekas")
if IsArray($aTableData4) Then
$statybos = 1
else 
$statybos = 0   
EndIf
If $statybos = 0 Then
        $line = ""
GUICtrlSetData($Label17,$line)
$line = $aTableData3[0][1]
GUICtrlSetData($Label11,$line)
$line = $aTableData3[0][3]
GUICtrlSetData($Label12,$line)
$line = $aTableData3[0][5]
GUICtrlSetData($Label13,$line)
$line = $aTableData3[0][7] & " " & $aTableData3[0][8]
GUICtrlSetData($Label16,$line)
EndIf
If $statybos = 1 Then
$line = "Statoma: " & $aTableData3[0][1] & @CRLF & "Baigimo laikas: " & $aTableData3[0][3]
GUICtrlSetData($Label17,$line)
$line = $aTableData4[0][1]
GUICtrlSetData($Label11,$line)
$line = $aTableData4[0][3]
GUICtrlSetData($Label12,$line)
$line = $aTableData4[0][5]
GUICtrlSetData($Label13,$line)
$line = $aTableData4[0][7] & " " & $aTableData4[0][8]
GUICtrlSetData($Label16,$line)
EndIf
EndIf
EndFunc


func get_buldings_kaimas()
_IENavigate($oIE ,$Link & "/dorf1.php")
$Source = _IEDocReadHTML($oIE)
$data2 = _StringBetween($Source, '<MAP name=rx>', '</map>')
$buldings_name = _StringBetween($data2[0], '<AREA title="', '" shape=')
$buldings_link = _StringBetween($data2[0], 'href="', '">')
Dim $ret_rray[UBound($buldings_name)][3]
For $r = 0 to UBound($buldings_name)-1 
    $ret_rray[$r][0] = $buldings_name[$r]
    $ret_rray[$r][1] = $buldings_link[$r]
Next
return $ret_rray
EndFunc

Func get_buldings_miestas()
_IENavigate($oIE ,$Link & "/dorf2.php")
$Source = _IEDocReadHTML($oIE)
$data = _StringBetween($Source, '<MAP name=map2>', '</map>')
$data2 = _StringBetween($Source, '<MAP name=map1>', '</map>')
$buldings_name = _StringBetween($data2[0], '<AREA title="', '" shape=')
$buldings_link = _StringBetween($data2[0], 'href="', '">')
Dim $ret_rray[UBound($buldings_name)][3]
For $r = 0 to UBound($buldings_name)-1 
    $ret_rray[$r][0] = $buldings_name[$r]
    $ret_rray[$r][1] = $buldings_link[$r]
Next
return $ret_rray
EndFunc

Func FW($filename, $data)
$file = FileOpen($filename, 1)
; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
FileWrite($file, $data & @CRLF)
FileClose($file)
EndFunc


Func Login($Username, $Password)
    $oForm = _IEFormGetCollection($oIE, 0)
    $oQuery = _IEFormElementGetCollection($oForm, 2)
    _IEFormElementSetValue($oQuery, $Username)
    $oQuery = _IEFormElementGetCollection($oForm, 3)
    _IEFormElementSetValue($oQuery, $Password)
    _IEFormSubmit($oForm)
    $Source = _IEDocReadHTML($oIE)
    If Not StringInStr($Source, '<DIV id=ltime>Atnaujinta per <B>') Then
        MsgBox("", "Error!", "Vartotojo vardas arba slaptazodis blogi!")
        Exit
    EndIf
EndFunc

Func build_menu($array)
    Global $selitemd 
$list = ""
$Build = GUICreate("Statom", 244, 282, 331, 166)
GUICtrlCreateLabel("Statybos",100,3,230)
Global $List1 = GUICtrlCreateListView("", 8, 33, 225, 193)
    _GUICtrlListView_InsertColumn($List1, 0, "Pavadinimas", 200)
    _GUICtrlListView_InsertColumn($List1, 1, "Link", 1)
For $r=0 to UBound($array)-1
If NOT StringInStr($array[$r][0], "statybos") Then
    $selitemd = GUICtrlCreateListViewItem($array[$r][0] &"|"&$array[$r][1],$List1)
EndIf
Next
GUICtrlSetData($List1, $list)
$Button1 = GUICtrlCreateButton("Statyti", 8, 232, 227, 17, 0)
$Button2 = GUICtrlCreateButton("Atgal", 8, 256, 227, 17, 0)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Build)
            list_watch()
            ExitLoop
        Case $Button2
            GUIDelete($Build)
            list_watch()
            ExitLoop
        Case $Button1
            $selitem =GUICtrlRead(GUICtrlRead($List1))          
;~          _GUICtrlListView_GetItemText($List1, 1)
            add_upgrade($selitem, $array)
    EndSwitch
WEnd
EndFunc


func list_watch()
    Global $hListView
$aItem = _GUICtrlListView_GetItemTextArray ($hListView, 0)
start_building_upgrade("dorf1.php", $aItem[5])
$Source = _INetGetSource($Link & "/dorf1.php")
$result = StringInStr($Source, "iuo metu statoma")
if $result = 0 Then
            If start_building_upgrade($aItem[3], "Statyti") = 1 Then
                _GUICtrlListView_DeleteItem($hListView,0)
                data_update()
            EndIf
EndIf
EndFunc

func miestai_list()
    $combo_dat = ""
;~ _IENavigate($oIE ,$Link & "/dorf1.php")
$Source = _INetGetSource($Link & "/dorf1.php")
;~ $Source = _IEDocReadHTML($oIE)
$Source = StringReplace($Source, ' class="active_vl"', '')
$data = _StringBetween($Source, '<a href="?newdid=', '</a>')
;~ _ArrayDisplay($data,"Gyvenvietes")
if Not @Error Then
Dim $ret_rray[UBound($data)][3]
For $r = 0 to UBound($data)-1
$miestu_list = StringSplit($data[$r], '">', 1)  
    $ret_rray[$r][0] = $miestu_list[1]
    $ret_rray[$r][1] = $miestu_list[2]
    $combo_dat = $combo_dat & "|" & $miestu_list[2]
Next
GUICtrlSetData($Combo1, $combo_dat)
if GUICtrlRead($Combo1) = "" Then
start_building_upgrade("dorf1.php", $miestu_list[2])
GUICtrlSetData($Combo1, $miestu_list[2])
    EndIf
return $ret_rray
EndIf
EndFunc

Func Time_t()
$time_is_noe = @HOUR&":"&@MIN
Return $time_is_noe
EndFunc

Func add_upgrade($name, $array)
    $datas = StringSplit($name, "|")
Global $List1, $hListView_0
For $r=0 to UBound($array)-1
If StringReplace($array[$r][1], "|", "") = StringReplace($datas[2], "|", "") Then
;~ $linej = $r &"|"& $array[$r][0] &"|"& $array[$r][1] &"|"& Time_t() & "|" & GUICtrlRead($Combo1)
$countf =_GUICtrlListView_GetItemCount($hListView)
_GUICtrlListView_AddItem ($hListView, $r)
    _GUICtrlListView_AddSubItem ($hListView, $countf, $array[$r][0], 1)
    _GUICtrlListView_AddSubItem ($hListView, $countf, $array[$r][1], 2)
    _GUICtrlListView_AddSubItem ($hListView, $countf, Time_t(), 3)
    _GUICtrlListView_AddSubItem ($hListView, $countf, GUICtrlRead($Combo1), 4)
EndIf
Next
EndFunc



Func start_building_upgrade($page, $name)
_IENavigate($oIE ,$Link & "/" & $page)
;~ _IELinkClickByText ($oIE, $name)
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $name) Then
        _IELinkClickByText ($oIE, $sLinkText)
        Return 1
        ExitLoop
    EndIf
Next
EndFunc



func a2b()
Dim $ret_rray[26][2]
_IENavigate($oIE, $Link & "/a2b.php")

$oTable = _IETableGetCollection ($oIE, 2)
$aTableData = _IETableWriteToArray ($oTable, True)
;~ _ArrayDisplay($aTableData)

;~ Input_name


#Region ### START Koda GUI section ### Form=
$Form_a2b = GUICreate("Armijos atutomatizavimas! Sio lango prasau neuzdaryti Jeigu norit kad vyktu puldinejimas!", 409, 164, 234, 154)
$T1 = GUICtrlCreateInput("", 8, 8, 41, 21)
$T2 = GUICtrlCreateInput("", 8, 32, 41, 21)
$T4 = GUICtrlCreateInput("", 56, 8, 41, 21)
$T7 = GUICtrlCreateInput("", 104, 8, 41, 21)
$T9 = GUICtrlCreateInput("", 152, 8, 41, 21)
$T5 = GUICtrlCreateInput("", 56, 32, 41, 21)
$T8 = GUICtrlCreateInput("", 104, 32, 41, 21)
$T10 = GUICtrlCreateInput("", 152, 32, 41, 21)
$T3 = GUICtrlCreateInput("", 8, 56, 41, 21)
$T6 = GUICtrlCreateInput("", 56, 56, 41, 21)
$dname = GUICtrlCreateInput("", 336, 8, 57, 21)
$Label1 = GUICtrlCreateLabel("Gyvenviete:", 248, 8, 84, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$C2 = GUICtrlCreateRadio("Pastiprinimas", 208, 32, 81, 17)
$C3 = GUICtrlCreateRadio("Ataka", 208, 56, 81, 17)
$C4 = GUICtrlCreateRadio("Reidas", 208, 80, 81, 17)
$Label2 = GUICtrlCreateLabel("arba", 344, 32, 25, 17)
$X = GUICtrlCreateInput("", 344, 48, 25, 21)
$Y = GUICtrlCreateInput("", 344, 80, 25, 21)
$Label3 = GUICtrlCreateLabel("X:", 320, 48, 19, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Label4 = GUICtrlCreateLabel("Y:", 320, 80, 19, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$intervalas = GUICtrlCreateInput("", 80, 104, 33, 21)
$Label5 = GUICtrlCreateLabel("Kartoti kas", 8, 104, 72, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Label6 = GUICtrlCreateLabel("minuciu", 120, 104, 51, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Button1 = GUICtrlCreateButton("Pradeti", 224, 120, 145, 25, 0)
$kiek = GUICtrlCreateInput("", 56, 128, 33, 21)
$Label7 = GUICtrlCreateLabel("Kartoti", 8, 128, 46, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Label8 = GUICtrlCreateLabel("kartu", 96, 128, 37, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;~ StringReplace(StringReplace(,"(",""),")","")

GUICtrlSetData($T1, StringReplace(StringReplace($aTableData[0][2],"(",""),")",""))
GUICtrlSetData($T2, StringReplace(StringReplace($aTableData[1][2],"(",""),")",""))
GUICtrlSetData($T3, StringReplace(StringReplace($aTableData[2][2],"(",""),")",""))

GUICtrlSetData($T4, StringReplace(StringReplace($aTableData[0][5],"(",""),")",""))
GUICtrlSetData($T5, StringReplace(StringReplace($aTableData[1][5],"(",""),")",""))
GUICtrlSetData($T6, StringReplace(StringReplace($aTableData[2][5],"(",""),")",""))

GUICtrlSetData($T7, StringReplace(StringReplace($aTableData[0][8],"(",""),")",""))
GUICtrlSetData($T8, StringReplace(StringReplace($aTableData[1][8],"(",""),")",""))

GUICtrlSetData($T9, StringReplace(StringReplace($aTableData[0][11],"(",""),")",""))
GUICtrlSetData($T10, StringReplace(StringReplace($aTableData[1][11],"(",""),")",""))

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form_a2b)
            ExitLoop
        Case $Button1
            
            for $r=1 to GUICtrlRead($kiek)
                
_IENavigate($oIE, $Link & "/a2b.php")
_IELoadWait ($oIE)
$o_form = _IEFormGetObjByName($oIE, "snd")
                
$c = 0 

If BitAND(GUICtrlRead($C2), $GUI_CHECKED) = $GUI_CHECKED Then
    _IEFormElementRadioSelect ($o_form, "2", "c", 1, "byValue")
    $c = 1
EndIf
If BitAND(GUICtrlRead($C3), $GUI_CHECKED) = $GUI_CHECKED Then
    _IEFormElementRadioSelect ($o_form, "3", "c", 1, "byValue")
    $c = 1
EndIf
If BitAND(GUICtrlRead($C4), $GUI_CHECKED) = $GUI_CHECKED Then
    _IEFormElementRadioSelect ($o_form, "4", "c", 1, "byValue")
    $c = 1
EndIf

if $c <> 1 Then
_IEFormElementRadioSelect ($o_form, "3", "c", 1, "byValue")
EndIf
; get pointers to the login form and username and password fields
$o_t1 = _IEFormElementGetObjByName($o_form, "T1")
$o_t2 = _IEFormElementGetObjByName($o_form, "T2")
$o_t3 = _IEFormElementGetObjByName($o_form, "T3")
$o_t4 = _IEFormElementGetObjByName($o_form, "T4")
$o_t5 = _IEFormElementGetObjByName($o_form, "T5")
$o_t6 = _IEFormElementGetObjByName($o_form, "T6")
$o_t7 = _IEFormElementGetObjByName($o_form, "T7")
$o_t8 = _IEFormElementGetObjByName($o_form, "T8")
$o_t9 = _IEFormElementGetObjByName($o_form, "T9")
$o_t10 = _IEFormElementGetObjByName($o_form, "T10")
$o_dname = _IEFormElementGetObjByName($o_form, "dname")
$o_x = _IEFormElementGetObjByName($o_form, "x")
$o_y = _IEFormElementGetObjByName($o_form, "y")
; Set field values and submit the form
_IEFormElementSetValue($o_t1, gr($T1))
_IEFormElementSetValue($o_t2, gr($T2))
_IEFormElementSetValue($o_t3, gr($T3))
_IEFormElementSetValue($o_t4, gr($T4))
_IEFormElementSetValue($o_t5, gr($T5))
_IEFormElementSetValue($o_t6, gr($T6))
_IEFormElementSetValue($o_t7, gr($T7))
_IEFormElementSetValue($o_t8, gr($T8))
_IEFormElementSetValue($o_t7, gr($T9))
_IEFormElementSetValue($o_t8, gr($T10))
_IEFormElementSetValue($o_dname, gr($dname))
_IEFormElementSetValue($o_x, gr($X))
_IEFormElementSetValue($o_y, gr($Y))
_IEFormSubmit($o_form)
_IELoadWait ($oIE)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormSubmit ($oForm)
                
            $begin = TimerInit()
While 1
    $dif = TimerDiff($begin)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form_a2b)
            $r = GUICtrlRead($kiek)
            ExitLoop
    EndSwitch

    if $dif > GUICtrlRead($intervalas)*1000*60 Then
        ExitLoop
;~      cw("Kariu puolimai baikti!")
    EndIf
WEnd
            Next
            
    EndSwitch
WEnd
EndFunc

func gr($id)
return GUICtrlRead($id)
EndFunc

travian_v3.au3

#include <GUIConstants.au3>

#include <IE.au3>

#include <INet.au3>

#include <String.au3>

#include <Array.au3>

#include <functions_v3.au3>

#Include <GuiListView.au3>

#include <GuiConstantsEx.au3>

$Debug_LV = False

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Romualda\My Documents\slau\graph\AForm1_v3.kxf

$Form1 = GUICreate("Travian auto", 625, 500, 193, 115)

$Group1 = GUICtrlCreateGroup("Gavimas", 16, 8, 233, 89)

Global $Label1 = GUICtrlCreateLabel("M", 72, 24, 165, 17)

$Label2 = GUICtrlCreateLabel("Mediena", 24, 24, 45, 17)

$Label3 = GUICtrlCreateLabel("Molis", 24, 40, 28, 17)

$Label5 = GUICtrlCreateLabel("Gelezis", 24, 56, 38, 17)

$Label7 = GUICtrlCreateLabel("Grudai", 24, 72, 35, 17)

Global $Label4 = GUICtrlCreateLabel("M", 72, 40, 165, 17)

Global $Label6 = GUICtrlCreateLabel("M", 72, 56, 165, 17)

Global $Label8 = GUICtrlCreateLabel("M", 72, 72, 165, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Karuomine", 16, 208, 233, 65)

$Button1 = GUICtrlCreateButton("Puldinejimas", 24, 232, 107, 25, 0)

$Button2 = GUICtrlCreateButton("Gamyba", 136, 232, 99, 25, 0)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group3 = GUICtrlCreateGroup("Sandelis", 16, 104, 233, 97)

$Label9 = GUICtrlCreateLabel("Molis", 24, 136, 28, 17)

$Label10 = GUICtrlCreateLabel("Mediena", 24, 120, 45, 17)

Global $Label11 = GUICtrlCreateLabel("M", 72, 120, 150, 17)

Global $Label12 = GUICtrlCreateLabel("M", 72, 136, 150, 17)

Global $Label13 = GUICtrlCreateLabel("M", 72, 152, 150, 17)

$Label14 = GUICtrlCreateLabel("Gelezis", 24, 152, 38, 17)

$Label15 = GUICtrlCreateLabel("Grudai", 24, 168, 35, 17)

Global $Label16 = GUICtrlCreateLabel("M", 72, 168, 150, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group4 = GUICtrlCreateGroup("Darbai", 264, 8, 353, 449)

Global $hListView = _GUICtrlListView_Create($Form1,"", 272, 24, 337, 401,$LVS_REPORT,$LVS_EX_FULLROWSELECT)

$Button5 = GUICtrlCreateButton("Pasalinti pazymeta", 296, 432, 289, 17, 0)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group5 = GUICtrlCreateGroup("Statybos", 16, 280, 233, 65)

$Button3 = GUICtrlCreateButton("Kaimas", 24, 304, 107, 25, 0)

$Button4 = GUICtrlCreateButton("Miestas", 136, 304, 99, 25, 0)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group6 = GUICtrlCreateGroup("Statybos", 16, 352, 233, 73)

$Label17 = GUICtrlCreateLabel("NEVEIKIA", 30, 365, 200, 40)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group7 = GUICtrlCreateGroup("Gyvenviete", 16, 432, 233, 65)

$Button6 = GUICtrlCreateButton("Keisti", 43, 474, 179, 17, 0)

Global $Combo1 = GUICtrlCreateCombo("", 27, 450, 209, 25)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

inital_starup()

;~ _ArrayDisplay(get_buldings_miestas(), "")

;~ _ArrayDisplay(get_buldings_kaimas(), "")

; Add columns

_GUICtrlListView_InsertColumn($hListView, 0, "ID", 30)

_GUICtrlListView_InsertColumn($hListView, 1, "Pavadinimas", 150)

_GUICtrlListView_InsertColumn($hListView, 2, "Link", 50)

_GUICtrlListView_InsertColumn($hListView, 3, "Laikas", 70)

_GUICtrlListView_InsertColumn($hListView, 4, "Gyvenviete", 70)

; Add items

;~ _GUICtrlListView_AddItem ($hListView, "Row 1: Col 1", 0)

;~ _GUICtrlListView_AddItem ($hListView, "Row 2: Col 1", 1)

;~ _GUICtrlListView_AddItem ($hListView, "Row 3: Col 1", 2)

;~

miestai_list()

AdlibEnable("list_watch", 60000)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button3

build_menu(get_buldings_kaimas())

Case $Button4

build_menu(get_buldings_miestas())

Case $Button6

Global $miestas = GUICtrlRead($Combo1)

start_building_upgrade("dorf1.php", GUICtrlRead($Combo1))

data_update()

Case $Button5

_GUICtrlListView_DeleteItemsSelected($hListView)

Case $Button1

a2b()

EndSwitch

WEnd

Link to comment
Share on other sites

hooo. very good script.100% work (In http://s3.travian.lt).

I am translating for the english and portuguese.

tanks slaughter! o/

your welcome :) just when you donw with trlansation share with us it :)
Link to comment
Share on other sites

agree. I'm spending too much time with my script. I'll wait to see the tranlated script.

Meanwhile. I sent you a PM

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Link to comment
Share on other sites

Translated alredy? No? :/ Maybe I shuld do a translation file like multilangual?

It would be very appreciated, i can work with code and functions but languge is another problem. :) Thanks for sharing code and thanks in advance for sharing translation.

Be cool be travian. :)

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