Jump to content

Joystick Button Press Counter


Recommended Posts

Hello AutoIt Forum!

Im Pat! To it then. So I've got a goal of creating a counter for my button presses on my joystick, and display it in a SplashTextOn window. I think I'm fairly close. I'm having trouble getting the counter to go up, or for the ControlSetText to work properly. I'm not a coder by any means, but I'm hoping I can get this working with some help. 

Here's what I have so far:


VarA := 1
Global $Counter = 0
Do
    SplashTextOn 300, 100, Mashometer, %VarA%
    Sleep, 420000
    2Joy1::
    VarA += 1
    ControlSetText Mashometer, "", "", %VarA%
Until $Counter = 5

 

Also if someone wouldn't mind explaining the color coding in the example code throughout the help files, that would probably be a big help. I was also having trouble finding separate lists of Commands vs Functions. I'm pretty sure my VarA is delcared, it was displaying on the SplashTextOn until I tried adding the Do Until. But yeah, thanks for any help in advance!

Link to comment
Share on other sites

also, to clarify when I say I can't get the counter to go up, I meant VarA, not $Counter. I'm trying to prevent $Counter from going up at all. And I did realized the Do should come after Sleep, so what I would think it should look like now is.

 

VarA := 1
Global $Counter = 0

SplashTextOn 300, 100, Mashometer, %VarA%
    Sleep, 420000
Do
    2Joy1::
    VarA += 1
    ControlSetText Mashometer, "", "", %VarA%
Until $Counter = 5

with this code the error I'm getting is:

Dtlejqn.jpg

Sorry I didn't provide the error message in the OP. I'm not 100% on etiquette on this site, or any coding site truthfully. Thanks for your patience. Have a good one.

Link to comment
Share on other sites

  • Moderators
5 hours ago, Nostarion said:

I'm not 100% on etiquette on this site, or any coding site truthfully. 

We have this wonderful Wiki that can teach exactly that:

https://www.autoitscript.com/wiki/Forum_FAQ

Please be sure to read the section on the forum rules, especially game automation. At present I am content to let things go as long as you're strictly counting number of button presses. Stray into the realm of automating a game, however, and the topic will be closed. Also, there is a section on forum etiquette, which includes not bumping your threads until you've waited at least 24 hours. That gives everyone a chance to look the topic over and respond with suggestions.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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