# How to create a quantity variable that registers how many shares are still missing.

58 views

### obede...@gmail.com

May 4, 2022, 12:31:46 AMMay 4
to Automate

I'm making a bot for a game, the variables are working very well to make the right moves. Now I need to activate it in an advanced mode.

At first I make a setup in the variables, which object is the max type. Now I need to make it do:

1- A certain amount of clicks

2 - Check if it managed to do the amount of this action

3 - At the next opportunity, make the remaining amount that it didn't get in the last one.

4 - If it is stopped, it is recorded that there are still x remaining clicks.

Any help, and idea of how to create this?

### Henrik "The Developer" Lindqvist

May 4, 2022, 9:44:00 AMMay 4
to Automate
Games usually does their own rendering, using 3D graphics and not Android UI widgets, so detecting if a click had any affect is not really possible.
If a game is rendered using the Android UI, then the Inspect layout block can be used to check what's changed on screen.

### obede...@gmail.com

May 6, 2022, 12:22:31 AMMay 6
to Automate
Okay. Good. But how can I solve this problem?
Ex.
1 - Set Variable
Number of clicks = 3 (Set Manually)

2 -  Expression True?
Number of clicks >= 1.

>> Yes

3 - Interact Click (1)

>> Yes

4 - Set Variable
Number of clicks - 1

5 - Expression True?
Number of clicks >= 2.

.....
Continue with the same logic.

How do I solve number 4?
And how do I make this variable edit the first variable, to register if there is a stoped?

### Henrik "The Developer" Lindqvist

May 6, 2022, 7:01:19 AMMay 6
to Automate
Variable set:
• Variable: NumberOfClicks
• Value= NumberOfClicks - 1
Message has been deleted

### obede...@gmail.com

May 12, 2022, 4:55:56 AMMay 12
to Automate
Thanks so much!!!!

But if I set the value at the beginning:

Variable: NumberOfClicks = 3

It got 2 clicks.

Value= NumberOfClicks - 2

Automate stopped

When I start again, I need this First Variable to be edited and start: Variable: NumberOfClicks = 1

How can I do this?

### Henrik "The Developer" Lindqvist

May 12, 2022, 9:24:10 AMMay 12
to Automate
Use the Variable set block at the start of your flow.

### obede...@gmail.com

May 12, 2022, 1:32:19 PMMay 12
to Automate
But the variable set at the beginning of the flow continues with a value of 3, whenever it restarts it will restart at this value, by the way I'm following here.. I would like to know a way to subtract the value of this variable at the beginning. Please

### Henrik "The Developer" Lindqvist

May 12, 2022, 4:27:07 PMMay 12
to Automate
Sorry i don't really understand what the problem is.
To set a variable to a number use the Variable set block with the number, e.g. 3, as the Value.
To subtract a number from a variable use the Variable set block with Value set to <variable name> - <number>, e.g. NumberOfClicks - 1

### obede...@gmail.com

May 12, 2022, 11:27:33 PMMay 12
to Automate
Look:
Example:

Flow Beginning

Variable set
Variable= NumberOfClicks
Value= 3

>>>

Inspect Touch... Click
>>> Yes

Variable set
Variable= NumberOfClicks
Value= NumberOfClicks - 1

Stopped Flow.

I need that when the flow beginning again the variable set NumberOfClicks starts with the value 2. Not 3 that I configured initially. I tested it and it is not working.