Jump to content

Travian


Jex
 Share

Recommended Posts

So i made a AI for buidling stuff also, based off JEX's code i wont post it though since i do not want everyone botting, and the creator's (travian creators) creating some anti-bot code on their page, since browser games with anti-bot sux.

Anyways ill post a screeny if anyone are looking for ideas for their own bot:

post-16522-1200780832_thumb.png

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

  • Replies 180
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Nice scrrenshot :D

I have just a question. I saw that u have all the ressurces needed to uprade your buildings.

How do u get it ?

U use a big table with all the ressources needed for all levels or u get it in the source code ?

Thanks :P

Link to comment
Share on other sites

Nice scrrenshot :D

I have just a question. I saw that u have all the ressurces needed to uprade your buildings.

How do u get it ?

U use a big table with all the ressources needed for all levels or u get it in the source code ?

Thanks :P

Iwe got a ini file where those data are stored, if i where to not have the data, then script will load the page where those info are, and then download them, as you can read inn the console, "20:23:18 - Downloading tree data: Iron Mine Level 6".

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

Nice scrrenshot :D

I have just a question. I saw that u have all the ressurces needed to uprade your buildings.

How do u get it ?

U use a big table with all the ressources needed for all levels or u get it in the source code ?

Thanks :P

Hi!

pls check a previous post. there is an example of a formula to get the resources needed to all the resource upgrades. i guess you will have to figure ou the rest of the buildings.

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 dudes ^^

I worked all the day on my script ^^

I now have a "to build" list

It automaticly build buildings when it's possible :D

I will now work on a script that automaticly add buildings to the building list

Screenshot :

Posted Image

Edited by pollop
Link to comment
Share on other sites

So i made a AI for buidling stuff also, based off JEX's code i wont post it though since i do not want everyone botting, and the creator's (travian creators) creating some anti-bot code on their page, since browser games with anti-bot sux.

Anyways ill post a screeny if anyone are looking for ideas for their own bot:

I found your screen very interesting. can you share with us how did you manage the Building Tree in the gui?

about the color, they seen a little random.

this was digged in from a mozilla extension:

$store = Int($ACTUAL * 100 / $TOTALCAPACITY); Percentage used
        $tol=255;
        $sec=$tol-100-$store;
        if ($store<50) then $tol=150;
        $red=Int($tol*($store/100));
        $color =$sec + 256 * $sec + 65536* $red 

; I use this to redimension the bar, to reflect the relative capacity betwen Granary & Warehouse
        $Progress[$i] = GUICtrlCreateProgress(134, 136 + ($i * 24), $PLimit[$i], 17, $PBS_SMOOTH) 

        GUICtrlSetData($Progress[$i], $store)
        GUICtrlSetColor($Progress[$i],  $color)

Question, is there a way to redimension the progress bar?

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

I found your screen very interesting. can you share with us how did you manage the Building Tree in the gui?

+1

I tried to made a TreeView for the buildings but I didn't find how to make it :S

Is it a static TreeView or it will work with a village of 12 Corn Acre ?

Question, is there a way to redimension the progress bar?

Not sure to understand your question :S

$Max[1] = GUICtrlCreateProgress (20,64,430,15,$PBS_SMOOTH)

$Max[1] = GUICtrlCreateProgress (20,64, X_SIZING , Y_SIZING ,$PBS_SMOOTH)

But i don't think that u can resize it after creating it

Edited by pollop
Link to comment
Share on other sites

Hello. It is me again. :D I was doing some mathemathical operations to calculate time in seconds when the attack is going to happen.

Here is my code:

;I get out of travian source code number in this format 1 digit is hours, 2 and 3 are minutes, 4 and 5 are seconds

$= 12834; similar to attack time 1:28:34

;Translate hours to seconds and remove hour number
$shours = $num/10000
$shours = Floor($shours)
$num = $num-($sHours*10000)
$shours = $shours*3600

;Translate minutes to seconds and remove minute number
$sMinutes = $num/100
$sMinutes = Floor($sMinutes)
$num = $num-($sMinutes*100)
$sMinutes = $sMinutes*60

;Get seconds
$sSeconds = $num

;Get needed Time
$sTime = $sSeconds+$sMinutes+$sHours

MsgBox(0,"Seconds",$num)
MsgBox(0,"Minutes in seconds",$sMinutes)
MsgBox(0,"Hours in seconds",$sHours)
MsgBox(0,"Time together in seconds",$sTime)

Is there some shorter more compact solution? Some mathematical function i miss and would do faster and better job? Is there a function which can convert in seconds directly from format 1:28:34?

Thanks for answers.

Be cool be travian. :P

Link to comment
Share on other sites

Hello. It is me again. :D I was doing some mathemathical operations to calculate time in seconds when the attack is going to happen.

Here is my code:

Is there some shorter more compact solution? Some mathematical function i miss and would do faster and better job? Is there a function which can convert in seconds directly from format 1:28:34?

Thanks for answers.

Be cool be travian. :P

consolewrite(TimeToSec(1:2:3))

Func TimeToSec($time)

$Temp = StringSplit($time,":")

$seconds = Temp[0] * 3600 + Temp[1] * 60 + Temp[2]

return $seconds

endfunc

Edit: this was my func.

and i use this to get the current server time:


Func ServerTime()
    Local $s_text = ""
    ;ConsoleWrite($GetSource)
    If StringInStr($GetSource,"Hora do servidor: <SPAN class=b id=tp1>") Then
        $Aux = _StringBetween($GetSource, "Hora do servidor: <SPAN class=b id=tp1>", "</span")
        $s_text = $Aux[0]
    EndIf
    Return $s_text
EndFunc   ;ServerTime, You may have to change the string to meet your language. this will return the hour in HH:MM:ss

About the reverse, you have an example on the script i posted earlier.

;Floor gives a integer number, rounded down. its like removing the .decimal part of the number.
ConsoleWrite(SecToTime(50000)) ;You can move this value, to get diferent result

Func SecToTime($Sec)
    $Hour = Floor($Sec / 3600) ;Counts how many hour has the number.
    $Num = $Sec - ($Hour * 3600) ; Remove the hours, now we have only minutes and seconds
    $Minute = Floor($Sec / 60) ; Count Minutes
    $Num = $Sec - ($Minute * 60) ; Remove minutes
    Return  $Hour & ":" & $Minute & ":" & $Sec
EndFunc

Edit Comenting and changing variavel name.


            
                


    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
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


pollop
            
            
                Posted 
                
            
        
    
    
        


pollop
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 35
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                    (edited)
                
                
            
        
    

    

    

    
        
        
            
I have a better solution for you 

Use $time = StringSplit("1:28:34",":")

Now, attack in :  $time[1]*3600 + $time[2]*60 + $time[3]

Easier 


            
                


    Edited  by pollop
    
    

            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Linux
            
            
                Posted 
                
            
        
    
    
        


Linux
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 238
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            
I have a better solution for you 

Use $time = StringSplit("1:28:34",":")

Now, attack in :  $time[1]*3600 + $time[2]*60 + $time[3]

Easier 
this will do the same as posted before, and I build a function, if you have make that code several times in the program, the function will make your code cleaner.

What about the reverse, do you have a better idea to make a function return the time in hour : Minutes : seconds, giving a determined amount of seconds?


            
        

        

        
            

    
        

        
            
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
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


jokke
            
            
                Posted 
                
            
        
    
    
        


jokke
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 387
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            I found your screen very interesting. can you share with us how did you manage the Building Tree in the gui?
;Production level...
Global $listitem[18][12];[treeID,type,lvl,id,prod.current,prod.next,cost.wood,cost.dirt,cost.iron,cost.corn,cost.pop,build

.time]
$list = GUICtrlCreateTreeView(23,255,150,400)
$listwood = GUICtrlCreateTreeViewItem("Wood Acres",$list)
$listdirt = GUICtrlCreateTreeViewItem("Dirt Holes",$list)
$listiron = GUICtrlCreateTreeViewItem("Iron Mines",$list)
$listcorn = GUICtrlCreateTreeViewItem("Corn Acres",$list)

Then after GUISetState(@SW_SHOW) iwe got 2 functions dedicated for the tree, one for creating it and one for editing it later (guictrlsetdata)

log_msg("Fetching resource tree.")

fetch_tree()

log_msg("Validating tree data.")

For $x = 0 To 17
    check_id($x)
Next

Func fetch_tree()
$array = GetResourceFields()
For $x = 0 To 17
    If StringInStr($array[$x],"Jernmine") Then
        $listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listiron)
        $listitem[$x][1] = "Iron Mine"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    ElseIf StringInStr($array[$x],"Kornåker") Then
        $listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listcorn)
        $listitem[$x][1] = "Corn Acre"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    ElseIf StringInStr($array[$x],"Tømrer") Then
        $listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listwood)
        $listitem[$x][1] = "Wood Acre"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    ElseIf StringInStr($array[$x],"Leirgrop") Then
        $listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listdirt)
        $listitem[$x][1] = "Dirt Hole"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    EndIf
Next
EndFunc


Func uppdate_tree()
$array = GetResourceFields()
For $x = 0 To 17
    If StringInStr($array[$x],"Jernmine") Then
        GUICtrlSetData($listitem[$x][0],$array[$x])
    ;$listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listiron)
        $listitem[$x][1] = "Iron Mine"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    ElseIf StringInStr($array[$x],"Kornåker") Then
        GUICtrlSetData($listitem[$x][0],$array[$x])
    ;$listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listcorn)
        $listitem[$x][1] = "Corn Acre"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    ElseIf StringInStr($array[$x],"Tømrer") Then
        GUICtrlSetData($listitem[$x][0],$array[$x])
    ;$listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listwood)
        $listitem[$x][1] = "Wood Acre"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    ElseIf StringInStr($array[$x],"Leirgrop") Then
        GUICtrlSetData($listitem[$x][0],$array[$x])
    ;$listitem[$x][0] = GUICtrlCreateTreeViewItem($array[$x],$listdirt)
        $listitem[$x][1] = "Dirt Hole"
        $listitem[$x][2] = StringRight($array[$x],1)
        $listitem[$x][3] = $x
    EndIf
Next    
    
EndFunc

Func check_id($i)
                
                $tmp = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Production.current","NONE")
                If $tmp = "NONE" Then
                    
                    log_msg("Downloading tree data: "&$listitem[$i][1]&" Level "&$listitem[$i][2])
                    
                    _IENavigate($oIE,$Link&"/build.php?id="&$listitem[$i][3]+1)
                    _IELoadWait($oIE)
                    
                    $oTable = _IETableGetCollection ($oIE, 1)
                    If @error Then
                        SetError(1)
                        Return
                    EndIf
                    $aTableData = _IETableWriteToArray ($oTable)
                    
                ;[treeID,type,lvl,id,prod.current,prod.next,cost.wood,cost.dirt,cost.iron,cost.corn,cost.pop,build

.time]
                    
                    $min = StringRegExpReplace($aTableData[1][0],"\D", "")
                    $max = StringRegExpReplace($aTableData[1][1],"\D", "")
                    
                    
                    $listitem[$i][4] = $min
                    $listitem[$i][5] = $max
                    
                    ConsoleWrite($listitem[$i][1]&" Level "&$listitem[$i][2]&" producing "&$min&" next lvl "&$max&@CRLF)
                    
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Production.current",$min)
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Production.next",$max)
                    
                    
                    $oTable = _IETableGetCollection ($oIE, 2)
                    If @error Then
                        SetError(1)
                        Return
                    EndIf
                    $aTableData = _IETableWriteToArray ($oTable)
                    
                    $cost = StringSplit($aTableData[0][0],"|")
                    
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.wood",StringRegExpReplace($cost[1],"\D",""))
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.dirt",StringRegExpReplace($cost[2],"\D",""))
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.iron",StringRegExpReplace($cost[3],"\D",""))
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.corn",StringRegExpReplace($cost[4],"\D",""))
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.population",StringRegExpReplace($cost[5],"\D",""))
                    IniWrite($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.time",StringRegExpReplace($cost[6],"\D",""))
                    
                    $listitem[$i][6]  = StringRegExpReplace($cost[1],"\D","")
                    $listitem[$i][7]  = StringRegExpReplace($cost[2],"\D","")
                    $listitem[$i][8]  = StringRegExpReplace($cost[3],"\D","")
                    $listitem[$i][9]  = StringRegExpReplace($cost[4],"\D","")
                    $listitem[$i][10] = StringRegExpReplace($cost[5],"\D","")
                    $listitem[$i][11] = StringRegExpReplace($cost[6],"\D","")
                    
                    ConsoleWrite("Cost to uppgrade: "&$aTableData[0][0]&@CRLF)
                    
                    
                    _IENavigate($oIE,$Link&"/dorf1.php")
                    _IELoadWait($oIE)
                Else
                    
                    $listitem[$i][4] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Production.current","NONE")
                    $listitem[$i][5] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Production.next","NONE")
                    $listitem[$i][6] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.wood","NONE")
                    $listitem[$i][7] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.dirt","NONE")
                    $listitem[$i][8] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.iron","NONE")
                    $listitem[$i][9] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.corn","NONE")
                    $listitem[$i][10] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.population","NONE")
                    $listitem[$i][11] = IniRead($ini,$listitem[$i][1]&" Level "&$listitem[$i][2],"Uppgrade.time","NONE")
                    
                    
                EndIf
                
EndFunc

These functions should show alot how i did it.

about the color, they seen a little random.

I tried using colors related to each working unit.

Heres some code to make them pop:

Dim $wood[4]; [Label,ProgressBAR,current/max state,inncome pre hour]
$wood[0] = GUICtrlCreateLabel("Wood production:",23,50)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$wood[1] = GUICtrlCreateProgress(23, 67, 328, 14,$PBS_SMOOTH)
GUICtrlSetData($wood[1],62)
GUICtrlSetColor($wood[1],0x025604)
GUICtrlSetBkColor($wood[1],0x000000)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($wood[1]), "wstr", "", "wstr", "")
$wood[2] = GUICtrlCreateLabel("0000 / 0000 - 00%",145,68,100,12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1,0xFFFFFF)
$wood[3] = GUICtrlCreateLabel("000 per hour",120,50,130,13)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

I tried to made a TreeView for the buildings but I didn't find how to make it :S

Is it a static TreeView or it will work with a village of 12 Corn Acre ?

It would work with any combination. But the sub trees would show empty if none is found, see top code inn this post.
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

Nice work guyz... I failed misserably and stucked at one spot:

1. Timer function, any idea what is the best method to have it check at a random interval? I might try to use GaryFrost's Timer function...

2. I've no idea how to make the program decide which field to upgrade, that is only Dorf1, not yet work under Dorf2.

If someone can kindly give me some hints on how I can make the bot decide which field to upgrade, I would be happy. So far I only managed to make it upgrade the fields by comparison, which means, the lowest level field will get to upgrade, but that would mean usually crop....

Edit: I'm not too good with 2d Array, so I basically feel that I'm still not up to the standard yet to make one.

Edited by Zepx
Link to comment
Share on other sites

Nice work guyz... I failed misserably and stucked at one spot:

1. Timer function, any idea what is the best method to have it check at a random interval? I might try to use GaryFrost's Timer function...

2. I've no idea how to make the program decide which field to upgrade, that is only Dorf1, not yet work under Dorf2.

If someone can kindly give me some hints on how I can make the bot decide which field to upgrade, I would be happy. So far I only managed to make it upgrade the fields by comparison, which means, the lowest level field will get to upgrade, but that would mean usually crop....

Edit: I'm not too good with 2d Array, so I basically feel that I'm still not up to the standard yet to make one.

Hey :D

About the timer function, if i have understood ^^

My bot refresh ressources every 2min + Random(8,30) sec (AntiDetection)

$w8total = Number(GUICtrlRead($w8min))*60000 + Number(GUICtrlRead($w8sec))*1000 + Random(8,Number(GUICtrlRead($w8hum)),1)*1000oÝ÷ ØèºÛax.q©Ý¢f§Ê׬´Z+{¦¦W¦Éº-vízËlÖE¢¶¥·¬²«qè^v¬Ó~ººÞÚÞ²Ê.­Ç´ß ®®·§¶èvç-öway»¢Ûaz·¬²«qì!Ømë&jY^²ÛÚç¶Ñh­©enè¥v)ಭjG­ì(¡×b®×­rwuçZØ[º)]¶«zË(º·¶­µ©¶¦¢Ëmg­¡Ê&zÊò~æÉéà+!ÞSëæî¶)Üçbaz·¬²«qëajØ¡j÷r·) Ûiÿø¦mwf zÈZrK¬þ) Û]ÿó®¼þ)à¢iâh®Ø^r춻¶*'¡ûazaz¶îWb"·lªÝ~æzÚ(I*&zÞ«ÞvÞ¶­ÉëLɺ-ë-µ©¶º)]x"«ÞvÞjëh×6Func GetBuilding()
    $Source = _INetGetSource($Lien & "/dorf2.php")

    $Source = StringReplace($Source,"é","é")
    $Source = StringReplace($Source,"è","è")
    $Source = StringReplace($Source,"û","û")
    $Source = StringReplace($Source,"ô","ô")
    $Source = StringReplace($Source,"â","â")
    $Source = StringReplace($Source,"Ã","à")

    GUICtrlSetData($ListBuilding,"")
    For $i = 19 To 40
        $Areas = _StringBetween($Source, 'build.php?id='&$i&'" title="', '" coords="')
        If $Areas[0] = "Site de construction" Or $Areas[0] = "site de construction extérieur" Then
            IniWrite($data,"BuildingType",$i,"Vide")
            IniWrite($data,"BuildingNiveau",$i,0)
;~          IniWrite($data,"AutreBatiments",$i,"Vide")
            GUICtrlSetData($ListBuilding,"["&$i&"]|")
        Else
            $type = StringTrimRight($Areas[0],StringLen($Areas[0])-StringInStr($Areas[0]," niveau")+1)
            IniWrite($data,"BuildingType",$i,$type)
            $niveau = Number(StringTrimLeft($Areas[0],StringInStr($Areas[0]," niveau")+7))
            IniWrite($data,"BuildingNiveau",$i,$niveau)
;~          IniWrite($data,"AutreBatiments",$i,$Areas[0])
            GUICtrlSetData($ListBuilding,"["&$i&"] - " & $Areas[0] & "|")
        EndIf
    Next
EndFunc  ;==>GetBuilding

Posted Image

Edited by pollop
Link to comment
Share on other sites

Nice work guyz... I failed misserably and stucked at one spot:

1. Timer function, any idea what is the best method to have it check at a random interval? I might try to use GaryFrost's Timer function...

2. I've no idea how to make the program decide which field to upgrade, that is only Dorf1, not yet work under Dorf2.

If someone can kindly give me some hints on how I can make the bot decide which field to upgrade, I would be happy. So far I only managed to make it upgrade the fields by comparison, which means, the lowest level field will get to upgrade, but that would mean usually crop....

Edit: I'm not too good with 2d Array, so I basically feel that I'm still not up to the standard yet to make one.

hi!

1: im planning to make the bot check every 2 minutes or so, if there is a available contructions slot. im using the timers to make some other checks. when i code it i will give some more hints.

2: There is a wonderfull topic about arrays, you will have to search the forum, im now at work and i cant spend more time here.

about the autobuild, you have my example in the script i posted in page 2. i will explain it now:

1. Check if Crop prod is Greater then $MinCrop. if crop production is low, then go directly to crop.

else, compare the array of stock resources.

in this case:

1000 wood,

900 clay, <<<--- Pick this one

1200 iron,

1500 crop.

it will pick Clay to build.

then, choose wich clay field is the lower:

Clay lvl 5

Clay lvl 5

Clay lvl 4 <<<--- Pick this one

because the cost for the fields always use much of everything, except the field we are planning to build, this makes a very eficient and simple code:

Func BuildResources()
    local $Nextx = 0, $Nexty = 0;Nextx = Selected resource, NextY = Selected Field
    local $TTable[7]
   ;Test Crop prod
    if $GetProductions[4] < $MinCrop then;if crop prod is low, forget the rest.
        ConsoleWrite("Forcing build Crop")
        $Nextx = 4;Next field will be a crop
    else
        for $Index = 1 to 4 
            $TTable[$Index] = $GetMaterials[$Index][1]
        Next
        $Nextx = ArrayMinIndex($TTable);Select Index of min resource, 1 = wood ... 4 = crop
    EndIf
    If $Nextx = 0 Then
        ConsoleWrite("No decition! Maybe few resources..." & @CRLF)
        Return 0
    EndIf
    ConsoleWrite("Nextx = " & $Nextx)
    for $Index = 1 to 4;this is needed because of Jex code, Send actual fields to a array
        $TTable[$Index] = $GetResourceFields[$Nextx][$Index]
        if (($Index = 4) and ($Nextx = 4)) then 
            $TTable[5] = $GetResourceFields[$Nextx][5]
            $TTable[6] = $GetResourceFields[$Nextx][6]
        EndIf   
    Next
    $Nexty = ArrayMinIndex($TTable);Select the lowest field of that resource
    ConsoleWrite("Nexty = " & $Nexty & @CRLF)
    if ($Nexty <> 0) then build($Nextx, $Nexty)
EndFunc;==> Auto

To Do: In case the select there are no resources for the selected field, it should test other types of fields (resources)

PS: this ArrayMinIndex is altered be me. pls see the script posted in page 2.

Hope it helps

:D

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

My bot does exactly the opposit ^^

When the AI have decided what ressource it will build, my bot check for this ressource what it can build.

Example

AI decide to improve iron production.

Iron Mine lvl 1 : Enough ressources to build

Iron Mine lvl 3 : Enough ressources to build

Iron Mine lvl 4 : Enough resosurces to build in 15 minutes

Iron Mine lvl 7 : Enough resosurces to build in 6hours and 17minutes

The AI check if he can build the bigger mine.

He check for the lvl7 and see that he can't build it before 6h17m so he check a lower lvl

Check lvl 4 and see that he can build it in less than 20 minutes so he decide to build this one. (He add it to my construction list)

:D

Edited by pollop
Link to comment
Share on other sites

My bot does exactly the opposit ^^

thats a point of view, but I prefer my way, its well know that you shouldnt have more than 2 lvl diference betwen the higher lvl and the lowest level. eg:

Clay lvl 2

Clay lvl 2

Clay lvl 3

Clay lvl 3

In this case, you shouldnt upgrade the lvl 3 to lvl 4 while there are lvl 2. pls check all the faqs and Newbie tutorials for more info.

the explanation is that by doing this, you are in a better resource investiment(resource return / resource invested), since the higher levels are expensive.

this is my point of view, maybe if i search for some reference i could convince you.

other problem:

when all fields of a type od resource gets to lvl 7, you should upgrade only 1 field to level 10, and then build the corresponding building in the village center (eg: Iron Foundry for Iron) to lvl 3

this will boots your resources, and the first 3 lvl of the extension are very cheap.

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

Arf, i didn't know that :S

I started Travian 6 days ago so i am a newbie ^^

Thx for the strategy :D I will correct my bot now :P

EDIT : Done ;)

My bot now build the building with the lowest level :P

EDIT : Again

Other improvement.

My bot build the lowest level if it's < 7

If lowest is >=7 and bigger is < 10 he build the bigger

Edited by pollop
Link to comment
Share on other sites

no problem! just ask, and I will try to help when posible.

1 question. in your screen shot, you have diferent buttons and the aspect looks like Vista.

How do you get that? is that because of vista?

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

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