Jump to content

To repeat lines of code and reconize events


Regency
 Share

Recommended Posts

Is the a way i can repeat this make the noted lines repeat after a certain amount of time? Noted line to the next noted line. And anyway i can make the Crimes section repeat after two min and GTA one after 4min? Or any way to make the script realize what the web page says like if it says "You need to wait" Can i make it realize it needs to wait the amount of time it says?

Run("C:\Program Files\Mozilla Firefox\firefox.exe http://www.TheMafiaNetwork.net")
AutoItSetOption("WinWaitDelay",250)
WinWaitActive ("TheMafiaNetwork - Mozilla Firefox")
Sleep(2000)
;Moves and clicks on Accout login.
MouseMove(572,334,10)
MouseClick("left") 
Send("Amped")
Sleep(1000)
;Moves mouse away for my own cool reasons.
MouseMove(741,335)
MouseClick("left")
Sleep(1000)
;Moves and clicks password login.
MouseMove(575,359,10)
MouseClick("left")
Send("****")
Sleep(1000)
;Clicks login
MouseMove(597,437,10)
MouseClick("left")
Sleep(4000)
;Scrolls down so it can click Crimes, and GTA's.
MouseClick("left",169,713,33)
-----------------MouseClick("left",35,416,2);Crimes     Noted line down to other noted line
Sleep(1000)
MouseClick("left",419,414,1);Sells Pirated Software
Sleep(3000)
MouseClick("left", 36,430,1);Clicks Gta's
Sleep(1000)
MouseClick("left",447,413,1);Clicks Residental Area
Sleep(900)
-------------MouseClick("left",604,541,1); Steals Car
Link to comment
Share on other sites

Maybe...

Run("C:\Program Files\Mozilla Firefox\firefox.exe [url="[url="http://www"]http://www[/url].TheMafiaNetwork.net%22"]http://www.TheMafiaNetwork.net"[/url])
AutoItSetOption("WinWaitDelay", 250)
WinWaitActive("TheMafiaNetwork - Mozilla Firefox")
Sleep(2000)
;Moves and clicks on Accout login.
MouseMove(572, 334, 10)
MouseClick("left")
Send("Amped")
Sleep(1000)
;Moves mouse away for my own cool reasons.
MouseMove(741, 335)
MouseClick("left")
Sleep(1000)
;Moves and clicks password login.
MouseMove(575, 359, 10)
MouseClick("left")
Send("****")
Sleep(1000)
;Clicks login
MouseMove(597, 437, 10)
MouseClick("left")
Sleep(4000)
;Scrolls down so it can click Crimes, and GTA's.
MouseClick("left", 169, 713, 33)

$begin = ""
$begin2 = ""
MyFunction()
$begin = TimerInit()
$begin2 = TimerInit()

While 1
    Sleep(10)
    $dif = Int(TimerDiff($begin)/1000)
    If $dif >= (2 * 60) Then MyFunction()
WEnd



Func MyFunction()
    MouseClick("left", 35, 416, 2);Crimes        Noted line down to other noted line
    Sleep(1000)
    MouseClick("left", 419, 414, 1);Sells Pirated Software
    Sleep(3000)
    $dif2 = Int(TimerDiff($begin2)/1000)
    If $dif2 >= (4 * 60) Then
        MouseClick("left", 36, 430, 1);Clicks Gta's
        $begin2 = TimerInit()
    EndIf
    Sleep(1000)
    MouseClick("left", 447, 413, 1);Clicks Residental Area
    Sleep(900)
    MouseClick("left", 604, 541, 1); Steals Car
EndFunc   ;==>MyFunction

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

AGH!!! Thank you so much i was trying to figure it out my self lol and it didnt work out to well.. it just sits there... Wanna see if you can figure it out? Why it just sits there?

Run("C:\Program Files\Mozilla Firefox\firefox.exe http://www.TheMafiaNetwork.net")
AutoItSetOption("WinWaitDelay",250)
WinWaitActive ("TheMafiaNetwork - Mozilla Firefox")

$Login = 1
$Crimes = 1
$GTA = 1
$CrimesFrequency = 125000
$GTAFrequency = 245000

Func Login()
    If $Login = 1 Then
        Sleep(2000)
;Moves and clicks on Accout login.
MouseMove(572,334,10)
MouseClick("left") 
Send("Amped")
Sleep(1000)
;Moves mouse away for my own cool reasons.
MouseMove(741,335)
MouseClick("left")
Sleep(1000)
;Moves and clicks password login.
MouseMove(575,359,10)
MouseClick("left")
Send("mine")
Sleep(1000)
;Clicks login
MouseMove(597,437,10)
MouseClick("left")
Sleep(4000)
EndIf
EndFunc 

Func Crimes()
    If $Crimes = 1 Then
    ;Scrolls down so it can click Crimes, and GTA's.
MouseClick("left",169,713,33)
MouseClick("left",35,416,2);Crimes
Sleep(1000)
MouseClick("left",419,414,1);Sells Pirated Software
Sleep(3000)
EndIf
EndFunc

Func GTA()
    If $GTA = 1 Then
        MouseClick("left", 36,430,1);Clicks Gta's
Sleep(1000)
MouseClick("left",447,413,1);Clicks Residental Area
Sleep(900)
MouseClick("left",604,541,1); Steals Car
EndIf
EndFunc

$timer1 = TimerInIt()
$timer2 = Timerinit()

While 1
    If TimerDiff($timer1) > 125000 Then
        Crimes()
        $timer1 = Timerinit()
    EndIf
Wend
    If TimerDiff($timer2) > 245000 Then
        GTA()
        $timer2 = Timerinit()
    EndIf
    Sleep (50)
Link to comment
Share on other sites

Mixing functions and code like that is really not nice toward us old-timers who got a good slapping if we did when we learned to do this stuff..:)

Does your code ever pass this line:

WinWaitActive ("TheMafiaNetwork - Mozilla Firefox")
Link to comment
Share on other sites

Mixing functions and code like that is really not nice toward us old-timers who got a good slapping if we did when we learned to do this stuff..:)

Does your code ever pass this line:

WinWaitActive ("TheMafiaNetwork - Mozilla Firefox")

No, not in the script case i posted above. but my script that doesnt try and repeat works fine. No, in terms it just sits there.. any fix? And having trouble with the other persons script. It works for the first time it uses the intervals then it just starts to do them over and over and does not use the intervals...

Link to comment
Share on other sites

If you don't pass that line you newer get a active window (foreground) with that title. So, basically, you have told your script to hang there until you get a active window with that title.

The loop code does not look good to me. But that is just a hunch..:)

Link to comment
Share on other sites

If you don't pass that line you newer get a active window (foreground) with that title. So, basically, you have told your script to hang there until you get a active window with that title.

The loop code does not look good to me. But that is just a hunch..:)

Thanks lol and i tried taking that section out and still same result...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...