AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Random Sleep Time...Help

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
daviddd



Joined: 12 Dec 2006
Posts: 1

PostPosted: Tue Dec 12, 2006 1:03 am    Post subject: Random Sleep Time...Help Reply with quote

Hey, I'm no expert at all at AHK, I've been looking around and searching for parts of the code that I want to make. i've found this so far but when the code "sleeps" for the 4 seconds, it doesnt seem to change at all from 4 seconds each time. This is my script.

^m::
{

RandSleep(4000)
{
Global STime
sMaxVal= STime+(STime/15)
sMinVal= STime-(STime/15)
Random, STime, sMinVal, sMaxVal

return STime
}
Loop 28
{
PixelSearch, outx, outy, 233, 267, 370, 395,

0x0E1523,,Fast
MouseClick, Left, %outx%, %outy%, 1
Sleep 4000


}
return
}




Most likely i have things in the wrong order or missing parts, because I am new to this.. Any help would be appreciated.
Back to top
View user's profile Send private message
.AHK



Joined: 26 Apr 2006
Posts: 662
Location: USA

PostPosted: Tue Dec 12, 2006 1:40 am    Post subject: Reply with quote

Code:
^m::
Loop 28 {
PixelSearch, outx, outy, 233, 267, 370, 395, 0x0E1523,, Fast
MouseClick, Left, %outx%, %outy%, 1
Random zZzZZz, 1000, 10000
Sleep %zZzZZz%
}
return

Thats should work.
Back to top
View user's profile Send private message Visit poster's website AIM Address
slomz



Joined: 03 Sep 2006
Posts: 608
Location: Iowa, U.S.

PostPosted: Tue Dec 12, 2006 4:27 am    Post subject: Reply with quote

Code:
zZzZz

?lol, y not just
Code:
var
?
_________________
Back to top
View user's profile Send private message AIM Address
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Tue Dec 12, 2006 9:40 am    Post subject: Reply with quote

This is probably what you wanted:
Code:
^m::
Loop 28 {
   PixelSearch, outx, outy, 233, 267, 370, 395, 0x0E1523, , Fast
   sTime := RandSleep(4000)
   Sleep, %sTime%
}
Return

RandSleep(mid) {
   min := mid * 16/15
   max := mid * 14/15
   Random, val, %min%, %max%
   Return, Round(val)
}

_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group