Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 05:58

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Trying to work Autoit looping

Discussion on Trying to work Autoit looping within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2011
Posts: 3
Received Thanks: 0
Trying to work Autoit looping

Ok this is my first post so im not sure exactly where to put this but heres my script

WinWaitActive("LaTale Client")
#include<misc.au3> ;needed to capture keystrokes
While 1
If _IsPressed("11") And _IsPressed("31") Then;This is what I press to start the loop
Send ("{LCTRL down}")
Sleep(18000); I want it to hold down for 18secs
Send ("{LCTRL up}");I want it to lift off the key
Sleep(8000);and hold for 8secs
EndIf
If _IsPressed("11") And _IsPressed("32") Then
ExitLoop;I use this to exit
EndIf
Wend

When i run the script in my game it holds down the ctrl button, but it does it longer than 18secs and it doesnt lift up afterwards. It just goes until the input key time passes. I would like to know how to use the "UP" function properly and also how to loop it back to where i started to repeat the process.
Thanks
Mineraku12 is offline  
Old 01/26/2011, 00:39   #2
 
theoneofgod's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 3,940
Received Thanks: 2,212
Try not use a While 1 loop like that without a sleep, if you notice when you run the above script your CPU can spike between 50/100%

This version should work:

Code:
WinWaitActive("LaTale Client")

While 1
	If _IsPressed("11") And _IsPressed("31") Then
		Send("{CTRLDOWN}")
		Sleep(18000)
		Send("{CTRLUP}")
		Sleep(8000)
	EndIf
	If _IsPressed("11") And _IsPressed("32") Then
		ExitLoop
	EndIf
	Sleep(10)
WEnd

Func _IsPressed($sHexKey, $vDLL = 'user32.dll')
	; $hexKey must be the value of one of the keys.
	; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is.
	Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x' & $sHexKey)
	If @error Then Return SetError(@error, @extended, False)
	Return BitAND($a_R[0], 0x8000) <> 0
EndFunc   ;==>_IsPressed
#Moved to "SRO Coding Corner"
theoneofgod is offline  
Thanks
1 User
Old 01/26/2011, 01:09   #3
 
elite*gold: 0
Join Date: Jan 2011
Posts: 3
Received Thanks: 0
Ok thanks now it holds dow for the 18 secs but doesnt loop back to the start and reapeat....also what does this mean
$hexKey must be the value of one of the keys.
; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is.

Was i supposed to change some values somewhere?
Should i chang the $hexKey to "31"?


also can u explain this Func? Func _IsPressed($sHexKey, $vDLL = 'user32.dll')
Mineraku12 is offline  
Old 01/26/2011, 01:25   #4
 
theoneofgod's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 3,940
Received Thanks: 2,212
The _IsPressed is the function from the Misc UDF, there was no point including the whole include when you use just one of the functions.

Here is another method:

Code:
HotKeySet("^1", "_CtrlDownUp")
HotKeySet("^2", "_Exit")

While 1
	Sleep(10)
WEnd

Func _CtrlDownUp()
	WinWaitActive("LaTale Client")
	While 1
		Send("{CTRLDOWN}")
		Sleep(18000)
		Send("{CTRLUP}")
		Sleep(8000)
	WEnd
EndFunc   ;==>_CtrlDownUp

Func _Exit()
	Exit
EndFunc   ;==>_Exit
theoneofgod is offline  
Thanks
1 User
Old 01/26/2011, 01:32   #5
 
elite*gold: 0
Join Date: Jan 2011
Posts: 3
Received Thanks: 0
Ah the second one worked flawlessly ^_^ Thanks for your swift and accurate responses
-arigatou
Mineraku12 is offline  
Old 01/28/2011, 21:24   #6
 
elite*gold: 0
Join Date: Jun 2010
Posts: 11
Received Thanks: 3
what can i do with this? i mean this is a script right but im not good at this things can you help me please?
maxhotdog is offline  
Old 01/29/2011, 02:08   #7
 
Kape7's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 3,210
Received Thanks: 6,301
Quote:
Originally Posted by maxhotdog View Post
what can i do with this? i mean this is a script right but im not good at this things can you help me please?
It press buttons.
Kape7 is offline  
Old 01/29/2011, 10:32   #8
 
elite*gold: 0
Join Date: Jun 2010
Posts: 11
Received Thanks: 3
yeah i know but how do i use this script can someone explain?
maxhotdog is offline  
Reply


Similar Threads Similar Threads
[Question] Does the looping system of DB Bot work in ZSZC?
08/20/2010 - SRO Private Server - 4 Replies
Title.
Autoit work on only one window
08/08/2010 - PW Hacks, Bots, Cheats, Exploits - 4 Replies
Hello, anyone knows how I could make a script that runs in a single window defined? For example I want it to work on perfect world, and I want to make MSN the same time .. Thx
Cant make this autoit script to work
08/15/2009 - Dragonica Hacks, Bots, Cheats & Exploits - 4 Replies
Anyone can tell me why this doesn't work? My dragonica window will be active, but it just wont spam the x every second. I have tried messing around with the codes but no luck o.O ;HotKey for terminating the script #include <file.au3> Dim $aRecords ;Window title for dragonica should be changed after every patch $WinTitle = "Dragonica (Client Ver : 0.908.1301)"
Does AutoIT work?
07/01/2008 - General Gaming Discussion - 4 Replies
Hey, can pls someone check if AutoIT works? Maybe we can develop a bot ;) Vyn
Did work with AutoIT or Cpp ?
04/26/2008 - Guild Wars - 1 Replies
Hallo, vielleicht kann mir da einer helfen. Es geht um die Simulation einer Maus. Kann man eine Maus auf einer bestimmten Position oder in irgend einem Fenster z. B (Guild Wars) simulieren? Die normale Maus sollte sich nicht bewegen oder wenn man sie bewegt, dass die simulierte Position nicht verschoben wird? Ein Beispiel: In Guild Wars werden die Items auf dem Boden wie "Links" unterstrichen, wenn man mit dem Mauszeiger auf sie drauf geht. Jetzt will ich aber, dass die richtige maus...



All times are GMT +1. The time now is 05:58.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.