Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Random Interval #62

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

bnn678
Copy link

@bnn678 bnn678 commented Nov 30, 2021

Updated the UI to include a new section that allows users to specify a maximum and minimum interval.

image

To use the randomized interval, simply set a value in the maximum and minimum input boxes where the sum of the maximum values is greater than than the minimum values.

NOTE: The randomized interval will only be used if the Click Interval is set to 0. If any value is entered in the Click Interval, the Click Interval will be used instead

Desired Future Updates

  1. Add some indication in the UI that only the Click Interval or Randomized Click Interval can be used (not both). Possibly disable the input box when either has a non-zero value?
    This was added using the IsRandomizedIntervalEnabled AutoClickerSetting, an explicit call to OnPropertyChanged, and the IsEnabled property.
  2. Fix the new horizontal spacing issue. I introduced a bug that caused the hortizontal spacing to "squish" a bit. I don't have enough experience with XAML to quickly fix this bug. The most obvious sign of this new bug is that the input boxes no longer have a right border

Added a new GroupBox to hold the Randomized Click Interval UI components

NOTE: this commit causes some issues with the horizontal spacing for some reason. Will attempt to fix these issues in a later commit
Bumped the max window dimensions to hold the new UI components
Created necessary UI components to set the maximum and minimum intervals

NOTE: I didn't update the bindings yet so all three inputs are currently bound to the same variable
Added new properties to the AutoClickerSettings class for use with the new Randomized Interval functionality

Also added the binds to the UI components and updated SetApplicationSettings
Implemented necessary interval logic to get a working randomized interval

NOTE: the new implementation assumes that the standard interval will be 0 (null) otherwise the standard interval will be used instead. i.e. the standard interval has a higher precedence than the randomized interval so the standard interval must be 0's to use the randomized interval
@bnn678 bnn678 marked this pull request as draft November 30, 2021 07:05
@bnn678
Copy link
Author

bnn678 commented Nov 30, 2021

Just discovered a bug. The interval is not reset after the mouse click action in the current implementation. I need to move the interval update logic into the OnClickTimerElapsed function

Bug: interval timer is only being reset when the command executes

Fix: move the interval update logic into the OnClickTimerElapsed function

NOTE: I should refactor this commit and revise the way the timer logic is handled. This commit is intended only as a hotfix
@james-s-w-clark
Copy link

  1. Add some indication in the UI that only the Click Interval or Randomized Click Interval can be used (not both). Possibly disable the input box when either has a non-zero value?

I like this idea. It should possibly be part of this PR because without an indication in the UI, it's a bit more confusing to get expected results from this application.

@bnn678
Copy link
Author

bnn678 commented Nov 30, 2021

  1. Add some indication in the UI that only the Click Interval or Randomized Click Interval can be used (not both). Possibly disable the input box when either has a non-zero value?

I like this idea. It should possibly be part of this PR because without an indication in the UI, it's a bit more confusing to get expected results from this application.

I agree. I also think that the horizontal spacing issue should be fixed before this PR is merged. Unforunately I have no experience with XAML so I htink someone else would be better equiped to add these features

@oriash93
Copy link
Owner

oriash93 commented Dec 1, 2021

@bnn678 First of all, thanks for taking the time of making a PR and putting effort into this, it's really appreciated. 🙏🏽
@IdiosApps I also appreciate the thought put into your review.

I was considering adding a separate flag to enable/disable random intervals.
I agree. Maybe go with the same concept as switching between the "Click Repeat" methods or the "Click Position" methods. This might require a workaround to include a RadioButton inside a GroupBox's header, but we'll figure it out.

Regarding all other things discussed, take your time. That's why drafts are for :)
I will try to pitch in the next few days when I have time off work, to leave review notes and see what can I do to help.

@KronkIV
Copy link

KronkIV commented Dec 11, 2021

May I suggest a simpler implementation?
Use the Click Interval fields as the minimum, and rather than specifying the maximum the user specifies the random range.
Leave the original Click Interval section alone and add a single set of Random Interval fields. When these are non-zero, a random value between 0 and the Random Interval total is added to the Click Interval.

@bnn678
Copy link
Author

bnn678 commented Dec 13, 2021

@KronkIV I considered using the existing Click Interval as a portion of the input, but I ultimately decided against because it is more ambiguous. Without additional UI information, it's not inherently obvious to a user what each of the components would be for. I believe that the current UI implementation makes it instantly obvious how the Randomized Click Interval should be used.

@oriash93 Thanks! I plan to update this PR over the time I have off around Christmas.

I replaced the previous CalculateInterval with 3 functions (CalculateInterval, CalculateFixedInterval, and CalculateRandomizedInterval) as suggested in the PR comments.
Added an overload of IsIntervalValid that allows users to pass in the interval so that they can store the result of CalculateInterval if desired.
I added the code that should disable the Maximum Interval input whenever the Click Interval has a non-zero value however the disabled state of the input will not update. As I lack experience with XAML I'm going to pass this off to other collaborators on the PR
@bnn678
Copy link
Author

bnn678 commented Dec 16, 2021

@IdiosApps @oriash93 I have attempted to disable the inputs at an appropriate time, but unforunately I can't figure out why the disabled state of the input won't update after the program is stared. Does anyone have suggestions?

@@ -122,16 +122,24 @@
</Grid.ColumnDefinitions>

<TextBox Grid.Column="0" Width="45"
Text="{Binding AutoClickerSettings.MaximumHours, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
Text="{Binding AutoClickerSettings.MaximumHours, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
IsEnabled="{Binding AutoClickerSettings.IsRandomizedIntervalEnabled, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bnn678 Also consider using "IsReadOnly" instead of "IsEnabled"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between the two?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of a TextBox, IsReadOnly allows the user to set focus to and select and copy the text, but not modify it.
A disabled TextBox does not allow any interaction whatsoever.

As a general rule, use IsReadOnly when you have data that you want the user to see and copy, but not modify.
Use a disabled textbox when the data you are displaying is not applicable for the current state of a dialog or window.

Copy link
Author

@bnn678 bnn678 Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning toward rescoping this ticket and removing the textbox disabling since I can't get the binding to update. Then a later PR can disable the textboxes when appropriate.

Gotcha. Yea, this seems like a good idea. I have made this update.

Actually, I made this update and the IsReadOnly property apparently doesn't grey out the textbox (for some reason I thought it would). I think we want to make it very obvious that using the standard interval means that the randomized interval is disregarded so I believe the IsEnabled property is still the better choice. If you are satisfied with this justification, please resolve the conversation as approval.

@oriash93
Copy link
Owner

@bnn678 Are you still working on this?

I'm not sure why the PropertyChanged trigger was not behaving correctly but by explicitly calling \OnPropertyChanged, I have was able to get the textboxes to respond appropriately.
The previous commit actually depends on these files which I forgot to include in the commit. Here they are now :)
@bnn678
Copy link
Author

bnn678 commented Feb 22, 2022

Here is what the interface looks like when the Click Interval is set to 0

image

And here is the appearance when there is a non-zero Click Interval

image

In the current implementation, the IsEnabled property is used instead of the IsReadOnly property because the "grey-out" effect makes it more obvious to users that the randomized interval is disregarded if a standard interval is provided.

@bnn678 bnn678 marked this pull request as ready for review March 4, 2022 00:08
@TriforceSeeker
Copy link

Probably should have checked existing PRs as I just opened one for this. My only gripe is that a real human clicking so fast, produces something closer to a normal distribution, rather than a uniformly distributed random range.

If I was reviewing someone's click action/statistics and saw a perfectly uniform random distribution for some duration of time that is neatly windowed, it'd be a huge red flag. A lot of human action/response times tend to be closer to normal, skewed, and multimodal distributions.

Also curious, have you noticed whether the new logic adds considerable delays, possibly requiring compensation, to achieve same CPS w/o the added logic?

@bnn678
Copy link
Author

bnn678 commented Mar 17, 2023

human action/response times tend to be closer to normal, skewed, and multimodal distributions

Thats a very intereting point and something I hadn't considered.

have you noticed whether the new logic adds considerable delays,

I haven't noticed any delays, but I also ddn't do any actual performance testing. I can make no guarenteed promises, but it appears to perform reasonably.

@boazfionic
Copy link

Great work!

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants