programermcgeek Posted October 21, 2006 Posted October 21, 2006 Hello, I'm trying to make a script...it reads functions from a file, and then executes them, okay, heres my problem...I need to preform the functions over and over in a continuos loop...Code: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.1.1.0 Author: Erik Karlin aka iRRVi Script Function: stuff >.> #ce ---------------------------------------------------------------------------- HotKeySet( "{DEL}", "ExitProg" ) TrayTip ( "eliteRune", "eliteRune at yer service", 3) Dim $xstart, $ystart, $xend, $yend, $color, $pixel[1], $place, $xcenter, $ycenter, $script[128], $c, $param[128][8], $fileline;$filename, $file ;$filename = InputBox ( "eliteRune", "Which file, sir?" ) ;$file = FileOpen( $filename, 0 ) $xstart = 125 $ystart = 210 $xend = 635 $yend = 545 $xcenter = ($xend - $xstart) + $xstart $ycenter = ($yend - $ystart) + $ystart ;$color = InputBox ( "eliteRune", "eliteRune: please choose the color in hex" ) ;$option = InputBox ( "eliteRune", "eliteRune: which optrion do I need to click?" ) $place = 0; 0 = top, 1 = left, 2 = right, 3 = bottom TrayTip("eliteRune", "Scripting in progress...", 10) For $c = 0 To 128 $script[$c] = InputBox("eliteRune", "Instruction?") If $script[$c] == "end" Then ExitLoop EndIf Switch $script[$c] Case "Click Color" $param[$c][0] = InputBox("eliteRune", "Color?") $param[$c][1] = InputBox("eliteRune", "Option #?") Case "Click Position" $param[$c][0] = InputBox("eliteRune", "Position to click?(x)") $param[$c][1] = InputBox("eliteRune", "Position to click?(y)") Case "Wait" $param[$c][0] = InputBox("eliteRune", "How long to wait? (in miliseconds)") Case "File" $param[$c][0] = InputBox("eliteRune", "Which file?") Case Else MsgBox(1, "eliteRune", "ERROR! Function not found, shutting down...") Exit EndSwitch Next TrayTip ( "eliteRune", "eliteRune waiting for Runescape to be active in Internet Explorer", 3) WinGetHandle("RuneScape - the massive online adventure game by Jagex Ltd - Microsoft Internet Explorer") WinWaitActive("RuneScape - the massive online adventure game by Jagex Ltd - Microsoft Internet Explorer") while 1 Main() Sleep( 1000 ) WEnd Func Main() While 1 For $c = 0 To 128 Switch $script[$c] Case "Click Color" TrayTip ( "eliteRune", "eliteRune finding color", 3) $pixel = PixelSearch($xstart, $ystart, $xend, $yend, $param[$c][0], 1) TrayTip ( "eliteRune", "eliteRune choosing option", 3) ChooseOption($param[$c][1], $pixel[0], $pixel[1]) Case "Click Position" MouseClick("left", $param[$c][0], $param[$c][1]) Case "Wait" Sleep($param[$c][0]) Case "end" ExitLoop Case "File" While 1 $param[$c][1] = FileOpen( $param[$c][0], 0 ) While @error <> -1 $fileline = FileReadLine( $param[$c][1] ) Switch $fileline Case "Click Color" TrayTip ( "eliteRune", "eliteRune finding color", 3) $pixel = PixelSearch($xstart, $ystart, $xend, $yend, FileReadLine($param[$c][1]), 1) TrayTip ( "eliteRune", "eliteRune choosing option", 3) ChooseOption(FileReadLine($param[$c][1]), $pixel[0], $pixel[1]) Case "Click Position" MouseClick("left", FileReadLine($param[$c][1]), FileReadLine($param[$c][1])) Case "Wait" Sleep(FileReadLine($param[$c][1])) Case Else MsgBox(1, "eliteRune", "ERROR! Function not found!") Exit EndSwitch WEnd FileClose($param[$c][1]) WEnd EndSwitch Next WEnd EndFunc Func ChooseOption($whichoption, $xclick, $yclick) MouseClick("right", $xclick, $yclick, 1, 0) $yoptcoord = CalcOptCoords($yclick, $whichoption - 1) MouseClick("left", $xclick, $yoptcoord) EndFunc Func CalcOptCoords($origclick, $optnum) $working = $origclick + 25 $working2 = $optnum * 17 $end = $working + $working2 Return $end EndFunc Func ExitProg() Exit EndFunc someday, in the far future, spam will own the world...
jvanegmond Posted October 22, 2006 Posted October 22, 2006 (edited) programermcgeek, I have no clue to what your question is. You seem to pretty much have the knowledge required to loop a function. And you already do, so I don't see what's bothering you here... #include ??I also wanted to share my attempt at a AutoMiner, http://www.autoitscript.com/forum/index.ph...c=28984&hl= Edited October 22, 2006 by Manadar github.com/jvanegmond
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