d0n Posted September 2, 2006 Posted September 2, 2006 This code here i wrote works but when put into the bigger code it doesnt work This is the smaller code that i will be putting into the big one, which works and tells me 8 tables on the page #include <IE.au3> #include <GUIConstants.au3> #include <Math.au3> #include <Array.au3> #NoTrayIcon $sURL = "http://s7.travian.com/dorf1.php" $oIE = _IECreate($sURL) $oTable = _IETableGetCollection ($oIE) $iNumTables = @extended MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") This bigger code here, has the SAME codes as the above but prints out 0 tables on the page, no clue why expandcollapse popup#include <IE.au3> #include <GUIConstants.au3> #include <Math.au3> #include <Array.au3> #NoTrayIcon GUICreate("Travian", 500, 500) GUICtrlCreateLabel("Current", 5, 5) GUICtrlCreateLabel("Type", 60, 5) GUICtrlCreateLabel("Production", 100, 5) GUICtrlCreateLabel("Warehouse/Granary", 160, 5) GUICtrlCreateLabel("Wood", 60, 25) GUICtrlCreateLabel("Clay ", 60, 45) GUICtrlCreateLabel("Iron ", 60, 65) GUICtrlCreateLabel("Crop ", 60, 85) GUICtrlCreateLabel("Woodcutter", 5, 105) GUICtrlCreateLabel("Clay Pit", 5, 125) GUICtrlCreateLabel("Iron mine", 5, 145) GUICtrlCreateLabel("Cropland", 5, 165) $progressbar = GUICtrlCreateProgress (5,180,200,20) $exit = GUICtrlCreateButton ( "Exit", 175, 175) $start = GUICtrlCreateButton ( "Start", 155, 155) $currentwood = GUICtrlCreateInput("", 5, 25, 50, 16) $currentclay = GUICtrlCreateInput("", 5, 45, 50, 16) $currentiron = GUICtrlCreateInput("", 5, 65, 50, 16) $currentcrop = GUICtrlCreateInput("", 5, 85, 50, 16) $productionwood = GuiCtrlCreateInput("", 100, 25, 30, 16) $productionclay = GuiCtrlCreateInput("", 100, 45, 30, 16) $productioniron = GuiCtrlCreateInput("", 100, 65, 30, 16) $productioncrop = GuiCtrlCreateInput("", 100, 85, 30, 16) $warehouse = GUICtrlCreateInput("", 160, 25, 60, 21) $granary = GUICtrlCreateInput("", 160, 50, 60, 21) $full1 = GUICtrlCreateLabel ("88 88", 230, 28, 50, 16) $AMorPM1 = GUICtrlCreateLabel ("--", 265, 28, 15, 16) $full2 = GUICtrlCreateLabel ("88 88", 230, 53, 50, 16) $AMorPM2 = GUICtrlCreateLabel ("--", 265, 53, 15, 16) $wood = GUICtrlCreateInput ("1", 80, 105, 30, 16) $wood1 = GUICtrlCreateUpdown ($wood) GUISetState() While 1 $msg = GUIGetMsg() if $msg = $start Then GUICtrlSetData ($progressbar, 10) $sURL = "http://s7.travian.com/dorf1.php" $oIE = _IECreate($sURL) GUICtrlSetData ($progressbar, 20) $oTable = _IETableGetCollection ($oIE) GUICtrlSetData ($progressbar, 30) $iNumTables = @extended MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") $production = 0 $current = 0 $sText = _IEBodyReadText ($oIE) ;;Find where the tables are for production if $iNumTables = 7 Then;; Without troops movement $production = 4 $current = 6 Elseif $iNumTables = 8 Then;; With troops movement $production = 5 $current = 7 EndIf ;;Get warehouse size $result1 = GUICtrlRead ($warehouse) GUICtrlSetData ($progressbar, 40) ;;Get granary size $result2 = GUICtrlRead ($granary) GUICtrlSetData ($progressbar, 50) ;;Get current time $sTextmin = StringTrimRight($sText, 11) $sTexthour = StringTrimRight($sText, 14) $min = StringRight($sTextmin, 2) $hour = StringRight($sTexthour, 2) GUICtrlSetData ($progressbar, 60) ;;Get Current resources $oTable1 = _IETableGetCollection($oIE, 7) $aTableData = _IETableWriteToArray($oTable1) $length = StringLen($result1) $cwood = StringTrimRight($aTableData[1][0], ($length + 1)) $cclay = StringTrimRight($aTableData[3][0], ($length + 1)) $ciron = StringTrimRight($aTableData[5][0], ($length + 1)) $ccrop = StringTrimRight($aTableData[7][0], ($length + 1)) GUICtrlSetData ($progressbar, 70) ;;Get production rates $oTable2 = _IETableGetCollection($oIE, 5) $aTableData1 = _IETableWriteToArray($oTable2) $pwood = $aTableData1[2][0] $pclay = $aTableData1[2][1] $piron = $aTableData1[2][2] $pcrop = $aTableData1[2][3] GUICtrlSetData ($progressbar, 80) ;;Calculate warehouse full time $wh1 = (($result1 - $cwood) / $pwood) $wh2 = (($result1 - $cclay) / $pclay) $wh3 = (($result1 - $ciron) / $piron) $whtime1 = _Min($wh1, $wh2) $whtime2 = _Min($whtime1, $wh3) $whtimehour = _Floor($whtime2) $whtimemin = (($whtime2 - $whtimehour) * 60) $whtimemin = Round($whtimemin, 0) $whtimehour = ($hour + $whtimehour) $whtimemin = ($min + $whtimemin) if $whtimemin >= 60 Then $whtimemin = ($whtimemin - 60) $whtimehour = ($whtimehour + 1) if $whtimehour >= 24 Then $whtimehour = ($whtimehour - 24) GUICtrlSetData($AMorPM1, "AM") ElseIf $whtimehour > 12 Then $whtimehour = ($whtimehour - 12) GUICtrlSetData($AMorPM1, "PM") ElseIf $whtimehour = 12 Then $whtimehour = 12 GUICtrlSetData($AMorPM1, "PM") Else $whtimehour = $whtimehour GUICtrlSetData($AMorPM1, "AM") endif Else if $whtimehour >= 24 Then $whtimehour = ($whtimehour - 24) GUICtrlSetData($AMorPM1, "AM") ElseIf $whtimehour > 12 Then $whtimehour = ($whtimehour - 12) GUICtrlSetData($AMorPM1, "PM") ElseIf $whtimehour = 12 Then $whtimehour = 12 GUICtrlSetData($AMorPM1, "PM") Else $whtimehour = $whtimehour GUICtrlSetData($AMorPM1, "AM") endif EndIf GUICtrlSetData ($progressbar, 90) ;;Calculate granary full time $g1 = (($result2 - $ccrop) / $pcrop) $gtimehour = _Floor($g1) $gtimemin = (($g1 - $gtimehour) * 60) $gtimemin = Round($gtimemin, 0) $gtimehour = ($hour + $gtimehour) $gtimemin = ($min + $gtimemin) if $gtimemin >= 60 Then $gtimemin = ($gtimemin - 60) $gtimehour = ($gtimehour + 1) if $gtimehour >= 24 Then $gtimehour = ($gtimehour - 24) GUICtrlSetData($AMorPM2, "AM") ElseIf $gtimehour > 12 Then $gtimehour = ($gtimehour - 12) GUICtrlSetData($AMorPM2, "PM") ElseIf $gtimehour = 12 Then $gtimehour = 12 GUICtrlSetData($AMorPM2, "PM") Else $gtimehour = $gtimehour GUICtrlSetData($AMorPM2, "AM") endif Else if $gtimehour >= 24 Then $gtimehour = ($gtimehour - 24) GUICtrlSetData($AMorPM2, "AM") ElseIf $gtimehour > 12 Then $gtimehour = ($gtimehour - 12) GUICtrlSetData($AMorPM2, "PM") ElseIf $gtimehour = 12 Then $gtimehour = 12 GUICtrlSetData($AMorPM2, "PM") Else $gtimehour = $gtimehour GUICtrlSetData($AMorPM2, "AM") endif EndIf GUICtrlSetData ($progressbar, 100) ;;print findings for time if $whtimemin >= 10 Then if $whtimehour >= 10 Then GUICtrlSetData($full1, ($whtimehour&" : "&$whtimemin)) Else GUICtrlSetData($full1, (" "&$whtimehour&" : "&$whtimemin)) EndIf Else if $whtimehour <= 9 Then GUICtrlSetData($full1, (" "&$whtimehour&" : 0"&$whtimemin)) Else GUICtrlSetData($full1, ($whtimehour&" : 0"&$whtimemin)) EndIf EndIf if $gtimemin >= 10 Then if $gtimehour >= 10 Then GUICtrlSetData($full2, ($gtimehour&" : "&$gtimemin)) Else GUICtrlSetData($full2, (" "&$gtimehour&" : "&$gtimemin)) EndIf Else if $gtimehour <= 9 Then GUICtrlSetData($full2, (" "&$gtimehour&" : 0"&$gtimemin)) Else GUICtrlSetData($full2, ($gtimehour&" : 0"&$gtimemin)) EndIf EndIf ;;pring everything else GUICtrlSetData($currentwood, $cwood) GUICtrlSetData($currentclay, $cclay) GUICtrlSetData($currentiron, $ciron) GUICtrlSetData($currentcrop, $ccrop) GUICtrlSetData($productionwood, $pwood) GUICtrlSetData($productionclay, $pclay) GUICtrlSetData($productioniron, $piron) GUICtrlSetData($productioncrop, $pcrop) GUICtrlSetData($warehouse, $result1) GUICtrlSetData($granary, $result2) EndIf If $msg = $GUI_EVENT_CLOSE or $msg = $exit Then ExitLoop WEnd
Xenobiologist Posted September 2, 2006 Posted September 2, 2006 Hi, the difference is the position of line with extended! expandcollapse popup#include <IE.au3> #include <GUIConstants.au3> #include <Math.au3> #include <Array.au3> #NoTrayIcon GUICreate("Travian", 500, 500) GUICtrlCreateLabel("Current", 5, 5) GUICtrlCreateLabel("Type", 60, 5) GUICtrlCreateLabel("Production", 100, 5) GUICtrlCreateLabel("Warehouse/Granary", 160, 5) GUICtrlCreateLabel("Wood", 60, 25) GUICtrlCreateLabel("Clay ", 60, 45) GUICtrlCreateLabel("Iron ", 60, 65) GUICtrlCreateLabel("Crop ", 60, 85) GUICtrlCreateLabel("Woodcutter", 5, 105) GUICtrlCreateLabel("Clay Pit", 5, 125) GUICtrlCreateLabel("Iron mine", 5, 145) GUICtrlCreateLabel("Cropland", 5, 165) $progressbar = GUICtrlCreateProgress (5,180,200,20) $exit = GUICtrlCreateButton ( "Exit", 175, 175) $start = GUICtrlCreateButton ( "Start", 155, 155) $currentwood = GUICtrlCreateInput("", 5, 25, 50, 16) $currentclay = GUICtrlCreateInput("", 5, 45, 50, 16) $currentiron = GUICtrlCreateInput("", 5, 65, 50, 16) $currentcrop = GUICtrlCreateInput("", 5, 85, 50, 16) $productionwood = GuiCtrlCreateInput("", 100, 25, 30, 16) $productionclay = GuiCtrlCreateInput("", 100, 45, 30, 16) $productioniron = GuiCtrlCreateInput("", 100, 65, 30, 16) $productioncrop = GuiCtrlCreateInput("", 100, 85, 30, 16) $warehouse = GUICtrlCreateInput("", 160, 25, 60, 21) $granary = GUICtrlCreateInput("", 160, 50, 60, 21) $full1 = GUICtrlCreateLabel ("88 88", 230, 28, 50, 16) $AMorPM1 = GUICtrlCreateLabel ("--", 265, 28, 15, 16) $full2 = GUICtrlCreateLabel ("88 88", 230, 53, 50, 16) $AMorPM2 = GUICtrlCreateLabel ("--", 265, 53, 15, 16) $wood = GUICtrlCreateInput ("1", 80, 105, 30, 16) $wood1 = GUICtrlCreateUpdown ($wood) GUISetState() While 1 $msg = GUIGetMsg() if $msg = $start Then GUICtrlSetData ($progressbar, 10) $sURL = "http://s7.travian.com/dorf1.php" $oIE = _IECreate($sURL) GUICtrlSetData ($progressbar, 20) $oTable = _IETableGetCollection ($oIE) $iNumTables = @extended GUICtrlSetData ($progressbar, 30) MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") EndIf If $msg = $GUI_EVENT_CLOSE or $msg = $exit Then ExitLoop WEnd So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
cdtoews Posted August 22, 2007 Posted August 22, 2007 Don, can you post your final script, I am making some scripts for Travian (farming), and would like to see your script in action. Chris
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now