maiks86 Posted September 10, 2012 Share Posted September 10, 2012 Hello i am new to programming at least didn't go to school or anything so it might be a simple problem. I have made some tools for a game called grepolis. it's just a timer and some BB code making tools(Nothing that violates the rules). From about 30% of the users i get complaints that they are getting error's. Today one of the users discovered that if he closed Google chrome the tool worked just fine and when he opened Google chrome again if gave an error again and stopped working. Maybe someone can discover a mistake in my script that explains this. i know it's a mess and that some stuff isn't as efficient as it can be but i promise you i'm improving everyday expandcollapse popup#include <GUIConstants.au3> #include <GuiComboBox.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <String.au3> #include <Array.au3> #include <EditConstants.au3> #include <GuiDateTimePicker.au3> #include <Date.au3> #NoTrayIcon Global $Title = "Maiks CR Creator - V1.2 Beta" Global $Players[1][6] Global $Towns[1][7] Global $Ally[1][6] Global $P Global $I = 0 Global $L Global $FP = "" Global $BBGod1 = " " Global $BBGod2 = " " Gui() Func LoadData() $P = 0 $I = 0 $Form4 = GUICreate("Maiks CR Creator - Loading", 413, 20, 573, 372) Global $Progress1 = GUICtrlCreateProgress(0, 0, 409, 17) GUISetState(@SW_SHOW) If IniRead ( "Settings.ini", "CR", "download", "True" ) = "True" Then Local $Data1 = BinaryToString(FileRead("players.txt")) Else Local $Data1 = BinaryToString(InetRead("http://nl19.grepolis.com/data/players.txt", 17)) EndIf $Data1 = StringReplace($Data1, @CRLF, "//") $Data1 = StringReplace($Data1, @CR, "//") $Data1 = StringReplace($Data1, @LF, "//") Global $PlayersSplit1 = _StringExplode($Data1, "//") Global $PlayersList[UBound($PlayersSplit1) + 2][2] If IniRead ( "Settings.ini", "CR", "download", "True" ) = "True" Then Local $Data2 = BinaryToString(FileRead("towns.txt")) Else Local $Data2 = BinaryToString(InetRead("http://nl19.grepolis.com/data/towns.txt", 17)) EndIf $Data2 = StringReplace($Data2, @CRLF, "//") $Data2 = StringReplace($Data2, @CR, "//") $Data2 = StringReplace($Data2, @LF, "//") Global $TownsSplit1 = _StringExplode($Data2, "//") Global $TownsList[UBound($TownsSplit1) + 2][2] Global $Pmax = (UBound($PlayersSplit1) * 2) + UBound($TownsSplit1) While $I < UBound($PlayersSplit1) - 1 $PlayersSplit2 = _StringExplode($PlayersSplit1[$I], ",", 5) $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%AF", "ï") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%A7", "ç") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%AB", "ë") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%A9", "é") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%2A", "*") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "+", " ") $PlayersList[$I][0] = $PlayersSplit2[0] $PlayersList[$I][1] = $PlayersSplit2[1] $I = $I + 1 $P = $P + 1 $prog1 = $P * (100 / $Pmax) GUICtrlSetData($Progress1, $prog1) WEnd $I = 0 While $I < UBound($TownsSplit1) - 1 $TownsSplit2 = _StringExplode($TownsSplit1[$I], ",", 6) $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%AF", "ï") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%A7", "ç") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%AB", "ë") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%A9", "é") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%2A", "*") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "+", " ") $TownsList[$I][0] = $TownsSplit2[1] $TownsList[$I][1] = $TownsSplit2[2] $I = $I + 1 $P = $P + 1 $prog1 = $P * (100 / $Pmax) GUICtrlSetData($Progress1, $prog1) WEnd _ArraySort($PlayersList, 0, 0, 0, 1) _ArraySort($TownsList, 0, 0, 0, 1) PlayerCombo() GUIDelete() EndFunc Func Gui() Local $aRange[14] = [True, @YEAR, @MON, @MDAY - 1, @HOUR, @MIN, @SEC, True, @YEAR, @MON, @MDAY, @HOUR, @MIN, @SEC] Local $date, $DTM_SETFORMAT_, $style #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate($Title, 689, 352, 456, 247) Global $Combo1 = GUICtrlCreateCombo("Speler", 272, 32, 185, 25) GUICtrlSetTip(-1, "Vult hier de naam in van de persoon met de Code Rood") Global $Combo2 = GUICtrlCreateCombo("Stad", 272, 56, 185, 25, $CBS_DROPDOWNLIST) GUICtrlSetTip(-1, "Vult hier de stadnaam in van de Code Rood") GUICtrlSetOnEvent ( $Combo2, "Update" ) Global $Input1 = GUICtrlCreateInput("", 272, 176, 409, 21) GUICtrlSetTip(-1, "Plaats hier het rapport van de aanval dat de opstand veroorzaakt.") Global $Date1 = GUICtrlCreateDate(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN, 272, 80, 185, 21) $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd HH:mm" GUICtrlSendMsg($Date1, $DTM_SETFORMAT_, 0, $style) _GUICtrlDTP_SetRange(GUICtrlGetHandle($Date1), $aRange) Global $Combo3 = GUICtrlCreateCombo("God", 272, 104, 185, 25, $CBS_DROPDOWNLIST) Global $Checkbox1 = GUICtrlCreateCheckbox("Toren", 272, 152, 89, 25) Global $Combo4 = GUICtrlCreateCombo("Muur", 272, 128, 185, 25, $CBS_DROPDOWNLIST) $Label1 = GUICtrlCreateLabel('Om snel een "Code Rood" aan te maken volg deze stappen en u zal binnen 2 minuten klaar zijn.', 8, 8, 459, 17) $Label2 = GUICtrlCreateLabel("Selecteer hier de betreffende speler.", 8, 40, 175, 17) $Label3 = GUICtrlCreateLabel("Selecteer hier de betreffende stad.", 8, 64, 167, 17) $Label4 = GUICtrlCreateLabel("Noteer hier de tijd dat opstand aanval aangekomen is.", 8, 88, 259, 17) $Label5 = GUICtrlCreateLabel("Welke godheid heeft u in de betreffende stad.", 8, 112, 221, 17) $Label6 = GUICtrlCreateLabel("Wat is het level van uw muur in de betreffende stad.", 8, 136, 250, 17) $Label7 = GUICtrlCreateLabel("Heeft u een toren in de betreffende stad.", 8, 160, 196, 17) $Label8 = GUICtrlCreateLabel("Plaats hier het rapport van de opstand.", 8, 184, 187, 17) $Label9 = GUICtrlCreateLabel('Als u klaar bent met het invullen van de gegevens, klikt u op "Genereer Code Rood" ', 8, 280, 406, 17) $Label10 = GUICtrlCreateLabel("en dan kan u vervolgens de Code Rood plakken in het forum.", 8, 296, 296, 17) Global $Button1 = GUICtrlCreateButton("Genereer Code Rood", 272, 320, 153, 25) $Label11 = GUICtrlCreateLabel("Eenheden in de stad:", 8, 208, 105, 17) $Label12 = GUICtrlCreateLabel("Zwaardvechter", 72, 232, 76, 17) $Label13 = GUICtrlCreateLabel("Boogschutter", 72, 256, 67, 17) $Label14 = GUICtrlCreateLabel("Hopliet", 280, 232, 37, 17) $Label15 = GUICtrlCreateLabel("Strijdwagen", 280, 256, 59, 17) Global $Label16 = GUICtrlCreateLabel("God1", 464, 232, 50, 17) Global $Label17 = GUICtrlCreateLabel("God2", 464, 256, 50, 17) $Label18 = GUICtrlCreateLabel("Bireem", 640, 232, 36, 17) $Label19 = GUICtrlCreateLabel("Tireem", 640, 256, 36, 17) Global $Input2 = GUICtrlCreateInput(0, 9, 224, 55, 21, $ES_NUMBER & $ES_RIGHT) Global $Input3 = GUICtrlCreateInput(0, 8, 248, 57, 21, $ES_NUMBER & $ES_RIGHT) Global $Input4 = GUICtrlCreateInput(0, 208, 224, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input5 = GUICtrlCreateInput(0, 208, 248, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input6 = GUICtrlCreateInput(0, 392, 224, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input7 = GUICtrlCreateInput(0, 392, 248, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input8 = GUICtrlCreateInput(0, 568, 224, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input9 = GUICtrlCreateInput(0, 568, 248, 65, 21, $ES_NUMBER & $ES_RIGHT) GUISetState(@SW_SHOW) GUISetState(@SW_DISABLE) #EndRegion ### END Koda GUI section ### LoadData() EasyCombo() Gods() GUISetState(@SW_ENABLE) WinActivate($Title) While 1 If $FP = GUICtrlRead($Combo1) Then Else If _ArraySearch($PlayersList, GUICtrlRead($Combo1)) > 1 Then If _GUICtrlComboBox_GetDroppedState($Combo1) = False Then ;Sleep(5000) FindPlayer(_GUICtrlComboBox_GetEditText($Combo1)) $FP = GUICtrlRead($Combo1) EndIf EndIf EndIf $L = StringLen(GUICtrlRead($Combo1)) $nMsg = GUIGetMsg() Switch $nMsg Case $Combo3 Gods() Case $Combo1 ;FindPlayer(_GUICtrlComboBox_GetEditText($Combo1)) Case $Button1 Generate() Case $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd EndFunc Func PlayerCombo() Local $I = 0 While $I < UBound($PlayersList) - 1 GUICtrlSetData($Combo1,$PlayersList[$I][1]) $I = $I + 1 $P = $P + 1 $prog1 = $P * (100 / $Pmax) GUICtrlSetData($Progress1, $prog1) WEnd EndFunc Func EasyCombo() GUICtrlSetData($Combo3,"Athene|Hades|Hera|Poseidon|Zeus") GUICtrlSetData($Combo4,"0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|Onbekend") EndFunc Func FindPlayer($C) Local $I = 0 Global $PlayerPlayerId = $PlayersList[_ArraySearch($PlayersList, $C)][0] $Form4 = GUICreate("Maiks CR Creator - Loading", 413, 20, 573, 372) $Progress1 = GUICtrlCreateProgress(0, 0, 409, 17) GUISetState(@SW_SHOW) _GUICtrlComboBoxEx_ResetContent(GUICtrlGetHandle($Combo2)) While $I < UBound($TownsList) - 1 If $PlayerPlayerId = $TownsList[$I][0] Then _GUICtrlComboBox_AddString(GUICtrlGetHandle($Combo2),$TownsList[$I][1]) EndIf $I = $I + 1 $prog1 = $I * (100 / UBound($TownsList)) GUICtrlSetData($Progress1, $prog1) WEnd GUIDelete() EndFunc Func Gods() Select Case "Athene" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Pegasus") GUICtrlSetData($Label17, "Centaur") $BBGod1 = " Pegasus" $BBGod2 = " Centaur" Case "Hades" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Cerberus") GUICtrlSetData($Label17, "Erinys") $BBGod1 = " Cerberus" $BBGod2 = " Erinys" Case "Hera" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Medusa") GUICtrlSetData($Label17, "Harpij") $BBGod1 = " Medusa" $BBGod2 = " Harpij" Case "Poseidon" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Cycloop") GUICtrlSetData($Label17, "Hydra") $BBGod1 = " Cycloop" $BBGod2 = " Hydra" Case "Zeus" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Minotaurus") GUICtrlSetData($Label17, "Manticore") $BBGod1 = " Minotaurus" $BBGod2 = " Manticore" Case "God" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, " ") GUICtrlSetData($Label17, " ") $BBGod1 = " " $BBGod2 = " " EndSelect EndFunc Func Generate() Local $ClipPlayer = GUICtrlRead($Combo1) Local $ClipTown = $TownsList[_ArraySearch($TownsList, GUICtrlRead($Combo2))][0] Local $ClipGod = GUICtrlRead($Combo3) If $ClipGod = "God" then $ClipGod = "Onbekend" Local $ClipWall = GUICtrlRead($Combo4) If $ClipWall = "Muur" then $ClipWall = "Onbekend" If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then Local $ClipTower = "Ja" Else Local $ClipTower = "Nee" EndIf Local $ClipReport = GUICtrlRead($Input1) Local $ClipStartTime = _DateAdd("h", "12", GUICtrlRead($Date1)) Local $ClipEndTime = _DateAdd("h", "24", GUICtrlRead($Date1)) Local $ClipZwaardvechter = GUICtrlRead($Input2) Local $ClipBoogschutter = GUICtrlRead($Input3) Local $ClipHopliet = GUICtrlRead($Input4) Local $ClipStrijdwagen = GUICtrlRead($Input5) Local $ClipGod1 = GUICtrlRead($Input6) Local $ClipGod2 = GUICtrlRead($Input7) Local $ClipBireem = GUICtrlRead($Input8) Local $ClipTrireem = GUICtrlRead($Input9) ;consolewrite(GUICtrlRead($Date1)) ClipPut("Aanval op [town]" & $ClipTown & "[/town] van [player]" & $ClipPlayer & "[/player] " & @CRLF & "Godheid: "& $ClipGod & @CRLF & "Level muur: " & $ClipWall & @CRLF & "Toren: " & $ClipTower & @CRLF & "" & @CRLF & "[u][b]OpstandRapport:[/b][/u]" & @CRLF & $ClipReport & @CRLF & "[u]Opstand begint:[/u] " & $ClipStartTime & @CRLF & "[u]Opstand eindigt:[/u] " & $ClipEndTime & @CRLF & "" & @CRLF & "[u][color=#D60101]UPDATE:[/color][/u]" & @CRLF & "[u]OS aanwezig:[/u]" & @CRLF & $ClipZwaardvechter & " Zwaardvechter" & @CRLF & $ClipBoogschutter & " Boogschutter" & @CRLF & $ClipHopliet & " Hopliet" & @CRLF & $ClipStrijdwagen & " Strijdwagen" & @CRLF & $ClipGod1 & $BBGod1 & @CRLF & $ClipGod2 & $BBGod2 & @CRLF & $ClipBireem & " Bireem" & @CRLF & $ClipTrireem & " Trireem" & @CRLF & "" & @CRLF & "Overige informatie:") MsgBox(4096, $Title, "De Code Rood is gegenereerd, plak het nu in het forum.", 5) EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted September 10, 2012 Share Posted September 10, 2012 It violates the rules. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
maiks86 Posted September 10, 2012 Author Share Posted September 10, 2012 I am not going to discus here if it's a violation or not, i have already done that with support from grepolis. But does anybody have any idea what's wrong? Link to comment Share on other sites More sharing options...
MrMitchell Posted September 10, 2012 Share Posted September 10, 2012 I am not going to discus here if it's a violation or not, i have already done that with support from grepolis. But does anybody have any idea what's wrong?To clarify, he meant this forum's rules. Link to comment Share on other sites More sharing options...
maiks86 Posted September 10, 2012 Author Share Posted September 10, 2012 Well if you take a good look it doesn't but fine. i'll figure it out my self. Link to comment Share on other sites More sharing options...
JohnOne Posted September 10, 2012 Share Posted September 10, 2012 I have made some tools for a game called grepolis AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
maiks86 Posted September 11, 2012 Author Share Posted September 11, 2012 (edited) Automating games or game servers. This rule is zero tolerance. Any discussion of using AutoIt to launch or interact with a game or game server violates our rules. My tools do non of these things. For example the script here just help users to make descent posts on the forum, They input the data them self en have to paste it them self in the forum. So will you please take a look at the script or do you think your time is better spent finding another reason not to help?If your still not convinced then please run the script and you'll see.BTW. sorry for my previous post i had been working for 40 hours straight on that script and got a bit grumpy. Edited September 11, 2012 by maiks86 Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 12, 2012 Administrators Share Posted September 12, 2012 If it doesn't directly automate the game then I'll leave this open for now. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
MrMitchell Posted September 12, 2012 Share Posted September 12, 2012 Do you have a function called "Update"? Is it important? Script gives a warning because it's not there... Link to comment Share on other sites More sharing options...
maiks86 Posted September 13, 2012 Author Share Posted September 13, 2012 (edited) Sorry didn't think anyone would try to help, so i haven't checked the forum. But no there is no function called update in this script and i checked all my other scripts and there is no function called update in any of them. i found where the function was called for and removed it. expandcollapse popup#include <GUIConstants.au3> #include <GuiComboBox.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <String.au3> #include <Array.au3> #include <EditConstants.au3> #include <GuiDateTimePicker.au3> #include <ListboxConstants.au3> #include <Date.au3> #include <Debug.au3> #NoTrayIcon Global $Title = "Maiks CR Creator - V1.2 Beta" Global $Players[1][6] Global $Towns[1][7] Global $Ally[1][6] Global $P Global $I = 0 Global $L Global $FP = "" Global $BBGod1 = " " Global $BBGod2 = " " Gui() Func LoadData() $P = 0 $I = 0 $Form4 = GUICreate("Maiks CR Creator - Loading", 413, 20, 573, 372) Global $Progress1 = GUICtrlCreateProgress(0, 0, 409, 17) GUISetState(@SW_SHOW) If IniRead ( "Settings.ini", "CR", "download", "True" ) = "True" Then Local $Data1 = BinaryToString(FileRead("players.txt")) Else Local $Data1 = BinaryToString(InetRead("http://nl19.grepolis.com/data/players.txt", 17)) EndIf $Data1 = StringReplace($Data1, @CRLF, "//") $Data1 = StringReplace($Data1, @CR, "//") $Data1 = StringReplace($Data1, @LF, "//") Global $PlayersSplit1 = _StringExplode($Data1, "//") Global $PlayersList[UBound($PlayersSplit1) + 2][2] If IniRead ( "Settings.ini", "CR", "download", "True" ) = "True" Then Local $Data2 = BinaryToString(FileRead("towns.txt")) Else Local $Data2 = BinaryToString(InetRead("http://nl19.grepolis.com/data/towns.txt", 17)) EndIf $Data2 = StringReplace($Data2, @CRLF, "//") $Data2 = StringReplace($Data2, @CR, "//") $Data2 = StringReplace($Data2, @LF, "//") Global $TownsSplit1 = _StringExplode($Data2, "//") Global $TownsList[UBound($TownsSplit1) + 2][2] Global $Pmax = (UBound($PlayersSplit1) * 2) + UBound($TownsSplit1) While $I < UBound($PlayersSplit1) - 1 $PlayersSplit2 = _StringExplode($PlayersSplit1[$I], ",", 5) $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%AF", "ï") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%A7", "ç") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%AB", "ë") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%C3%A9", "é") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "%2A", "*") $PlayersSplit2[1] = StringReplace($PlayersSplit2[1], "+", " ") $PlayersList[$I][0] = $PlayersSplit2[0] $PlayersList[$I][1] = $PlayersSplit2[1] $I = $I + 1 $P = $P + 1 $prog1 = $P * (100 / $Pmax) GUICtrlSetData($Progress1, $prog1) WEnd $I = 0 While $I < UBound($TownsSplit1) - 1 $TownsSplit2 = _StringExplode($TownsSplit1[$I], ",", 6) $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%AF", "ï") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%A7", "ç") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%AB", "ë") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%C3%A9", "é") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "%2A", "*") $TownsSplit2[2] = StringReplace($TownsSplit2[2], "+", " ") $TownsList[$I][0] = $TownsSplit2[1] $TownsList[$I][1] = $TownsSplit2[2] $I = $I + 1 $P = $P + 1 $prog1 = $P * (100 / $Pmax) GUICtrlSetData($Progress1, $prog1) WEnd _ArraySort($PlayersList, 0, 0, 0, 1) _ArraySort($TownsList, 0, 0, 0, 1) PlayerCombo() GUIDelete() EndFunc Func Gui() Local $aRange[14] = [True, @YEAR, @MON, @MDAY - 1, @HOUR, @MIN, @SEC, True, @YEAR, @MON, @MDAY, @HOUR, @MIN, @SEC] Local $date, $DTM_SETFORMAT_, $style #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate($Title, 689, 352, 456, 247) Global $Combo1 = GUICtrlCreateCombo("Speler", 272, 32, 185, 25) GUICtrlSetTip(-1, "Vult hier de naam in van de persoon met de Code Rood") Global $Combo2 = GUICtrlCreateCombo("Stad", 272, 56, 185, 25, $CBS_DROPDOWNLIST) GUICtrlSetTip(-1, "Vult hier de stadnaam in van de Code Rood") Global $Input1 = GUICtrlCreateInput("", 272, 176, 409, 21) GUICtrlSetTip(-1, "Plaats hier het rapport van de aanval dat de opstand veroorzaakt.") Global $Date1 = GUICtrlCreateDate(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN, 272, 80, 185, 21) $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd HH:mm" GUICtrlSendMsg($Date1, $DTM_SETFORMAT_, 0, $style) _GUICtrlDTP_SetRange(GUICtrlGetHandle($Date1), $aRange) Global $Combo3 = GUICtrlCreateCombo("God", 272, 104, 185, 25, $CBS_DROPDOWNLIST) Global $Checkbox1 = GUICtrlCreateCheckbox("Toren", 272, 152, 89, 25) Global $Combo4 = GUICtrlCreateCombo("Muur", 272, 128, 185, 25, $CBS_DROPDOWNLIST) $Label1 = GUICtrlCreateLabel('Om snel een "Code Rood" aan te maken volg deze stappen en u zal binnen 2 minuten klaar zijn.', 8, 8, 459, 17) $Label2 = GUICtrlCreateLabel("Selecteer hier de betreffende speler.", 8, 40, 175, 17) $Label3 = GUICtrlCreateLabel("Selecteer hier de betreffende stad.", 8, 64, 167, 17) $Label4 = GUICtrlCreateLabel("Noteer hier de tijd dat opstand aanval aangekomen is.", 8, 88, 259, 17) $Label5 = GUICtrlCreateLabel("Welke godheid heeft u in de betreffende stad.", 8, 112, 221, 17) $Label6 = GUICtrlCreateLabel("Wat is het level van uw muur in de betreffende stad.", 8, 136, 250, 17) $Label7 = GUICtrlCreateLabel("Heeft u een toren in de betreffende stad.", 8, 160, 196, 17) $Label8 = GUICtrlCreateLabel("Plaats hier het rapport van de opstand.", 8, 184, 187, 17) $Label9 = GUICtrlCreateLabel('Als u klaar bent met het invullen van de gegevens, klikt u op "Genereer Code Rood" ', 8, 280, 406, 17) $Label10 = GUICtrlCreateLabel("en dan kan u vervolgens de Code Rood plakken in het forum.", 8, 296, 296, 17) Global $Button1 = GUICtrlCreateButton("Genereer Code Rood", 272, 320, 153, 25) $Label11 = GUICtrlCreateLabel("Eenheden in de stad:", 8, 208, 105, 17) $Label12 = GUICtrlCreateLabel("Zwaardvechter", 72, 232, 76, 17) $Label13 = GUICtrlCreateLabel("Boogschutter", 72, 256, 67, 17) $Label14 = GUICtrlCreateLabel("Hopliet", 280, 232, 37, 17) $Label15 = GUICtrlCreateLabel("Strijdwagen", 280, 256, 59, 17) Global $Label16 = GUICtrlCreateLabel("God1", 464, 232, 50, 17) Global $Label17 = GUICtrlCreateLabel("God2", 464, 256, 50, 17) $Label18 = GUICtrlCreateLabel("Bireem", 640, 232, 36, 17) $Label19 = GUICtrlCreateLabel("Tireem", 640, 256, 36, 17) Global $Input2 = GUICtrlCreateInput(0, 9, 224, 55, 21, $ES_NUMBER & $ES_RIGHT) Global $Input3 = GUICtrlCreateInput(0, 8, 248, 57, 21, $ES_NUMBER & $ES_RIGHT) Global $Input4 = GUICtrlCreateInput(0, 208, 224, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input5 = GUICtrlCreateInput(0, 208, 248, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input6 = GUICtrlCreateInput(0, 392, 224, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input7 = GUICtrlCreateInput(0, 392, 248, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input8 = GUICtrlCreateInput(0, 568, 224, 65, 21, $ES_NUMBER & $ES_RIGHT) Global $Input9 = GUICtrlCreateInput(0, 568, 248, 65, 21, $ES_NUMBER & $ES_RIGHT) GUISetState(@SW_SHOW) GUISetState(@SW_DISABLE) #EndRegion ### END Koda GUI section ### LoadData() EasyCombo() Gods() GUISetState(@SW_ENABLE) WinActivate($Title) While 1 If $FP = GUICtrlRead($Combo1) Then Else If _ArraySearch($PlayersList, GUICtrlRead($Combo1)) > 1 Then If _GUICtrlComboBox_GetDroppedState($Combo1) = False Then ;Sleep(5000) FindPlayer(_GUICtrlComboBox_GetEditText($Combo1)) $FP = GUICtrlRead($Combo1) EndIf EndIf EndIf $L = StringLen(GUICtrlRead($Combo1)) $nMsg = GUIGetMsg() Switch $nMsg Case $Combo3 Gods() Case $Combo1 ;FindPlayer(_GUICtrlComboBox_GetEditText($Combo1)) Case $Button1 Generate() Case $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd EndFunc Func PlayerCombo() Local $I = 0 While $I < UBound($PlayersList) - 1 GUICtrlSetData($Combo1,$PlayersList[$I][1]) $I = $I + 1 $P = $P + 1 $prog1 = $P * (100 / $Pmax) GUICtrlSetData($Progress1, $prog1) WEnd EndFunc Func EasyCombo() GUICtrlSetData($Combo3,"Athene|Hades|Hera|Poseidon|Zeus") GUICtrlSetData($Combo4,"0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|Onbekend") EndFunc Func FindPlayer($C) Local $I = 0 Global $PlayerPlayerId = $PlayersList[_ArraySearch($PlayersList, $C)][0] $Form4 = GUICreate("Maiks CR Creator - Loading", 413, 20, 573, 372) $Progress1 = GUICtrlCreateProgress(0, 0, 409, 17) GUISetState(@SW_SHOW) _GUICtrlComboBoxEx_ResetContent(GUICtrlGetHandle($Combo2)) While $I < UBound($TownsList) - 1 If $PlayerPlayerId = $TownsList[$I][0] Then _GUICtrlComboBox_AddString(GUICtrlGetHandle($Combo2),$TownsList[$I][1]) EndIf $I = $I + 1 $prog1 = $I * (100 / UBound($TownsList)) GUICtrlSetData($Progress1, $prog1) WEnd GUIDelete() EndFunc Func Gods() Select Case "Athene" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Pegasus") GUICtrlSetData($Label17, "Centaur") $BBGod1 = " Pegasus" $BBGod2 = " Centaur" Case "Hades" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Cerberus") GUICtrlSetData($Label17, "Erinys") $BBGod1 = " Cerberus" $BBGod2 = " Erinys" Case "Hera" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Medusa") GUICtrlSetData($Label17, "Harpij") $BBGod1 = " Medusa" $BBGod2 = " Harpij" Case "Poseidon" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Cycloop") GUICtrlSetData($Label17, "Hydra") $BBGod1 = " Cycloop" $BBGod2 = " Hydra" Case "Zeus" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, "Minotaurus") GUICtrlSetData($Label17, "Manticore") $BBGod1 = " Minotaurus" $BBGod2 = " Manticore" Case "God" = GUICtrlRead($Combo3) GUICtrlSetData($Label16, " ") GUICtrlSetData($Label17, " ") $BBGod1 = " " $BBGod2 = " " EndSelect EndFunc Func Generate() Local $ClipPlayer = GUICtrlRead($Combo1) Local $ClipTown = $TownsList[_ArraySearch($TownsList, GUICtrlRead($Combo2))][0] Local $ClipGod = GUICtrlRead($Combo3) If $ClipGod = "God" then $ClipGod = "Onbekend" Local $ClipWall = GUICtrlRead($Combo4) If $ClipWall = "Muur" then $ClipWall = "Onbekend" If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then Local $ClipTower = "Ja" Else Local $ClipTower = "Nee" EndIf Local $ClipReport = GUICtrlRead($Input1) Local $ClipStartTime = _DateAdd("h", "12", GUICtrlRead($Date1)) Local $ClipEndTime = _DateAdd("h", "24", GUICtrlRead($Date1)) Local $ClipZwaardvechter = GUICtrlRead($Input2) Local $ClipBoogschutter = GUICtrlRead($Input3) Local $ClipHopliet = GUICtrlRead($Input4) Local $ClipStrijdwagen = GUICtrlRead($Input5) Local $ClipGod1 = GUICtrlRead($Input6) Local $ClipGod2 = GUICtrlRead($Input7) Local $ClipBireem = GUICtrlRead($Input8) Local $ClipTrireem = GUICtrlRead($Input9) ;consolewrite(GUICtrlRead($Date1)) ClipPut("Aanval op [town]" & $ClipTown & "[/town] van [player]" & $ClipPlayer & "[/player] " & @CRLF & "Godheid: "& $ClipGod & @CRLF & "Level muur: " & $ClipWall & @CRLF & "Toren: " & $ClipTower & @CRLF & "" & @CRLF & "[u][b]OpstandRapport:[/b][/u]" & @CRLF & $ClipReport & @CRLF & "[u]Opstand begint:[/u] " & $ClipStartTime & @CRLF & "[u]Opstand eindigt:[/u] " & $ClipEndTime & @CRLF & "" & @CRLF & "[u][color=#D60101]UPDATE:[/color][/u]" & @CRLF & "[u]OS aanwezig:[/u]" & @CRLF & $ClipZwaardvechter & " Zwaardvechter" & @CRLF & $ClipBoogschutter & " Boogschutter" & @CRLF & $ClipHopliet & " Hopliet" & @CRLF & $ClipStrijdwagen & " Strijdwagen" & @CRLF & $ClipGod1 & $BBGod1 & @CRLF & $ClipGod2 & $BBGod2 & @CRLF & $ClipBireem & " Bireem" & @CRLF & $ClipTrireem & " Trireem" & @CRLF & "" & @CRLF & "Overige informatie:") MsgBox(4096, $Title, "De Code Rood is gegenereerd, plak het nu in het forum.", 5) EndFunc Thanks for looking at it, is strange that multiple people confirmed that to error only occurs when Google chrome is active. I never get the error so i can't confirm or recreate the error. I have tried everything and i am working on the script every night after work but i just can find any relation in my script to Google chrome. Edited September 13, 2012 by maiks86 Link to comment Share on other sites More sharing options...
MrMitchell Posted September 13, 2012 Share Posted September 13, 2012 (edited) Is the error "Array variable subscript badly formatted"? Edited September 13, 2012 by MrMitchell Link to comment Share on other sites More sharing options...
maiks86 Posted September 13, 2012 Author Share Posted September 13, 2012 I have compiled it for the users and the error they get is "Line 6750 (File location) Array subscript badly formatted" Indeed. Link to comment Share on other sites More sharing options...
MrMitchell Posted September 13, 2012 Share Posted September 13, 2012 This line: Local $ClipTown = $TownsList[_ArraySearch($TownsList, GUICtrlRead($Combo2))][0] For me the _ArraySearch is returning -1 so and you can't do that with an array. You need error checking at least there, and probably other places as well. maiks86 1 Link to comment Share on other sites More sharing options...
JohnOne Posted September 13, 2012 Share Posted September 13, 2012 I'm curious why you referenced a function called update when you never made a function with that name. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
maiks86 Posted September 14, 2012 Author Share Posted September 14, 2012 @JohnOne.: Because i planned to use it but i changed my mind. Like i said i am new to scripting and i am just learning by making stuff. @MrMitchell.: Ok, could you give me an example. I never used error checking before. Link to comment Share on other sites More sharing options...
MrMitchell Posted September 14, 2012 Share Posted September 14, 2012 This is not so much error checking as it is validation, but for instance... Local $ClipTown = $TownsList[_ArraySearch($TownsList, GUICtrlRead($Combo2))][0] ;Create a new variable to hold the result of the _ArraySearch Local $ArraySearchTownList = _ArraySearch($TownsList, GUICtrlRead($Combo2)) ;Check if it's negative and if it is make it 0 (The function returns -1 on error and variable @error tells you why there's an error) If $ArraySearchTownList < 0 then $ArraySearchTownList = 0 Local $ClipTown = $TownsList[$ArraySearchTownList][0] You could go further and set it up so that if $ArraySearchTownList is -1 and @error is 6 (6 means value wasn't found in the array) then you can set $ClipTown to " " as opposed to using whatever is in $TownsList[0][0] Disclaimer: This isn't how I would do it but it's just an example to show that some variables need to be checked before using them in other functions. maiks86 1 Link to comment Share on other sites More sharing options...
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