Sign in to follow this  
Followers 0
mHt

Need Help With Loop...

26 posts in this topic

#1 ·  Posted (edited)

Some days ago i posted here, asked for someone to code a "bot" for me... A few minutes later, i realized how lame i was, so i started learning a little in AI...

So, here's my problem, I just want to know the best method to loop the following code for ever, until i press a sertain button.. You dont have to write it in my script, you can just tell me the method..

MouseClick("Primary", 43, 773, 1, 10 )
sleep (1000)
MouseClick("Primary", 401, 436, 1, 10 )
sleep (1000)
MouseClick("Primary", 756, 512, 1, 10 )
sleep (2000)
; Regual Crime
MouseClick("Primary", 37, 808, 1, 10 )
sleep (1000)
MouseClick("Primary", 402, 579, 1, 10 )
sleep (1000)
MouseClick("Primary", 745, 605, 1, 10 )
sleep (2000)
; Extortion
MouseClick("Primary", 34, 909, 1, 10 )
sleep (1000)
MouseClick("Primary", 627, 478, 1, 10 )
sleep (2000)

Thanks m8's!

Edited by mHt

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

while 1
MouseClick("Primary", 43, 773, 1, 10 )
sleep (1000)
MouseClick("Primary", 401, 436, 1, 10 )
sleep (1000)
MouseClick("Primary", 756, 512, 1, 10 )
sleep (2000)
; Regual Crime
MouseClick("Primary", 37, 808, 1, 10 )
sleep (1000)
MouseClick("Primary", 402, 579, 1, 10 )
sleep (1000)
MouseClick("Primary", 745, 605, 1, 10 )
sleep (2000)
; Extortion
MouseClick("Primary", 34, 909, 1, 10 )
sleep (1000)
MouseClick("Primary", 627, 478, 1, 10 )
sleep (2000)
wend

press a to stop it make sure you put this at the top of the script #include<misc.au3>

Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

Thanks! that worked fine!! ok! another question :whistle:

Is it possible to greate a small gui with 2 buttons, like start, and exit ?

Share this post


Link to post
Share on other sites

Thanks! that worked fine!! ok! another question :whistle:

Is it possible to greate a small gui with 2 buttons, like start, and exit ?

yea just a min ill edit this when im done

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

Try this...

#Include<misc.au3>
While Not _IsPressed("1B") ; While Esc key is not pressed, this way when you press esc you will exit the program
MouseClick("Primary", 43, 773, 1, 10 )
sleep (1000)
MouseClick("Primary", 401, 436, 1, 10 )
sleep (1000)
MouseClick("Primary", 756, 512, 1, 10 )
sleep (2000)
; Regual Crime
MouseClick("Primary", 37, 808, 1, 10 )
sleep (1000)
MouseClick("Primary", 402, 579, 1, 10 )
sleep (1000)
MouseClick("Primary", 745, 605, 1, 10 )
sleep (2000)
; Extortion
MouseClick("Primary", 34, 909, 1, 10 )
sleep (1000)
MouseClick("Primary", 627, 478, 1, 10 )
sleep (2000)
WEndoÝ÷ Øêí+0k(Ê°j{m¢®±ê+j|­)àjëh×6Global $Bool=0; Global a boolean type variable, and set to 0 which is off
While 1
If _IsPressed("13") Then ; If PAUSE key is pressed
Do
Sleep(1) ;Temp sleep
Until Not _IsPressed("13") ;To prevent multi detection while key is being held down
$Bool=Not $Bool ; Change 0 to 1
EndIf
While $Bool ; While Bool=1
MouseClick("Primary", 43, 773, 1, 10 )
sleep (1000)
MouseClick("Primary", 401, 436, 1, 10 )
sleep (1000)
MouseClick("Primary", 756, 512, 1, 10 )
sleep (2000)
; Regual Crime
MouseClick("Primary", 37, 808, 1, 10 )
sleep (1000)
MouseClick("Primary", 402, 579, 1, 10 )
sleep (1000)
MouseClick("Primary", 745, 605, 1, 10 )
sleep (2000)
; Extortion
MouseClick("Primary", 34, 909, 1, 10 )
sleep (1000)
MouseClick("Primary", 627, 478, 1, 10 )
sleep (2000)
WEnd
WEnd

Share this post


Link to post
Share on other sites

When i edit the code is messed up, just add #Include<misc.au3> in the 2nd script.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Can you show me how to make a GUI box with the two buttons START & STOP ? ^^ I think i know how to make the gui, but not to get the buttons to work...

Edited by mHt

Share this post


Link to post
Share on other sites

Can you show me how to make a GUI box with the two buttons START & STOP ? ^^ I think i know how to make the gui, but not to get the buttons to work...

here you are its not great but it works press esc to stop its hard to get to the button while its running

#include <GUIConstants.au3>
#include<misc.au3> 
hotkeyset("{esc}","stop")
$win=guicreate("title here",100,20,-1,-1)
$startbtn=guictrlcreatebutton("start",5,0,40,15)
$stopbtn=guictrlcreatebutton("stop",50,0,40,15)
GUISetState(@SW_SHOW)
$running=0
while 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        case $GUI_EVENT_CLOSE
            Exit
        case $startbtn
            $running=1
        case $stopbtn
            $running=0
    EndSwitch
    if $running=1 then
do
MouseClick("Primary", 43, 773, 1, 10 )
sleep (1000)
if $running=0 then exitloop
MouseClick("Primary", 401, 436, 1, 10 )
sleep (1000)
if $running=0 then exitloop
MouseClick("Primary", 756, 512, 1, 10 )
sleep (2000)
if $running=0 then exitloop
; Regual Crime
MouseClick("Primary", 37, 808, 1, 10 )
sleep (1000)
if $running=0 then exitloop
MouseClick("Primary", 402, 579, 1, 10 )
sleep (1000)
if $running=0 then exitloop
MouseClick("Primary", 745, 605, 1, 10 )
sleep (2000)
if $running=0 then exitloop
; Extortion
MouseClick("Primary", 34, 909, 1, 10 )
sleep (1000)
if $running=0 then exitloop
MouseClick("Primary", 627, 478, 1, 10 )
sleep (2000)
until $running=0
endif
WEnd


func stop()
    $running=0
EndFunc

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

THANKS MAN! OMG YOURE AWESOME!! Sinse im the noob here, i got a nother question 4 yah... can you instert the gui in the whole code? ( i just pasted the loop section here ) i want you to add this before the loop.. THIS PART SHALL NOT LOOP!!!!

; Login Function ( You have 4 seconds from you run the exe until you must have opened USmafia window )
sleep (4000)
MouseClick("Primary", 605, 552, 1, 10 )
send ("username")
MouseClick("Primary", 621, 587, 1, 10 )
send ("password")
MouseClick("Primary", 639, 622, 1, 10 )
sleep (3500)
; Car Stealing
MouseClick("Primary", 43, 773, 1, 10 )
sleep (1000)
MouseClick("Primary", 401, 436, 1, 10 )
sleep (1000)
MouseClick("Primary", 756, 512, 1, 10 )
sleep (2000)
; Regual Crime
MouseClick("Primary", 37, 808, 1, 10 )
sleep (1000)
MouseClick("Primary", 402, 579, 1, 10 )
sleep (1000)
MouseClick("Primary", 745, 605, 1, 10 )
sleep (2000)
; Extortion
MouseClick("Primary", 34, 909, 1, 10 )
sleep (1000)
MouseClick("Primary", 627, 478, 1, 10 )
sleep (2000)

Share this post


Link to post
Share on other sites

This will get you started with a user interface

CODE
#include <GuiConstants.au3>

GUICreate("Start Stop", 375, 250, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$StartButton = GUICtrlCreateButton("Start", 143, 100, 80, 23)

$ExitButton = GUICtrlCreateButton("Exit", 235, 100, 80, 23)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $ExitButton

GUIDelete()

Exit

Case $msg = $StartButton

;Put your routine here

EndSelect

WEnd

And..

Share this post


Link to post
Share on other sites

No need to EagleClaw.. i think i did it myself :whistle:

Share this post


Link to post
Share on other sites

No need to EagleClaw.. i think i did it myself :lmao:

okay thats good :whistle:

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

ey.. how do i tell AI to use my splash image? ive made the correct sizes just need to choose destination..

I created a folder named "bot"... Inside bot is the script, and another folder called "img" and the .jpg splash image is in "img" folder...

how do i get the splash to show from right place?? PLEASE fill inn :

$destination = destination here please
SplashImageOn("Splash Screen", $destination,250,50)
Sleep(3000)
SplashOff()

Share this post


Link to post
Share on other sites

ey.. how do i tell AI to use my splash image? ive made the correct sizes just need to choose destination..

I created a folder named "bot"... Inside bot is the script, and another folder called "img" and the .jpg splash image is in "img" folder...

how do i get the splash to show from right place?? PLEASE fill inn :

$destination = destination here please
SplashImageOn("Splash Screen", $destination,250,50)
Sleep(3000)
SplashOff()
$destination = @scriptdir&"\img\filenaame"
SplashImageOn("Splash Screen", $destination,250,50)
Sleep(3000)
SplashOff()

hope that works ive never used splashes haha


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

THANKS!

Edited by mHt

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Worked perfekt! ok a little math question for you m8!

what would the sleep command be if i wanted the script to sleep 2 min ?

oops uhm that was 2 seconds just take 1000 and multiply it man 1000 is 1 second

so pretty much 60000

Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

oops uhm that was 2 seconds just take 1000 and multiply it man 1000 is 1 second

so pretty much 60000

Take Seconds times 1000.

There are 120 seconds in 2 minutes, Therefore 120*1000 = 120000 milliseconds in 2 minutes.

Share this post


Link to post
Share on other sites

I found out, just had to think for once.. ok!!

How do i change the icon on the exe?? i have an icon file i'd like to use... j

Share this post


Link to post
Share on other sites

I found out, just had to think for once.. ok!!

How do i change the icon on the exe?? i have an icon file i'd like to use... j

i know how to change gui icon not sure about exe though let me figure out ill post when i know or if someone else beats me to it yay lol

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

i know how to change gui icon not sure about exe though let me figure out ill post when i know or if someone else beats me to it yay lol

hihi ok :whistle:

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  
Followers 0