Sign in to follow this  
Followers 0
Guest BL@(K-R34P3R

Looping with Counter

20 posts in this topic

Ok, I'm trying to make this script. I want it to look 100 times, then press -> and -< then restart the loop. This is all I have so far, and it's not working, suggestions?

$counter = 0

Sleep(10000)
TrainFunc()
Func TrainFunc()
   $counter = $counter + 1
   While 1
   Send("{CTRLDOWN}")
   Sleep(500)
   Send("{CTRLUP}")
   If $counter >= 100 Then;If it has looped 100 times then press ->, -< then restart.
  ;I want to insert the arrow keys here... Also, I don't know how to send the arrow keys. 
   Wend
   Endif
EndFunc

Share this post


Link to post
Share on other sites



you're making me want to put the "F" back in RTFM...

{UP} Cursor up

{DOWN} Cursor down

{LEFT} Cursor left

{RIGHT} Cursor right

Ok, I'm trying to make this script. I want it to look 100 times, then press -> and -< then restart the loop. This is all I have so far, and it's not working, suggestions?

$counter = 0

Sleep(10000)
TrainFunc()
Func TrainFunc()
   $counter = $counter + 1
   While 1
   Send("{CTRLDOWN}")
   Sleep(500)
   Send("{CTRLUP}")
   If $counter >= 100 Then;If it has looped 100 times then press ->, -< then restart.
 ;I want to insert the arrow keys here... Also, I don't know how to send the arrow keys. 
   Wend
   Endif
EndFunc

<{POST_SNAPBACK}>


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Uh... Thanks? Also, the if statement doesn't work even without the arrow keys... I guess I fogot to mention that before. Anyways, the Wend supposedly can't be placed into an if statement, how do I work around this?

Share this post


Link to post
Share on other sites

Uh... Thanks? Also, the if statement doesn't work even without the arrow keys... I guess I fogot to mention that before. Anyways, the Wend supposedly can't be placed into an if statement, how do I work around this?

<{POST_SNAPBACK}>

Don't put it in an If statement, duh.

Share this post


Link to post
Share on other sites

Just a bit of FYI, remember to have all your loops and if statements inside one anouther.

Ex:

BAD=

While 1
  Send("{CTRLDOWN}")
  Sleep(500)
  Send("{CTRLUP}")
  If $counter >= 100 Then;If it has looped 100 times then press ->, -< then restart.
;I want to insert the arrow keys here... Also, I don't know how to send the arrow keys.
  Wend
  Endif

Better=

While 1; I am on the outside
  Send("{CTRLDOWN}")
  Sleep(500)
  Send("{CTRLUP}")
  If $counter >= 100 Then; I am on the inside
;If it has looped 100 times then press ->, -< then restart.
;I want to insert the arrow keys here... Also, I don't know how to send the arrow keys.
  
  Endif; I am on the inside
Wend; I am on the outside

This is called Nesting, as you can see below this uses two While statements, an if and a do...until all just fine, although it really does nothing.

While 1
do
$x=1
sleep(10)
if winactive("fred") then
while $x=1
sleep(10)
$x=2
wend
endif
until winactive("the cows come home")
wend

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks. New problem to add. The {LEFT} and {RIGHT} are apparently not working for me. I tried doing {LEFTDOWN} but that isn't working either. Any suggestions? And yes, I put a sleep in between them.

ADDED: It compiles fine, but just won't do it....

Edited by BL@(K-R34P3R

Share this post


Link to post
Share on other sites

I found the route of the problem. For some reason the {LEFT} and {RIGHT} send keys are sending the number pad arrow keys. How can I send the other arrow keys? Help!

Share this post


Link to post
Share on other sites

It sends the normal left button according to this software :hmm:

If this is for a game, remember that not all games accept simulated input espesially since AutoIt does not use keyboard hooks.....

Get one of these guys. It worked for Homer Simpson (mostly) :)


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Larry, can you elaborate slightly? And CyberSlug, I know the game accepts it... because it will do the ctrl part. I'm just trying to get aruond the games anti-hack programming. It has it set so that if u attack (click control) more than 40 times in a row, it will not let you attack till you move to a new spot.

Share this post


Link to post
Share on other sites

Apparently the game isn't accepting it or it would be working, duh.

Share this post


Link to post
Share on other sites

But the Ctrl key works. Only thing that isn't working is the -> and <-

Share this post


Link to post
Share on other sites

Well whoopity-doo, so the Ctrl key works. The other keys don't work, thus the game isn't accepting them.

Share this post


Link to post
Share on other sites

Hmmm... why would a game disable the keys needed to control the player in the game but not all the buttons? Maybe to confuse idiot kids trying to control the game externally... oh no they wouldn't do that.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

Yes, exactly why I have to get this! Those damn game designers are trying to prevent me from making a trainer but I won't let them!!!

Share this post


Link to post
Share on other sites

Yes, exactly why I have to get this! Those damn game designers are trying to prevent me from making a trainer but I won't let them!!!

<{POST_SNAPBACK}>

You can't stop them, they are smarter than you.

Share this post


Link to post
Share on other sites

Larry's suggestion might actually work as a workaround for this. Instead of asking him to elaborate... how bout doing some googling on your own? He already gave you the keywords you need.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

Smarter yes, older yes, make more money yes.

But I guarentee you I will figure it out.

Share this post


Link to post
Share on other sites

I'm not giving you a cookie if you do.

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