Jump to content

Looping with Counter


Guest BL@(K-R34P3R
 Share

Recommended Posts

Guest BL@(K-R34P3R

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
Link to comment
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)

Link to comment
Share on other sites

Guest BL@(K-R34P3R

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?

Link to comment
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.
Link to comment
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.

Link to comment
Share on other sites

Guest BL@(K-R34P3R

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
Link to comment
Share on other sites

Guest BL@(K-R34P3R

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!

Link to comment
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!
Link to comment
Share on other sites

Guest BL@(K-R34P3R

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.

Link to comment
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

Link to comment
Share on other sites

Guest BL@(K-R34P3R

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!!!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...