Ryan Posted May 7, 2009 Share Posted May 7, 2009 (edited) The script starts with "Character #1" vars. I want the script to loop and use the "Character #2" vars. Is there anyway to do this? Thanks in advance expandcollapse popup$fullAuto = 1 $CheatPatch = "" $CheatEngine = "" $batchPath = "" $sbot = "" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Character #1 $botpath1 = "" $id1 = "user1" $pass1 = "password1" $character1 = 1 $character1Count1 = 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Character #2 $botpath2 = "" $id2 = "user2" $pass2 = "password2" $character2 = 1 $character1Count2 = 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $sbotHandle = 0 If $fullAuto = 1 Then ;Start SBot Run($botpath1 & "\" & $sbot, $botpath1) WinWait("SBot", "") If Not WinActive("SBot", "") Then WinActivate("SBot", "") EndIf Sleep(5000) $windows = WinList("SBot") If $windows[0][0] <> 1 Then MsgBox(0, "SBot", "Unable to find the single SBot window!") EndIf $sbotHandle = $windows[1][1] ;Start SRO_Client ;MouseClick("left", 200, 300) ControlClick("SBot", "", 169) EndIf ;Wait for SRO_Client, safe for all resolutions WinWait("SRO_Client", "") While 1 If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf $client = WinGetClientSize("SRO_Client", "") $pixel1 = $client[1] * 0.968 $pixel2 = $client[0] * 0.073 $pixel3 = $client[1] * 0.993 $koord = PixelSearch(0, $pixel1, $pixel2, $pixel3, 0xFF8080, 1) If Not @error Then If PixelGetColor($koord[0], $koord[1]) = 0xFF8080 Then ExitLoop EndIf EndIf WEnd Sleep(2000) $client = WinGetClientSize("SRO_Client", "") MouseMove($client[0]-10, $client[1]/2) ;Login If $fullAuto = 1 Then Send("{BS}") Sleep(100) Send($id1) Sleep(100) Send("{TAB}") Sleep(100) Send($pass1) Sleep(2000) EndIf Sleep(100) $checksumLoginTop = PixelChecksum(0, $client[1] * 0.08, $client[0] * 0.3, $client[1] * 0.12) $checksumLoginWindow = PixelChecksum($client[0]/2 + 60, $client[1]/2 + 50, $client[0]/2 + 100, $client[1]/2 + 100) $checksumImageCode = 0 $checksumImageCodeValid = 0 $checksumBlockedY = 0 If $client[1] < 700 Then $checksumBlockedY = 550 ElseIf $client[1] < 900 Then $checksumBlockedY = 660 Else $checksumBlockedY = $client[1] * 0.9 - 10 EndIf $checksumBlocked = PixelChecksum(350, $checksumBlockedY, 400, $client[1] - 2) Sleep(100) Send("{ENTER}") ;Start Cheat Engine If $fullAuto = 1 Then Run($CheatPatch & "\" & $CheatEngine, $CheatPatch) WinWait("Cheat Engine", "") If Not WinActive("Cheat Engine", "") Then WinActivate("Cheat Engine", "") EndIf Sleep(5000) $windows = WinList("Cheat Engine") Sleep(1000) ControlClick("Cheat Engine 5.5", "", 169, "", 5) Sleep(1000) MouseClick ("left",25,50) Sleep(500) MouseClick ("left",410,250) Send ("{DOWN 150}") Sleep (500) Send ("{UP 1}") Sleep(500) Send ("{ENTER}") Sleep (500) MouseClick ("left", 910,250) Sleep(500) MouseClick ("left", 970,270) Sleep(500) Send("{BACKSPACE 3}") Sleep(500) Send("600") MouseClick ("left", 970,340) EndIf ;Image Code Loop While 1 If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf Sleep(100) $state = 0 $stateCounter = 0 While 1 Sleep(100) If $checksumLoginTop <> PixelChecksum(0, $client[1] * 0.08, $client[0] * 0.3, $client[1] * 0.12) Then $state = 2; logged in ExitLoop Else $checksumImageCodeTemp = PixelChecksum($client[0]/2 + 60, $client[1]/2 + 50, $client[0]/2 + 100, $client[1]/2 + 100) If $checksumImageCodeTemp = $checksumLoginWindow Then $state = 0 Sleep(500) Else If $checksumImageCodeValid = 0 Then $checksumImageCode = $checksumImageCodeTemp $checksumImageCodeValid = 1 $state = 1; image code ExitLoop ElseIf $checksumImageCode = $checksumImageCodeTemp Then $state = 1; image code ExitLoop Else $state = 0 $stateCounter = $stateCounter + 1 Sleep(500) If $stateCounter > 10 Then $checksumImageCode = $checksumImageCodeTemp $state = 1; image code ExitLoop EndIf EndIf EndIf EndIf WEnd Sleep(100) If $state = 1 Then ;Image code ;Clear Screenshot directory RunWait($batchPath & "\clear_screenshots.bat") Sleep(1000) If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf Sleep(1500) ;Take Screenshot Send("{PRINTSCREEN}") Sleep(1500) ;Call the decoder RunWait($batchPath & "\decode.bat") Sleep(1000) If Not WinActive("SRO_Client", "") Then WinActivate("SRO_Client", "") EndIf Sleep(100) ;Read the code $handle = FileOpen($batchPath & "\code.txt", 0) $code = FileReadLine($handle) FileClose($handle) ;Send the code Send($code) Sleep(100) Send("{ENTER}") ;Be sure this image code window disappeared before next loop, ;if a new image code window appears, continue on the new one Sleep(5000) ElseIf $state = 2 Then ;logged in ExitLoop EndIf WEnd ;Logged in... Sleep(2000) WinKill("Cheat Engine") ;Choose Character $character1Selected = 0 If $fullAuto = 1 Then Sleep(1000) If $character1Count1 = 1 Then If $character1 = 1 Then MouseClick("left", $client[0]/2, $client[1]/2) $character1Selected = 1 EndIf ElseIf $character1Count1 = 2 Then If $character1 = 1 Then MouseClick("left", $client[0]/4, $client[1]/2) $character1Selected = 1 ElseIf $character1 = 2 Then MouseClick("left", $client[0]*3/4, $client[1]/2) $character1Selected = 1 EndIf ElseIf $character1Count1 = 3 Then If $character1 = 1 Then MouseClick("left", $client[0]/6, $client[1]/2) $character1Selected = 1 ElseIf $character1 = 2 Then MouseClick("left", $client[0]*3/6, $client[1]/2) $character1Selected = 1 ElseIf $character1 = 3 Then MouseClick("left", $client[0]*5/6, $client[1]/2) $character1Selected = 1 EndIf EndIf EndIf If $fullAuto = 1 And $character1Selected <> 0 Then ;Click on "Start" after character selection Sleep(1500) If $client[1] < 700 Then MouseClick("left", $client[0] - 268, 700) ElseIf $client[1] < 900 Then MouseClick("left", $client[0] - 268, 720) Else MouseClick("left", $client[0] - 268, $client[1] * 0.9) EndIf Sleep(3000) ;Start Auto Training :) $windows = WinList() $sbotTitle = "SBot" For $i = 0 To $windows[0][0] If $windows[$i][1] = $sbotHandle Then $sbotTitle = $windows[$i][0] ExitLoop EndIf Next WinActivate($sbotTitle, "") Sleep(6500) ;Start Training ControlClick($sbotTitle, "", 538) Send("{TAB}") Sleep(100) Send("{DOWN 3}") Sleep(100) Send("{ENTER}") ;Go Clientless Sleep(3000) ControlClick($sbotTitle, "", 170) EndIf Exit Edited May 7, 2009 by Ryan Link to comment Share on other sites More sharing options...
Khab Posted May 7, 2009 Share Posted May 7, 2009 Do you want it to just run through once for each set of parameters, or keep looping and alternating between the two sets? My suggestion would be to make the main part of the script itself a function, then you can set the parameters then call the function. $paramset1 = hi $paramset2 = bye func() dostuffwith $paramset endfunc while 1 $paramset = $paramset1 func() $paramset = $paramset2 func() wend Hope that's clear, in a bit of a rush at work atm Link to comment Share on other sites More sharing options...
Ryan Posted May 7, 2009 Author Share Posted May 7, 2009 (edited) Basically i want to use: $id= "user id" in the script. I then want the script to restart and use... $id2= "second id" the second times it runs. so would $paramset2 = bye func() dostuffwith $paramset endfunc while 1 $paramset = $paramset1 func() $paramset = $paramset2 func() wend be my best bet? Edited May 7, 2009 by Ryan 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