Jump to content
Sign in to follow this  
Nitto

Loops?

Recommended Posts

Nitto

i wanna make this code repeat X number of times but don't know how to code it, help always appreciated also corrections. THANKS

; Script Start - Add your code below here

AutoItSetOption ("CaretCoordMode", 0)

WinMinimizeAll()

WinActivate("Nitto 1320 Challenge")

;How do i put loop

MouseClick("left", 729, 513);Online Challenge

Sleep(2100)

MouseClick("left", 393, 451);Select Racer

Sleep(3200)

MouseClick("left", 674, 642);Select Car

Sleep(500)

MouseClick("left", 586, 634);OK Car Ready

Sleep(500)

MouseClick("left", 459, 468);Select Bracket

Sleep(500)

MouseClick("left", 786, 513);Ok Bracket

Sleep(500)

MouseClick("left", 405, 462);Race for Fun

Sleep(500)

MouseClick("left", 474, 468);Select Track and Lane

Sleep(500)

MouseClick("left", 733, 611);Start The Race

Sleep(4200)

MouseClick("left", 310, 386);Set R/T

Sleep(500)

Send("^a")

Send(StringLeft(Random(0.510, 0.545), 5))

MouseClick("left", 310, 419);Set E/T

Sleep(500)

Send("^a")

Send(StringLeft(Random(6.230, 6.250), 5))

MouseClick("left", 312, 455);Set MPH

Sleep(500)

Send("^a")

Send(StringLeft(Random(204.00, 205.00), 6))

MouseClick("left", 289, 481);Set

Sleep(1300)

MouseClick("left", 717, 498);Race Someone Else

Sleep(500)

Edited by Nitto

Share this post


Link to post
Share on other sites
Generator

Try this?

; Script Start - Add your code below here

AutoItSetOption ("CaretCoordMode", 0)
WinMinimizeAll()
WinActivate("Nitto 1320 Challenge")

;How do i put loop
For $i=1 to 5
MouseClick("left", 729, 513);Online Challenge
Sleep(2100)
MouseClick("left", 393, 451);Select Racer
Sleep(3200)
MouseClick("left", 674, 642);Select Car
Sleep(500)
MouseClick("left", 586, 634);OK Car Ready
Sleep(500)
MouseClick("left", 459, 468);Select Bracket
Sleep(500)
MouseClick("left", 786, 513);Ok Bracket
Sleep(500)
MouseClick("left", 405, 462);Race for Fun
Sleep(500)
MouseClick("left", 474, 468);Select Track and Lane
Sleep(500)
MouseClick("left", 733, 611);Start The Race
Sleep(4200)
MouseClick("left", 310, 386);Set R/T
Sleep(500)
Send("^a")
Send(StringLeft(Random(0.510, 0.545), 5))
MouseClick("left", 310, 419);Set E/T
Sleep(500)
Send("^a")
Send(StringLeft(Random(6.230, 6.250), 5))
MouseClick("left", 312, 455);Set MPH
Sleep(500)
Send("^a")
Send(StringLeft(Random(204.00, 205.00), 6))
MouseClick("left", 289, 481);Set
Sleep(1300)
MouseClick("left", 717, 498);Race Someone Else
Sleep(500) 
Next

Share this post


Link to post
Share on other sites
Paulie

Loops 3 times

AutoItSetOption ("CaretCoordMode", 0)
WinMinimizeAll()
WinActivate("Nitto 1320 Challenge")
$Times = 3
$i=0
Do

;How do i put loop

MouseClick("left", 729, 513);Online Challenge
Sleep(2100)
MouseClick("left", 393, 451);Select Racer
Sleep(3200)
MouseClick("left", 674, 642);Select Car
Sleep(500)
MouseClick("left", 586, 634);OK Car Ready
Sleep(500)
MouseClick("left", 459, 468);Select Bracket
Sleep(500)
MouseClick("left", 786, 513);Ok Bracket
Sleep(500)
MouseClick("left", 405, 462);Race for Fun
Sleep(500)
MouseClick("left", 474, 468);Select Track and Lane
Sleep(500)
MouseClick("left", 733, 611);Start The Race
Sleep(4200)
MouseClick("left", 310, 386);Set R/T
Sleep(500)
Send("^a")
Send(StringLeft(Random(0.510, 0.545), 5))
MouseClick("left", 310, 419);Set E/T
Sleep(500)
Send("^a")
Send(StringLeft(Random(6.230, 6.250), 5))
MouseClick("left", 312, 455);Set MPH
Sleep(500)
Send("^a")
Send(StringLeft(Random(204.00, 205.00), 6))
MouseClick("left", 289, 481);Set
Sleep(1300)
MouseClick("left", 717, 498);Race Someone Else
Sleep(500)
$i+=1
Until $i=3

EDIT: Beaten... :)

Edited by Paulie

Share this post


Link to post
Share on other sites
Nitto

Thanks, if i change the 5 for 10 it will be repeated 10 times??

For $i=1 to 5

Share this post


Link to post
Share on other sites
Nitto

Anyone could also tell me how to put a command to exit the script please.

Share this post


Link to post
Share on other sites
evilertoaster

Exit

Tell me that isn't epic...

Share this post


Link to post
Share on other sites
PsaltyDS

ExitoÝ÷ Ù7¥g­«b²}ýµêbsú®¢×­ìb¶Ø^Jkjz7öË®*mjëh×6If LearnToParallelPark($Meadow) Then Exit

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Generator

Add a hotkey if you want to

Example:

HotKeySet("{ESC}","_Quit")
;Rest script goes here
Func _Quit()
Exit
EndFunc

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×