Sign in to follow this  
Followers 0
Anuran

Simple loop

9 posts in this topic

Hi everybody,

im getting started with AutoIt and already stuck hehe. im trying to make a simple loop without having a code with 10000 rows.

this is what i made so far..

Global $Paused
HotKeySet("{F5}","TogglePause")
HotKeySet("{F6}","ExitMod")


While 1
Sleep(10000)
MouseClick("right")
Sleep(5000)
MouseClick("right")
Sleep(5000)
MouseClick("right")
Sleep(5000)
MouseClick("right")
Sleep(5000)
MouseClick("right")
Sleep(5000)
MouseClick("right")
Sleep(5000)
MouseClick("right")
WEnd

Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('"Paused"',0,0)
WEnd
ToolTip("")
EndFunc

Func ExitMod()
    Exit
EndFunc

and my question now is: how can i loop this script? like an infinity "mouse right" loop..

greets Anuran

Share this post


Link to post
Share on other sites



hi,

you will need to add moving coordinates, or adding mouseclick ("left") to cancel the previous right so it will do infinity...

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hi,

you will need to add moving coordinates, or adding mouseclick ("left") to cancel the previous right so it will do infinity...

uhm...not this is not true...

your loop is already infinite...

(except pressing F5 oder F6)

Edited by Kademlia

Share this post


Link to post
Share on other sites

ok thanks for fast answer. script works well..but in windows only..

ah well..i forgot to say this script is for KalOnline. my idea was to make a script to auto use my MP potions.

what i did:

run script (paused)

start KalOnline in window mode 1280x1024

play my script

but ingame nothing happens :/

any idea how to fix it?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Do you take a MP potion with rightclick?

Maybe KalOnline blocks the inputs from AI?

i made something similar to this for "silkroad once" for testing

CODE

HotKeySet("{F5}", "StartMP") ; Hotkey to start/pause

TogglePauseMP() ;paused on start

Func StartMP()

HotKeySet("{F5}")

HotKeySet("{F5}", "TogglePauseMP")

ToolTip('MP an', 500, 50) ; show tooltip if script is on or off

While 1

PixelSearch(112, 53, 112, 53, 0x151515) ; Looks for my MPbar. if it drops below X% it will send "7" (my key for taking a manapotion)

If Not @error Then

Send("{7}")

EndIf

Sleep(2000)

WEnd

EndFunc; ==>Start

Func TogglePauseMP()

ToolTip('MP aus (f5)',500,50)

HotKeySet("{F5}")

HotKeySet("{F5}", "StartMP")

While 1

sleep(100)

WEnd

EndFunc

porting is up to you

Edited by Kademlia

Share this post


Link to post
Share on other sites

nah dont think so..a friend made an auto pot (bot) script with another tool. but he dont wanne give me his script, so...

another try:

Global $Paused
HotKeySet("{F5}","TogglePause")
HotKeySet("{F6}","ExitMod")


While 1
Sleep(5000)
Send("{6 down}")
Send("{6 up}")
WEnd

Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('PAUSE',0,0)
WEnd
ToolTip("")
EndFunc

Func ExitMod()
    Exit
EndFunc

this also dont work ingame.

is saw the following code in Gaming and Bots forum..

Winactivate ("Diablo II","")

but i dunno what to do with?!?

Share this post


Link to post
Share on other sites

you should try to port the code i wrote to your game...

what your writing is easier and more errorsave with you hands

Share this post


Link to post
Share on other sites

dont work too :)

Share this post


Link to post
Share on other sites

it will. you just dont want to deal with it

2 Options for you:

Deal with it, ask again if you got a real question

Dont Deal with it, stop using autoit

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