Sritra Posted March 2, 2013 Share Posted March 2, 2013 (edited) expandcollapse popup#include <File.au3> #include <GuiConstants.au3> #include <ImageSearch.au3 #cs----------------------------------------------------- #ce---------------------------------------------------- Global $x=0 Global $y=0 Global $x1=0 Global $y1=0 Global $xs=0 Global $ys=0 Global $w=0 Global $l=0 GLobal $p="p" Global $z=0 Global $res=0 Global $ret=0 Global $mode=0 Global $xbot=0 Global $ybot=0 Global $add=0 Global $watlos=0 HotKeySet("ß","kill") SplashImageOn("Feuer","Feuer.gif",130,130,@DesktopWidth-130,@DesktopHeight-170,1) Global $GUI_MENU = GUICreate("Menu",780,255,@DesktopWidth/2-390,@DesktopHeight/2-128) Global $B1=GUICtrlCreateButton("lvl 1",5,5,150,30) Global $B2=GUICtrlCreateButton("lvl 2",160,5,150,30) Global $B3=GUICtrlCreateButton("lvl 3",315,5,150,30) Global $B4=GUICtrlCreateButton("lvl 4",470,5,150,30) Global $B5=GUICtrlCreateButton("lvl 5",625,5,150,30) Global $Bpvp1=GUICtrlCreateButton("pvp 1",5,40,150,30) Global $Bpvp2=GUICtrlCreateButton("pvp 2",160,40,150,30) Global $Bbronze=GUICtrlCreateButton("bronze",5,75,150,30) Global $Bsilver=GUICtrlCreateButton("silver",160,75,150,30) Global $Bgold=GUICtrlCreateButton("gold",315,75,150,30) Global $Bplatinum=GUICtrlCreateButton("platinum",470,75,150,30) Global $Botg=GUICtrlCreateButton("end match",5,110,150,30) Global $Bstats=GUICtrlCreateButton("view stats",5,165,150,30) Global $Bsave=GUICtrlCreateButton("save stats",160,165,150,30) Global $Bload=GUICtrlCreateButton("load stats",317,165,150,30) Global $Breset=GUICtrlCreateButton("reset stats",470,165,150,30) Global $Bexit=GUICtrlCreateButton("exit",5,220,150,30) Global $Boptions=GUICtrlCreateButton("options",160,220,150,30) Global $Bhelp=GUICtrlCreateButton("HELP!",625,220,150,30) load() $res =_ImageSearch("ecke.png",1,$xs,$ys,0) while $res=0 $res =_ImageSearch("ecke.png",1,$xs,$ys,0) $msg=MsgBox(5,"Attention","You should now be logged in & in the menu of elements") If $msg=2 Then Exit EndIf WEnd pause() while 1 sleep(20) WEnd Func main($mode,$xbot,$ybot) while 1 Auswahl($mode,$xbot,$ybot) sleep(200) While PixelGetColor($xs-44,$ys+269)<>0x934B33 And PixelGetColor($xs-66,$ys+35)<>0xFFCC66 MouseMove($xs-422,$ys+1) Do sleep(20) Until PixelGetColor($xs-422,$ys+1)=0x01A0F09 Or PixelGetColor($xs-66,$ys+35)=0xFFCC66 If PixelGetColor($xs-66,$ys+35)<>0xFFCC66 Then For $i=0 To 7 MouseClick("left",$xs+226,$ys+448-23*$i,1,2) Next For $i=0 To 7 MouseClick("left",$xs-377+65*$i,$ys+342,1,2) MouseClick("left",$xs-37,$ys+279,1,2) Next Send("{Space}") MouseClick("left",$xs+235,$ys+279,1,2) sleep(2000) EndIf sleep(500) WEnd if PixelGetColor($xs-66,$ys+35)=0xFFCC66 Then If $mode=2 Then MouseClick("left",$xs-197,$ys+396,1,2) EndIf MouseClick("left",$xs-143,$ys+315,1,2) stats(0,1) elseif PixelGetColor($xs-44,$ys+269)=0x934B33 Then MouseClick("left",$xs-72,$ys+346,1,2) sleep(10000) MouseClick("left",$xs-143,$ys+476,1,2) stats(0,0) Endif sleep(200) If $mode=3 Then Return 0 EndIf WEnd EndFunc Func Auswahl($mode,$xbot,$ybot);0=bot,1=pvp,2=Arena,3=on the go If $mode=0 Then MouseClick("left",$xbot,$ybot,1,2) ElseIf $mode=1 Then MouseClick("left",$xbot,$ybot,1,2) Do sleep(20) Until PixelGetColor($xs-144,$ys+317)=0xD8D7D7 MouseClick("left",$xs-144,$ys+317,1,2) ElseIf $mode=2 Then If PixelGetColor($xs-495,$ys+)<>0xF1DCBE Then MouseClick("left",$xs+46,$ys+67,1,2) EndIf Do sleep(20) Until PixelGetColor($xs-391,$ys+194)=0x040433 MouseClick("left",$xbot,$ybot,1,2) sleep(200) MouseClick("left",$xs-374,$ys+403,1,2) EndIf EndFunc Func stats($watlos,$add) If $watlos=0 Then If $add=1 Then $l=$l+1 Else $w=$w+1 EndIf ElseIf $watlos=1 Then MsgBox(0,"Your Stats", "Wins:"&$w&" Looses:"&$l&" Games played:"&$l+$w) Else _FileWriteToLine("Savegame.txt",1,"0",1) _FileWriteToLine("Savegame.txt",2,"0",1) MsgBox(0,"Reset","Your stats have been resetted") EndIf EndFunc Func pause() GUISetState(@sw_show) while 1 $msg=GUIGetMsg() Switch $msg Case $B1 GUISetState(@SW_HIDE, $GUI_MENU) main(0,$xs-166,$ys+147) Case $B2 GUISetState(@SW_HIDE, $GUI_MENU) main(0,$xs-66,$ys+147) Case $B3 GUISetState(@SW_HIDE, $GUI_MENU) main(0,$xs+34,$ys+147) Case $B4 GUISetState(@SW_HIDE, $GUI_MENU) main(0,$xs+134,$ys+147) Case $B5 GUISetState(@SW_HIDE, $GUI_MENU) main(0,$xs+234,$ys+147) Case $Bpvp1 GUISetState(@SW_HIDE, $GUI_MENU) main(1,$xs-311,$ys+326) Case $Bpvp2 GUISetState(@SW_HIDE, $GUI_MENU) main(1,$xs-62,$ys+326) Case $Bbronze GUISetState(@SW_HIDE, $GUI_MENU) main(2,$xs-424,$ys+163) Case $Bsilver GUISetState(@SW_HIDE, $GUI_MENU) MsgBox(1,"Not availible now","Will be added in a further version") Case $Bgold GUISetState(@SW_HIDE, $GUI_MENU) MsgBox(1,"Not availible now","Will be added in a further version") Case $Bplatinum GUISetState(@SW_HIDE, $GUI_MENU) MsgBox(1,"Not availible now","Will be added in a further version") Case $Botg GUISetState(@SW_HIDE, $GUI_MENU) main(3,0,0) Case $Bstats stats(1,0) Case $Bsave Save() Case $Bload Load() Case $Breset $ret=MsgBox(4,"Reset","Are You sure that You want to reset your stats?") If $ret=6 Then stats(2,0) EndIf Case $Bexit $ret=MsgBox(4,"Exit","Save & Exit?") If $ret=6 Then Save() Exit Else $ret=MsgBox(4,"Exit","Exit without saving?") If $ret=6 Then Exit EndIf EndIf Case $Boptions GUISetState(@sw_HIDE, $GUI_MENU) $p=Inputbox("Options","Menu HotKey (only 1 sign!!!)","Default: p") $z=MsgBox(4,"Options","Enable pic while running?")-6 If $z=1 Then SplashOff() EndIf if $z=0 Then SplashImageOn("Feuer","Feuer.gif",130,130,@DesktopWidth-130,@DesktopHeight-170,1) EndIf Load() GUISetState(@sw_ShOW, $GUI_MENU) Case $Bhelp MsgBox(1,"","") EndSwitch WEnd EndFunc Func Terminate() $ret=MsgBox(4,"Exit","Save & Exit?") If $ret=6 Then Save() Exit Else $ret=MsgBox(4,"Exit","Exit without saving?") If $ret=6 Then Exit EndIf EndIf EndFunc Func Save() $ret=MsgBox(4,"Save","Are You sure that You want to overwrite?") If $ret=6 Then _FileWriteToLine("Savegame.txt",1,$w,1) _FileWriteToLine("Savegame.txt",2,$l,1) _FileWriteToLine("Savegame.txt",3,$p,1) _FileWriteToLine("Savegame.txt",4,$z,1) EndIf EndFunc Func Load() $w = FileReadLine("Savegame.txt",1) $l = FileReadLine("Savegame.txt",2) $p = FileReadLine("Savegame.txt",3) $z = FileReadLine("Savegame.txt",4) HotKeySet ($p,"pause") If $z=0 Then SplashImageOn("Feuer","Feuer.gif",130,130,@DesktopWidth-130,@DesktopHeight-170,1) EndIf EndFunc Func kill() Exit 0 EndFunc Well, this is my first programm. it works fine when its running via AutoIt.exe, and i can even compile it w/o an Error, but when i trie to execute it, it says: "AutoIt Error Line 48 (File "C:[...]elementsneu.exe"): Error: Subscript used with non-Array variable." As You see I declared all variables as global at the beginning, because i though this could occure the problem. I have no idea where this error comes from. Did i forget to #include something?? Edited March 2, 2013 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2013 Moderators Share Posted March 2, 2013 Sritra,Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. M23P.S. If you post code again please use Code tags - put [autoit] before and [/autoit] after your posted code. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts