Jump to content

ControlSend issues


Recommended Posts

I started using AutoIt this morning and am very pleased in general, however the ControlSend command is making me scratch my head. Like so many others here I'm trying to make a bot for a game so let me get to the heart of the issue:

For simplicity's sake, I'm just trying to press the left arrow key and get the corresponding movement within the game.

When the window is in focus, this code works correctly by moving one space to the left(sending a plain {left} doesn't work - not sure why):

send ("{left down}") 
send ("{left up}")

That's fine for letting it run overnight, but I'd like to make it run in the background and/or minimized. So I tried this (including all the permutations of {left} {left down} {a} (the game uses wasd as well)) but nothing worked:

ControlSend ("PWO v1.1", "", "", "{LEFT DOWN}")
ControlSend ("PWO v1.1", "", "", "{LEFT UP}")

The reason I'm so confused at this point, however, is because this bit of code here does work correctly by opening the chat window:

ControlSend ("PWO v1.1", "", "", "{enter}")

I've also successfully written a "hello world" into the chat window using controlsend, so this problem rests exclusively with the movement actions.

I will appreciate any help you guys have to offer and I express my thanks in advance.

Edited by Urshilikai
Link to comment
Share on other sites

Perhaps you need to get the controlid of the part of the game your trying to send the arrows to.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

Nice avatar. Anyhoo, using the autoit window info it returned a value of 2 for the ControlID - now my code looks like this:

ControlSend ("PWO v1.1", "", "2", "{left down}")

When I add the 2 in, none of the commands work: {enter} {left} {up} etc. The helpfile has examples with all of this CLASS and EDIT stuff before the numbers but doesn't explain it. If I'm doing it wrong let me know.

Link to comment
Share on other sites

Have you tried deleting the parentheses around the 2? I don't use controlsend very much, so I don't know, but it's worth a try.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

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