Autoit bot(Craft/Fish) - Simple bot

06/14/2011 13:39 lucid#196
When I used a single ControlSend() call to represent a keystroke, I found it did not work well. Adding explicit up/down calls with waits between seemed to do the trick for me.

Attached is your script, variant "H" with the 214 calls to ControlSend() in the script changed to use a custom key press function "FFSend" which I have tested in my own FF bots and had lots of success with, though I use an actual window handle and not the class-based lookup string you use. That is something you could try if this doesn't fix the problem.

I didn't test the attached bot, hope it runs and fixes the problem. Good luck^^

Edit: You may not need the 325ms wait at the end of the FFSend() function, since you appear to include a wait after each keystroke. I'd consider getting rid of those to clean up your code a bit, and just using the wait in FFSend.
06/14/2011 13:42 13ouncer#197
One thing I would love to do is to add an image to the FF XIV window and use those as reference points rather than capturing pixels. If you have ever played Diablo II, there was a guy named Manus Magnus who did something similar with his Diablo II bot. He was able to add color blotches within the game (client side). It was pretty awesome. If I could do that, there would not be any limits on what I can do within the game.
06/14/2011 13:43 13ouncer#198
Quote:
Originally Posted by lucid View Post
When I used a single ControlSend() call to represent a keystroke, I found it did not work well. Adding explicit up/down calls with waits between seemed to do the trick for me.

Attached is your script, variant "H" with the 214 calls to ControlSend() in the script changed to use a custom key press function "FFSend" which I have tested in my own FF bots and had lots of success with, though I use an actual window handle and not the class-based lookup string you use. That is something you could try if this doesn't fix the problem.

I didn't test the attached bot, hope it runs and fixes the problem. Good luck^^
I'll check it out. Thanks for helping.
06/14/2011 13:45 lucid#199
Quote:
Originally Posted by 13ouncer View Post
One thing I would love to do is to add an image to the FF XIV window and use those as reference points rather than capturing pixels. If you have ever played Diablo II, there was a guy named Manus Magnus who did something similar with his Diablo II bot. He was able to add color blotches within the game (client side). It was pretty awesome. If I could do that, there would not be any limits on what I can do within the game.
Just read the game memory. Pixel reading is why this thread is 20 pages long (no offense!)
06/14/2011 14:29 13ouncer#200
I don't have much experience with reading the memory. I understand memory, but I don't know how to put it to use.
06/14/2011 14:31 13ouncer#201
Have any resources I can use to learn how to: find, use, and read memory?
06/14/2011 17:07 lucid#202
Get friendly with the Windows API, at least ReadProcessMemory: [Only registered and activated users can see links. Click Here To Register...]

Do NOT write memory
Do NOT use "code caves" or modify the program's signature in any way


Any results on 5.4h with FFSend, and that problem with key input?
06/14/2011 17:51 13ouncer#203
Quote:
Originally Posted by lucid View Post
Get friendly with the Windows API, at least ReadProcessMemory: [Only registered and activated users can see links. Click Here To Register...]

Do NOT write memory
Do NOT use "code caves" or modify the program's signature in any way


Any results on 5.4h with FFSend, and that problem with key input?
Did not work. Still takes control of shift/caps when a control is sent
06/14/2011 17:54 lucid#204
Are you able to write a short script that produces the problem?
06/15/2011 03:44 13ouncer#205
Code:
$On = True 
$hWnd = ControlGetHandle("[CLASS:RAPTURE]", "", "")
HotKeySet("{End}", "Stop")
Sleep (5000)
While $On = True
ControlSend("[CLASS:RAPTURE]", "", $HWND, "{Down}")
sleep (500)
WEnd

Func Stop()
	$On = False
EndFunc
06/15/2011 07:08 lucid#206
It definitely seems to be an AutoIt bug, which doesn't appear to have a workaround. I tried a ton of things to make the behavior change and was unable, but here's what I know:
  1. The problem happens when a modifier is pressed in foreground application while performing ControlSend() to a background application
  2. In the case of the shift modifier key, the left shift button is stuck
  3. Keyup commands via send (to active) and/or controlsend (to background) won't resolve the issue
  4. Using the direct handle for the application does not fix the problem

Unfortunately, I think there may not be a good solution short of filing bug with AutoIt or writing your program in something else. These types of issues (there are some others) are why I decided to go with a more powerful programming language like VB or C#, even though I have to recode some of what would be available with AutoIt. :(

AutoIt is really made for automation of a machine, not so much background processes (multiple simultaneous inputs), at least not via controlsend.
06/15/2011 12:02 13ouncer#207
Problem is, I don't own any other program to write programs. Most out there are not free. Auto-It is the only one that I know of that is free. Have any suggestions?
06/15/2011 13:18 lucid#208
Visual Basic 2010 and Visual C# Express Editions are both free. They both have almost no limitation (they don't come with Spy++, and you must download them individually).

You must register them to use them for more than 30 days, but registration is free (just need an e-mail address).

I learned VB to the point where I have memory reading and a few other thing in place in 2-3 days, it really was not bad (and is a fairly natural transition from AutoIt). I'm considering moving to C# because it is much more widely used and recommended for game training, but don't know if I will make the leap. Take into consideration I've been programming for more than 15 years though, so VB is hardly my second language - not sure what your situation is.

In the long run, you will be much better off with a more robust language. In the short term, you'll have to feel some pain.

Visual Basic 2010 Express: [Only registered and activated users can see links. Click Here To Register...]
Visual C# 2010 Express: [Only registered and activated users can see links. Click Here To Register...]
06/15/2011 13:48 13ouncer#209
I understand basic syntax. I am assuming that's all I need to learn any language. The more complex code should come in time.
06/15/2011 14:31 lucid#210
Understanding the syntax is a big part of programming in anything, but I would say it is a bare minimum. There are also some universal tools and strategies used which are common to many programming languages, with some minor differences.

Some Example Programming Concepts:
Object-Oriented Programming
Interfaces
Polymorphism
DRY - (D)on't (R)epeat (Y)ourself
Design Patterns
Dependency Injection

These things are optional but they make life a lot easier in the long run: problems easier to debug, more concise code, easier to add new features, and easier for people unfamiliar with the code to learn what it does - or for you to relearn how your program works at a later time.