Nostarion

Joystick Button Press Counter

5 posts in this topic

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!

Share this post


Link to post
Share on other sites

bump. 

Share this post


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

Share this post


Link to post
Share on other sites

Did you take this code from where, buddy? :) 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

√-1 2^3 ∑ π, and it was delicious!

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