Jump to content

Travian


Jex
 Share

Recommended Posts

I am learning autoit becouse i want to make my own travian bot. :) Between my spare time. So don t give hole code, just pieces to help and direct me. I like my own solutions. :P I found this topic very useful.

See you soon i hope. :blink:

Your nickname is very familiar, where are you from?

i came here with same purpose. after a while leaning Autoit, i tell.

Get some time, sit down with the examples and the compiler, and you will have a good time leaning how to make. i cant name it, or it will appear in all search engines. H0VV 2 M4KE a Tr4vi4n b0t

fell free to post your problems, suggestions, ideas.

Edit:

you can find usefull info here: http://dundats.mvps.org/AutoIt/AutoIt3_WebHelp/Index.htm

if you have any doubt on the includes, you can open them, they are in the INCLUDE folder, they have comments.

I used to build my own functions.

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

  • Replies 180
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted Image

I'm started Travian 3 days ago and now i'm not playing anymore. ( That mean i can't continue edit that script. My objective creating listbox for add buildings queue but now i can't. )

Near ".... per hour" showing how much time remained for that material reach maximum. ( Example in this ss for Woodcutter need 7:21 hour for lumbers reach full. )

If you press building buttons upgrading that building. ( If have enough material and workers not already working. )

If you press "Copy to clipboard" giving like that report about your village :

Lumber : 1922/3100 (3:34)

Clay : 1831/3100 (3:51)

Iron : 1715/3100 (4:59)

Crop : 1573/3100 (6:11)

Crop Consumption : 86/333

Lumber : 330 per hour

Clay : 330 per hour

Iron : 278 per hour

Crop : 247 per hour

Woodcutter level 4, 4, 4, 4

Clay Pit level 4, 4, 4, 4

Iron Mine level 3, 3, 4, 4

Cropland level 4, 4, 4, 3, 3, 3

I think that script will be good IE.au3 example :)

By the way im only tested that script in "http://speed.travian.com" and i think that script can't work with other languages. ( I'm tested with 3 diffrent account and working without problem in this server. )

Don't forget change that variables : $Link = "http://speed.travian.com", $User = "Test", $Pass = "123"

#include <IE.au3>
#include <INet.au3>
#include <GUIConstants.au3>
#include <String.au3>

Global $Link = "http://speed.travian.com", $User = "Test", $Pass = "123"
Global $Button[5][7], $Label[6], $Label2[5], $5Minute = 0, $TimerDiff = 0
$Form = GUICreate("Travian", 440, 214, 354, 445)
GUISetBkColor(0xFFFFFF)
$Pic1 = GUICtrlCreatePic("1.gif", 8, 15, 20, 15, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Pic2 = GUICtrlCreatePic("3.gif", 228, 15, 20, 15, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Pic3 = GUICtrlCreatePic("2.gif", 118, 15, 20, 15, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Pic4 = GUICtrlCreatePic("4.gif", 338, 15, 20, 15, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Pic5 = GUICtrlCreatePic("5.gif", 8, 167, 20, 15, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Label[1] = GUICtrlCreateLabel("", 38, 16, 80, 17)
$Label[2] = GUICtrlCreateLabel("", 148, 16, 80, 17)
$Label[3] = GUICtrlCreateLabel("", 258, 16, 80, 17)
$Label[4] = GUICtrlCreateLabel("", 368, 16, 80, 17)
$Label[5] = GUICtrlCreateLabel("", 38, 168, 80, 17)
$Label2[1] = GUICtrlCreateLabel("", 6, 32, 105, 17)
$Label2[2] = GUICtrlCreateLabel("", 116, 32, 105, 17)
$Label2[3] = GUICtrlCreateLabel("", 226, 32, 105, 17)
$Label2[4] = GUICtrlCreateLabel("", 336, 32, 105, 17)
$Button[1][1] = GUICtrlCreateButton("", 24, 56, 75, 25, 0)
$Button[1][2] = GUICtrlCreateButton("", 24, 80, 75, 25, 0)
$Button[1][3] = GUICtrlCreateButton("", 24, 104, 75, 25, 0)
$Button[1][4] = GUICtrlCreateButton("", 24, 128, 75, 25, 0)
$Label10 = GUICtrlCreateLabel("1.", 8, 64, 13, 17)
$Label11 = GUICtrlCreateLabel("2.", 8, 88, 13, 17)
$Label12 = GUICtrlCreateLabel("3.", 8, 112, 13, 17)
$Label13 = GUICtrlCreateLabel("4.", 8, 136, 13, 17)
$Button[2][1] = GUICtrlCreateButton("", 134, 56, 75, 25, 0)
$Button[2][2] = GUICtrlCreateButton("", 134, 80, 75, 25, 0)
$Button[2][3] = GUICtrlCreateButton("", 134, 104, 75, 25, 0)
$Button[2][4] = GUICtrlCreateButton("", 134, 128, 75, 25, 0)
$Label14 = GUICtrlCreateLabel("1.", 118, 64, 13, 17)
$Label15 = GUICtrlCreateLabel("2.", 118, 88, 13, 17)
$Label16 = GUICtrlCreateLabel("3.", 118, 112, 13, 17)
$Label17 = GUICtrlCreateLabel("4.", 118, 136, 13, 17)
$Button[3][1] = GUICtrlCreateButton("", 244, 56, 75, 25, 0)
$Button[3][2] = GUICtrlCreateButton("", 244, 80, 75, 25, 0)
$Button[3][3] = GUICtrlCreateButton("", 244, 104, 75, 25, 0)
$Button[3][4] = GUICtrlCreateButton("", 244, 128, 75, 25, 0)
$Label18 = GUICtrlCreateLabel("1.", 228, 64, 13, 17)
$Label19 = GUICtrlCreateLabel("2.", 228, 88, 13, 17)
$Label20 = GUICtrlCreateLabel("3.", 228, 112, 13, 17)
$Label21 = GUICtrlCreateLabel("4.", 228, 136, 13, 17)
$Button[4][1] = GUICtrlCreateButton("", 354, 56, 75, 25, 0)
$Button[4][2] = GUICtrlCreateButton("", 354, 80, 75, 25, 0)
$Button[4][3] = GUICtrlCreateButton("", 354, 104, 75, 25, 0)
$Button[4][4] = GUICtrlCreateButton("", 354, 128, 75, 25, 0)
$Button[4][5] = GUICtrlCreateButton("", 354, 152, 75, 25, 0)
$Button[4][6] = GUICtrlCreateButton("", 354, 176, 75, 25, 0)
$Label22 = GUICtrlCreateLabel("1.", 338, 64, 13, 17)
$Label23 = GUICtrlCreateLabel("2.", 338, 88, 13, 17)
$Label24 = GUICtrlCreateLabel("3.", 338, 112, 13, 17)
$Label25 = GUICtrlCreateLabel("4.", 338, 136, 13, 17)
$Label26 = GUICtrlCreateLabel("5.", 338, 160, 13, 17)
$Label27 = GUICtrlCreateLabel("6.", 338, 184, 13, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Auto Recheck", 96, 184, 97, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox2 = GUICtrlCreateCheckbox("Auto Relogin", 96, 168, 97, 17)
$Copy = GUICtrlCreateButton("Copy to clipboard", 200, 168, 123, 33, 0)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "no")
TrayTip("", "Loading...", 1)
$oIE = _IECreate($Link, 0, 0)
Login($User, $Pass)
Check()
TrayTip("", "", 0)
GUISetState(@SW_SHOW)

While 1
    $Timer = TimerInit()
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    For $x = 1 To 4
        For $y = 1 To 4
            If $msg = $Button[$x][$y] Then Build($x, $y)
        Next
    Next
    If $msg = $Button[4][5] Then Build(4, 5)
    If $msg = $Button[4][6] Then Build(4, 6)
    If $msg = $Copy Then Copy()
    $TimerDiff += TimerDiff($Timer)
    If $TimerDiff >= 5000 Then
        Checkbox()
        $TimerDiff = 0
    EndIf
WEnd

Func Check()
    $GetMaterials = GetMaterials()
    $GetProductions = GetProductions()
    $GetTimes = CalculateResourceTime()
    $GetResourceFields = GetResourceFields()
    For $i = 1 To 5
        GUICtrlSetData($Label[$i], $GetMaterials[$i][1] & " / " & $GetMaterials[$i][2])
        If $i <> 5 Then GUICtrlSetData($Label2[$i], $GetProductions[$i] & " per hour (" & $GetTimes[$i][3] & ")")
    Next
    For $x = 1 To 4
        For $y = 1 To 4
            GUICtrlSetData($Button[$x][$y], "Level " & $GetResourceFields[$x][$y])
            If $x = 4 And $y = 4 Then
                GUICtrlSetData($Button[$x][$y + 1], "Level " & $GetResourceFields[$x][$y + 1])
                GUICtrlSetData($Button[$x][$y + 2], "Level " & $GetResourceFields[$x][$y + 2])
            EndIf
        Next
    Next
EndFunc   ;==>Check

Func Checkbox()
    If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
        $5Minute += 1
        If $5Minute = 60 Then
            _IENavigate($oIE, $Link)
            Login($User, $Pass)
            $5Minute = 0
        EndIf
    EndIf
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then Check()
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>Calculated in <B>') Then
        MsgBox("", "Error!", "Username or password wrong.")
        Exit
    EndIf
EndFunc   ;==>Login

Func Build($xx, $yy)
    $Number = GetResourceNumbers()
    $GetSource = _INetGetSource($Link & "/build.php?id=" & $Number[$xx][$yy])
    If StringInStr($GetSource, "Too few resources") Then
        TrayTip("", "Too few resources!", 1)
    ElseIf StringInStr($GetSource, "The workers are already at work") Then
        TrayTip("", "The workers are already at work!", 1)
    Else
        $Between = _StringBetween($GetSource, '"dorf1.php?', '">')
        _IENavigate($oIE, $Link & "/dorf1.php?" & $Between[0])
        TrayTip("", "Building...", 1)
    EndIf
EndFunc   ;==>Build

Func Copy()
    _IENavigate($oIE, $Link & "/dorf1.php?")
    $Materials2 = ShowCalculatedTime()
    $Productions = ShowProductions()
    $ResourceFields = ShowResourceFields()
    ClipPut($Materials2 & @CRLF & @CRLF & $Productions[2] & @CRLF & @CRLF & $ResourceFields[2])
    SoundPlay(@WindowsDir & "\media\tada.wav")
EndFunc   ;==>Copy

Func GetMaterials()
    $Count = 0
    Do
        $oTable = _IETableGetCollection($oIE, $Count)
        $aTableData = _IETableWriteToArray($oTable)
        $Count += 1
    Until UBound($aTableData) = 9
    Local $Materials[6][3]
    $Split = StringSplit($aTableData[1][0], "/", 1)
    $Materials[1][1] = $Split[1]
    $Materials[1][2] = $Split[2]
    $Split = StringSplit($aTableData[3][0], "/", 1)
    $Materials[2][1] = $Split[1]
    $Materials[2][2] = $Split[2]
    $Split = StringSplit($aTableData[5][0], "/", 1)
    $Materials[3][1] = $Split[1]
    $Materials[3][2] = $Split[2]
    $Split = StringSplit($aTableData[7][0], "/", 1)
    $Materials[4][1] = $Split[1]
    $Materials[4][2] = $Split[2]
    $Split = StringSplit(StringReplace($aTableData[8][0], " ", ""), "/", 1)
    $Materials[5][1] = $Split[1]
    $Materials[5][2] = $Split[2]
    Return $Materials
EndFunc   ;==>GetMaterials

Func ShowMaterials()
    $Get = GetMaterials()
    Local $Materials[3], $Materials2[6]
    For $x = 1 To 5
        If $x = 1 Then
            $Materials[1] = $Get[$x][1] & "/" & $Get[$x][2]
        Else
            $Materials[1] &= ", " & $Get[$x][1] & "/" & $Get[$x][2]
        EndIf
        $Materials2[$x] = $Get[$x][1] & "/" & $Get[$x][2]
    Next
    $Materials[2] = "Lumber : " & $Materials2[1] & @CRLF & "Clay : " & $Materials2[2] & @CRLF & "Iron : " & $Materials2[3] & @CRLF & "Crop : " & $Materials2[4] & @CRLF & _
            "Crop Consumption : " & $Materials2[5]
    Return $Materials
EndFunc   ;==>ShowMaterials

Func GetProductions()
    $Count = 0
    Do
        $oTable = _IETableGetCollection($oIE, $Count)
        $aTableData = _IETableWriteToArray($oTable)
        $Count += 1
    Until UBound($aTableData) = 4
    Local $Productions[5]
    $Productions[1] = StringReplace($aTableData[2][0], " ", "")
    $Productions[2] = StringReplace($aTableData[2][1], " ", "")
    $Productions[3] = StringReplace($aTableData[2][2], " ", "")
    $Productions[4] = StringReplace($aTableData[2][3], " ", "")
    Return $Productions
EndFunc   ;==>GetProductions

Func ShowProductions()
    $Get = GetProductions()
    Local $Productions[3]
    $Productions[1] = $Get[1] & ", " & $Get[2] & ", " & $Get[3] & ", " & $Get[4]
    $Productions[2] = "Lumber : " & $Get[1] & " per hour" & @CRLF & "Clay : " & $Get[2] & " per hour" & @CRLF & "Iron : " & $Get[3] & " per hour" & @CRLF & "Crop : " & $Get[4] & " per hour"
    Return $Productions
EndFunc   ;==>ShowProductions

Func GetResourceFields()
    $Source = _IEDocReadHTML($oIE)
    $Areas = _StringBetween($Source, '<AREA title="', '" shape=CIRCLE')
    For $i = 0 To UBound($Areas) - 1
        $Areas[$i] = StringReplace($Areas[$i], "Woodcutter level ", "")
        $Areas[$i] = StringReplace($Areas[$i], "Clay Pit level ", "")
        $Areas[$i] = StringReplace($Areas[$i], "Iron Mine level ", "")
        $Areas[$i] = StringReplace($Areas[$i], "Cropland level ", "")
    Next
    Local $ResourceFields[5][7]
    $ResourceFields[1][1] = $Areas[0]
    $ResourceFields[1][2] = $Areas[2]
    $ResourceFields[1][3] = $Areas[13]
    $ResourceFields[1][4] = $Areas[16]
    $ResourceFields[2][1] = $Areas[4]
    $ResourceFields[2][2] = $Areas[5]
    $ResourceFields[2][3] = $Areas[15]
    $ResourceFields[2][4] = $Areas[17]
    $ResourceFields[3][1] = $Areas[3]
    $ResourceFields[3][2] = $Areas[6]
    $ResourceFields[3][3] = $Areas[9]
    $ResourceFields[3][4] = $Areas[10]
    $ResourceFields[4][1] = $Areas[1]
    $ResourceFields[4][2] = $Areas[7]
    $ResourceFields[4][3] = $Areas[8]
    $ResourceFields[4][4] = $Areas[11]
    $ResourceFields[4][5] = $Areas[12]
    $ResourceFields[4][6] = $Areas[14]
    Return $ResourceFields
EndFunc   ;==>GetResourceFields

Func GetResourceNumbers()
    Local $FieldNumbers[5][7]
    $FieldNumbers[1][1] = 1
    $FieldNumbers[1][2] = 3
    $FieldNumbers[1][3] = 14
    $FieldNumbers[1][4] = 17
    $FieldNumbers[2][1] = 5
    $FieldNumbers[2][2] = 6
    $FieldNumbers[2][3] = 16
    $FieldNumbers[2][4] = 18
    $FieldNumbers[3][1] = 4
    $FieldNumbers[3][2] = 7
    $FieldNumbers[3][3] = 10
    $FieldNumbers[3][4] = 11
    $FieldNumbers[4][1] = 2
    $FieldNumbers[4][2] = 8
    $FieldNumbers[4][3] = 9
    $FieldNumbers[4][4] = 12
    $FieldNumbers[4][5] = 13
    $FieldNumbers[4][6] = 15
    Return $FieldNumbers
EndFunc   ;==>GetResourceNumbers

Func ShowResourceFields()
    $ResourceFields = GetResourceFields()
    Local $Fields[3]
    For $i = 1 To 4
        For $y = 1 To 4
            If $i = 1 And $y = 1 Then
                $Fields[2] = "Woodcutter level " & $ResourceFields[$i][$y]
            ElseIf $i = 2 And $y = 1 Then
                $Fields[2] &= @CRLF & "Clay Pit level " & $ResourceFields[$i][$y]
            ElseIf $i = 3 And $y = 1 Then
                $Fields[2] &= @CRLF & "Iron Mine level " & $ResourceFields[$i][$y]
            ElseIf $i = 4 And $y = 1 Then
                $Fields[2] &= @CRLF & "Cropland level " & $ResourceFields[$i][$y]
            Else
                If $i = 4 And $y = 4 Then
                    $Fields[2] &= ", " & $ResourceFields[$i][$y + 1]
                    $Fields[2] &= ", " & $ResourceFields[$i][$y + 2]
                EndIf
                $Fields[2] &= ", " & $ResourceFields[$i][$y]
            EndIf
            If $i = 1 And $y = 1 Then
                $Fields[1] = $ResourceFields[$i][$y]
            Else
                $Fields[1] &= ", " & $ResourceFields[$i][$y]
            EndIf
        Next
    Next
    Return $Fields
EndFunc   ;==>ShowResourceFields

Func CalculateResourceTime()
    $Materials = GetMaterials()
    $Productions = GetProductions()
    Local $Time[5][4]
    For $i = 1 To 4
        $Minute = Round(($Materials[$i][2] - $Materials[$i][1]) / ($Productions[$i] / 60), 0)
        $Hour = 0
        Do
            $Minute -= 60
            $Hour += 1
        Until $Minute < 60
        If $Minute < 10 Then $Minute = "0" & $Minute
        $Time[$i][1] = $Hour
        $Time[$i][2] = $Minute
        $Time[$i][3] = $Time[$i][1] & ":" & $Time[$i][2]
    Next
    Return $Time
EndFunc   ;==>CalculateResourceTime

Func ShowCalculatedTime()
    $Materials = ShowMaterials()
    $Time = CalculateResourceTime()
    $Split = StringSplit($Materials[1], ", ", 1)
    $Text = "Lumber : " & $Split[1] & " (" & $Time[1][3] & ")" & @CRLF & "Clay : " & $Split[2] & " (" & $Time[2][3] & ")" & @CRLF & _
            "Iron : " & $Split[3] & " (" & $Time[3][3] & ")" & @CRLF & "Crop : " & $Split[4] & " (" & $Time[4][3] & ")" & @CRLF & _
            "Crop Consumption : " & $Split[5]
    Return $Text
EndFunc   ;==>ShowCalculatedTime

Func OnAutoItExit()
    _IEQuit($oIE)
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "yes")
EndFunc   ;==>OnAutoItExit

oks o ive posted my code!... its not very good scripting tho.. very noobish

Thank
Link to comment
Share on other sites

I might get myself involved in this, but I lack of experience. I'm only a few months old here.

Thanks nobbe for your general idea, I just don't know how you make those logics thats all. I might take a while to make it :).

Link to comment
Share on other sites

Your nickname is very familiar, where are you from?

i came here with same purpose. after a while leaning Autoit, i tell.

Get some time, sit down with the examples and the compiler, and you will have a good time leaning how to make. i cant name it, or it will appear in all search engines. H0VV 2 M4KE a Tr4vi4n b0t

fell free to post your problems, suggestions, ideas.

Edit:

you can find usefull info here: http://dundats.mvps.org/AutoIt/AutoIt3_WebHelp/Index.htm

if you have any doubt on the includes, you can open them, they are in the INCLUDE folder, they have comments.

I used to build my own functions.

I am from slovenia.

I just got started and now i am studyin basics about autoit (made some auto clicks, runing programs, itd.) Now i am studying how to read html source code. :P

Thanks for links and replay. I will take your word on problems, suggestions, ideas part. :)

I will post soon i hope.

Happy new year to everyone.

Link to comment
Share on other sites

I am from slovenia.

I just got started and now i am studyin basics about autoit (made some auto clicks, runing programs, itd.) Now i am studying how to read html source code. :P

Thanks for links and replay. I will take your word on problems, suggestions, ideas part. :)

I will post soon i hope.

Happy new year to everyone.

Nice, if you need some help pls post here.

Zepx asked me for a tip, and i will share with you this, you can embede the IE window with the following code:

$Link = 'http://s1.travian.com'

$oIE = ObjCreate("Shell.Explorer.2") ; create the, explorer object.

$Breaktime = GUICtrlCreateObj($oIE, 400, 2, 700, 650) ; create the, embeded, object control, with that coords.

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

_IELoadWait($oIE)

And I have a question. do i realy need that _IELoadWait($oIE) line? i try to play with the _IENAVIGATE WAIT parameter but I didnt got a working solution.

Happy new year everyone

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

most IE functions already wait for the page to load before continue so you don't need _IELoadWait

i see, but in most cases i have a

$Source = _IEDocReadHtml($oie)

next to the _IELoadWait, so the program dont crashes by getting an invalid $Source

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

just found this page...

i am also making a travian bot, but i prefer to call it a sitter.

currently it enables you to manage one account per server, supports two languages, with easy language-adding stuff.

it builds buildings, troops, upgrades lands, and it wil also upgrade the troops of your choice.

counters are visual so you can see when it fires up again, and also has the IE embedded, so you can play in in when it is not working for you.

resourcemovement is being worked on.

not finished however, so no code for now.

i need it to mail or page me when an attack is detected, and also i need it to have a mass-ingame-mailer... ;-)

coding is fun.

Link to comment
Share on other sites

Hi thijzzz!

Wellcome!

currently it enables you to manage one account per server, supports two languages, with easy language-adding stuff.

Can you tell me what languages are you using?

not finished however, so no code for now.

Im also developing, maybe we could share the code of our work. is it make in autoit3 from scrath?

i need it to mail or page me when an attack is detected, and also i need it to have a mass-ingame-mailer... ;-)

me 2! I have a role in my alliance, so i wish i could automate some tasks.

coding is fun. Yeah! nice hobby!

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

Well, as is the case with everyone else, i do not want to share my code, but on the other hand, autoit rules, and it is free too. so keeping it to myself would be a bit offensive.

so, i wont be dumping the entire thing here, but i can post some snippets of code if you want.

so start your own code, and i'll throw in some bits you miss.

Link to comment
Share on other sites

I see why noone want to make his bot public, and im doing the same, so we dont ruin the game.

here is a more recente screenshot

Edit: Forgot to click UPLOAD

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

Hey

I've just started Travian today and i working on a bot :D

I've started with the basic script on the first post and i'm improving it slowly ^^

Your bot seems to be very powerful xD

Can you give the source ? I would be very happy to help you to improve your bot :P

Very sorry for my poor english :S

Pollop.

Link to comment
Share on other sites

Hi! I am back. Still in the middle of my exams but manage to read trough all help autoit offers. I was reading forum and everything and i am about to start making my own personal super bot.

I tried and tested various skripts.

I am trying to make:

Tr@vi@n escape bot. How did any of you manage to make klick on the button for the all units? The green number?

Example:

post-30220-1200615971_thumb.jpg

I am trying to escape attack and i have to press the max number of different soldiers, but please do not give me hints with moving mouse cursor. I just need a little bit of direction how to make it without moving mouse or press any keys so the boot runs in background and i can do my work. Is it possilble? You can link me to topic on forum and i will read all the necesary data.

My basic code is coming in days i am still working on a koncept. :D

Keep in touch.

Link to comment
Share on other sites

Hi!

use this to list your the links in the page:

Func GetLinks()
    Local $link, $linkURL, $links = $oIE.document.links
    For $link In $links
        $linkURL = $link.href
        Output($linkURL & @CRLF)
    Next
EndFunc

Then you can choose one link, and simulate a click with the _IELinkClickByIndex

pls correct me if im wrong.

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

We are three in the process of developing the same thing ...

I think it's a pity that we did not put together to create a MEGA bot:)

I am working on an algorithm to optimize resources production.

It automatically chooses which building to build depending of many parameters.

(Again sry for my english :S)

Edited by pollop
Link to comment
Share on other sites

I tried and tested various skripts.

I am trying to make:

Tr@vi@n escape bot. How did any of you manage to make klick on the button for the all units? The green number?

basically you need to read out the max values for each table entry . then each gets a variable name and then enter all your wanted table data into the fields of your choice

first you need to find the Nr of the actual table

$oTable = _IETableGetCollection($oIE)
    $iNumTables = @extended

    ; _DebugPrint($edit_log, "ATTACK:: Nr of Tables on Travian: " & $iNumTables & @CRLF);

    ;
    $attack_troopinfo_table = 0; ;;;4

    For $run = 0 To $iNumTables
        $oTable = _IETableGetCollection($oIE, $run)
        $aTableData = _IETableWriteToArray($oTable)

        ;     _DebugPrint($edit_log, "ATTACK Tables run : " & $run & @CRLF);
        ;testing all array

        If (UBound($aTableData, 1) - 1) > 9 Then ; welche tabelle - die mit den meisten inhalten ?
            $attack_troopinfo_table = $run;
            _DebugPrint($edit_log, "ATTACK Tables run found = " & $run & @CRLF);


            ; _ArrayDisplay2D($aTableData, "ATTACK TABLE :: Run" & $run, 1, 0)
        EndIf



    Next  ; run ..


    $this_form_name = "snd";
    $form = _IEFormGetObjByName($oIE, $this_form_name); the form name
    _IELoadWait($oIE)

    ; DebugPrint ("FORM  : " & $form & @CRLF);

    #cs
        <div class="f10"><input type="Radio" name="c" value="2" checked>Unterstützung</div>
        <div class="f10"><input type="Radio" name="c" value="3" >Angriff: Normal</div>
        <div class="f10"><input type="Radio" name="c" value="4" >Angriff: Raubzug</div>
    #ce

    ; plündern = 4
    ; _IEFormElementRadioSelect($form, "4", "c")  ; name von dem ding  in der form ..
    ; atack normal =3 - gallier

    _IEFormElementRadioSelect($form, "3", "c")  ; name von dem ding  in der form ..

    $oTable = _IETableGetCollection($oIE, $attack_troopinfo_table); ok aber welchen nun ?
    ; $oTable1 = _IETableGetCollection($oIE, $attack_troopinfo_table-1); ok aber welchen nun ?
    $aTableData = _IETableWriteToArray($oTable) ; hier abfragen wieviel das sind ??

    $troop_values[1] = $aTableData[2][0];
    $troop_values[2] = $aTableData[2][1];
    $troop_values[3] = $aTableData[2][2];

    $troop_values[4] = $aTableData[5][0]; späher
    $troop_values[5] = $aTableData[5][1];
    $troop_values[6] = $aTableData[5][2];

    $troop_values[7] = $aTableData[8][0]; ramme
    $troop_values[8] = $aTableData[8][1]; kata
    ;$troop_val6 = $aTableData[5][2];

    $troop_values[9] = $aTableData[11][0]; stammi
    $troop_values[10] = $aTableData[11][1]; siedler
    $troop_values[11] = $aTableData[11][2]; hero


    ; kein angriff mit siedler and späher, held ,erstmal
    ;$troop_values[4] = 0 ;
    ;$troop_values[7] = 0 ; ramme
    ;$troop_values[8] = 0 ; kata
    ;$troop_values[10] = 0 ;  Siedler



    ; setting the values now
    For $irun = 1 To 11

        $troop_values[$irun] = StringReplace($troop_values[$irun], "(", "") ;
        $troop_values[$irun] = StringReplace($troop_values[$irun], ")", "") ;
        $form_edit_obj[$irun] = _IEFormElementGetObjByName($form, "t" & $irun); the form name of the ENTRY field name

        ; now set the values to fields
        _IEFormElementSetValue($form_edit_obj[$irun], $troop_values[$irun]);
    Next

    $x_coord = _IEFormElementGetObjByName($form, "x");
    $y_coord = _IEFormElementGetObjByName($form, "y");

    ; now set the values to fields
    _IEFormElementSetValue($x_coord, $attack_coords_x);
    _IEFormElementSetValue($y_coord, $attack_coords_y);
Link to comment
Share on other sites

basically you need to read out the max values for each table entry . then each gets a variable name and then enter all your wanted table data into the fields of your choice

i saw that, but after getting the max troops, I had no idea on how to place that value in that field.

thank you, i found you example very usefull.

About the Megabot. you have to convince the coder to free the code. if you play travian for some time, you will see that travian is not for everyone. and if the bot gets public, it will ruin the game. realy.

Respect, 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

We are three in the process of developing the same thing ...

I think it's a pity that we did not put together to create a MEGA bot:)

I am working on an algorithm to optimize resources production.

It automatically chooses which building to build depending of many parameters.

(Again sry for my english :S)

MEGA bot it is not such a good idea if every one would have it it would ruin the game like linux said i think. Everyone has to make it s own solutions. Here are the people who will gladly help you, so you can make your own MEGA bot and use it. :D

Ok here i post my first script, i gathered some ideas from around forum and make some repairs. can some one checks my skript and tell me what can i do better.

Ok here what skript does: It checks (if you have your account open in IE (i am still working on automatic log on :P)) when the attack is going to happend and puts out time in msg box.

#include <String.au3>
#include <File.au3>


InetGet("http://s1.travian.si/dorf1.php", "e:\test.txt");this works for slovenian travian server, here it gets html source code from the city you are having opend
                                                                            ;in IE, and save it in test.txt

$FilePath="e:\test.txt"; here put the path from above
$StringToSearch="Napad"; here you put the word on your server that is shown infront the attack time Napad = Attack
$CaseSense=0

$Lines=_FileCountLines($FilePath)
$hFile=FileOpen($FilePath,0)

;counting the lines where word Napad is
For $i=0 To Number($Lines)
    $Test=FileReadLine($hFile,$i)
    If StringInStr($Test,$StringToSearch,$CaseSense) Then
        $i = $i + 2; here i rise the $i for 2 becouse there is the line where attack time is.
        
        ExitLoop
    EndIf
Next



$html=FileReadLine ($hFile,$i);here i read line with attack time

; and downthere is the code that extract the time out of the script. I put two timers becouse maybe one is one if you are building a building during attack

$variable = _StringBetween($html,'timer2>','</span> h</td>')
if $variable = 0    Then 
    $variable = _StringBetween($html,'timer1>','</span> h</td>')
EndIf
MsgBox(0,"",$variable[0])

FileClose($hFile)

Hope i made this quite clear and understandable. More rational solutions would be appriciated, or just your thoughts about a script.

Thanks for your examples about clicking links, i will test it next week now i run and study for my exams.

Be cool be travian. ;)

Link to comment
Share on other sites

i did it differently

you need to adopt the strings "Truppenbewegungen" and "1Angriffin" to your language

;
            ;   figure out ifwe get atacked  (>>> Attack ..?? ..
            ;
            $my_text_ascii = _IEBodyReadText($oIE)
            ;MsgBox(0,"start page ",$my_text_ascii)

            ; we are attacked ??
            ;    Â» 1Angriffin38:36:42 Std.
            If StringInStr($my_text_ascii, "Truppenbewegungen:") > 0 And StringInStr($my_text_ascii, "» 1Angriffin") > 0 Then
                $return = _StringBetween($my_text_ascii, '» 1Angriffin', ' Std.', -1, 1)
                If @error <> 1 Then
                    ; MsgBox(0,"attack coming in ",$return[0]);; time to being attacked ??
                    _DebugPrint($edit_log, "attack coming in " & $return[0])
                EndIf
            EndIf
Link to comment
Share on other sites

About the Megabot. you have to convince the coder to free the code. if you play travian for some time, you will see that travian is not for everyone. and if the bot gets public, it will ruin the game. realy.

Respect, Linux

Yes I didn't think to that ^^

I am actually working an a construction list.

But i have some problems :S

I use a ListView but autoit sorts strings in the list box alphabetically.

How can i disable that ?

And how can i get the first line of my listview ? I can just get wich is selected but i want to get the text of the first item of my list. :D

Thanks all :P

And sry again for my english :S

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