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 option to set the 'increase bet' button position/Use vJoy to click the 'increase bet' button #6

Closed
ghost opened this issue Aug 17, 2020 · 5 comments
Assignees
Labels
awaiting response Awaiting response from author documentation Improvements or additions to documentation enhancement New feature or request inactive Will be or was closed due to inactivity
Milestone

Comments

@ghost
Copy link

ghost commented Aug 17, 2020

Hello.
I would like to use autobet, but it fails to increase the bet, mouse is placed near the edge instead of over the button:
image
So it always bets 100 and views the race.

Perhaps you can use XInput to send pad's button strokes instead of moving the mouse. When you use a gamepad's d-pad the cursor will automatically move to the button in that direction.

Steps to reproduce the behavior:

  1. Start GTA online autobet
  2. Ctrl+Shift+F10
  3. Let autobet do its magic

Expected behavior
Autobet bets max when there is a chance of winning

Log files
There is no output.log in my computer.

Thanks in advance.

@ghost ghost assigned MarkusJx Aug 17, 2020
@MarkusJx
Copy link
Owner

MarkusJx commented Aug 17, 2020

Hey,

so, actually, and that might surprise you, but the program works just fine. I think so. But I have to admit, that I always knew this could happen, but I was ignoring it since it just happened when I ran the program on another PC, only having hardware that is - old, let's put it that way.

The problem there, I thought, was my display, not running on its native resolution (old hardware, old drivers, not working correctly), causing weird scaling issues. And this seems to apply to other configurations, too. I did not know that. So, for this solution, I am assuming, you are not running your display or game under your display's native resolution. Although, 1920x1080 is pretty standard, so I could be wrong. I am assuming this, because I know, this issue can happen, when not using native resolutions and the program works just fine when using those native resolutions. But no guarantee on that one, as mentioned.

A theory (may be boring and/or confusing to some readers)

So my theory, so far is, that Windows knows the native resolution of your display and scales to that, but telling programs the resolution the display was set to (in the settings, confusing stuff, I guess). But when actually accessing raw pixels (which the program does to find the 'increase bet' button) of the screen, the coordinates used, correspond to the actual (scaled) image sent to the display. It may be also a variation of this. So it seems like the function, which searches for the button in question, searches not on the actual screen of the game, but outside of it (So when your game is 1920 in width it starts at pixel 1930 or so).
Another think could be the program start searching 'too late', so 'behind' the button, therefore, not finding it. This may also be related to some scaling inconsistencies in Windows. Whatever.

The solution

Finally, a solution to this problem. As I already ran into this problem, I of course fixed it, so I could use it. And of course I made no efforts, making this anywhere near user-friendly, but here it is:

Command-line options

The program has command-line options (mentioned on the project's website) and one of these is --run-configurator. Another one would be --set-custom-betting-pos paired with --save-settings. You can also use (when configured) --store-config-json and then --load-config-json, to store a JSON file on your Desktop, edit it, and load it in, when weird scaling messes up things

Actual steps to do this

I would recommend starting the program with --run-configurator, and since you can use shortcuts to do this, all you need to do is:

  • Start the console (cmd.exe, no admin needed)
  • Navigate to the directory the shortcut to the program or the actual program is in (in the cmd, obviously)
  • Run the program with the option, it should look like this: "GTA Online Autobet.lnk" --run-configurator
  • You will receive instructions on how to use it. So you will need to open up your game and hover your cursor over the 'increase bet' button, then press CTRL+SHIFT+F10, just like starting the betting process.
  • You can change your game's resolution and do this again, to add another resolution, if you want to.
  • Press CTRL+SHIFT+F9 to save and exit. You can now try this out. It may work.

The console output while doing this should look like this:

C:\Users\marku\Desktop>"GTA Online Autobet.lnk" --run-configurator
[17-08-2020 19:14:03] [main.cpp:1023] [DEBUG] Settings file exists. Loading it
[17-08-2020 19:14:03] [settings.cpp:65] [DEBUG] Loading winnings from file
[17-08-2020 19:14:03] [utils.cpp:140] [DEBUG] Made process DPI aware
You have started the configuration assistant for the betting increase button (>)
move your mouse over the button and press CTRL+SHIFT+F10
you can the edit your game's resolution to add more values
Press CTRL+SHIFT+F9 to exit

The game is not running
The game is now running
Window width changed to 1920
Saving x pos: 1075 and game width: 1920
Exiting now. Bye.

It works! Or maybe it doesn't

Since I've already experienced this issue, there is the possibility that scaling may still screw up some stuff - or, to rephrase it, this didn't work for me, great stuff. If not, your cursor will probably not hit the 'increase bet' button, so it may be off to the left or right of the button.

In this case, you could just repeat the process and move your cursor not over the button, but slightly to the left/right, trial and error. Or you could use the --set-custom-betting-pos paired with --save-settings options. --set-custom-betting-pos takes one argument, the location of the button, in pixels, starting from the left of your screen.

Use it like this: "GTA Online Autobet.lnk" --set-custom-betting-pos 1075 --save-settings, to set the position of the button to 1075. Increase or decrease the value if needed, to actually hit the button. So try out some values.

The saga continues

When actually hitting the button and playing in windowed mode, moving the window may actually screw up the set position, so this might not work anymore, when you move the game's window, so just keep the window in the same spot every time. This is also caused by windows' scaling not working the way I'd like it to work. But whatever. I would just suggest using full screen mode all the time, it works better than anything else.

Final suggestions and comments

Since this issue is more about the documentation not being as accurate as it should be, so I will try adding a wiki or using similar stuff.
Maybe adding an option to set the position of the 'increase bet' button in the UI would be a good idea, I might add this in version 1.1.1 of the program. Also, I could add an option to set the raw position of the button, so this may also find it's way into the next version.

Checklist for v1.1.1

  • Update the documentation to describe command line options
  • Add an option in the UI to set the position of the 'increase bet' button with the config tool
  • Add an option in the UI to set the position of this button manually (in pixels)
  • Log the version of the program when using debug mode

Some more stuff:

  • If this doesn't work (it should tho), tell me.
  • If you have any other questions/suggestions, tell me.
  • To get some logging information, you must start the program in debug mode with the --debug or --debug:full command line flag. This is mentioned in the readme and the project's website
  • Logging information was not that important on this issue.
  • Using version 1.1.0 should be safe now, don't know if you are using it.
  • XInput seems to be only for taking inputs, not simulating them. And simulating controllers seems to be pretty hard and not worth it, as the game will move the cursor and this may result in more issues as there is no way to see if the cursor is in the right spot. But this may be a suggestion for the future. Or if you know how to do this, let me know.
  • This issue will be renamed and will stay open as long as the checklist is not done.

Bye

Wohoo, you've made it to the end, you didn't die from dehydration, you didn't starve, that's good.
But that's it, thank you for your participation and have a nice day :)

@MarkusJx MarkusJx added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 17, 2020
@MarkusJx MarkusJx changed the title Click on increase bet not working Add option to set the 'increase bet' button position/'increase bet' button detection not working Aug 17, 2020
@MarkusJx MarkusJx added this to the Version 1.1.1 milestone Aug 17, 2020
@ghost
Copy link
Author

ghost commented Aug 17, 2020

Hello Markus.

Thanks for your answer.

I am running the game in screen native resolution 1920x1080 (not windowed), so there should be no scaling.
The parameter --set-custom-betting-pos 1550 did the job, and seems to be working now.

I am not sure if you can trigger xinput strokes directly or if you have to create a virtual device first, but there is a xinput library:
https://pypi.org/project/XInput-Python/
This way doesnt matter where the cursor is, if you press d-pad to the left several times, the cursor moves to horse list, and if you press right It goes to increase bet.

Besides this issue, bot seems to not be making right bets, when there is only a 1/1 Horse I always bet max, specially if there is no 2/1 (and usually win 10k), bot bet 100 for the worst, or max for the 2/1 (and lost).
I usually bet 10k for the favorite if there is only one, or 100 if there is no fair favourite, and I think I can make more profit than the bot.

Thanks.

@MarkusJx
Copy link
Owner

MarkusJx commented Aug 17, 2020

So,
good to hear the solution worked. That's the good stuff. Yeah.

XInput seems to be input-only, so no simulating a controller whatsoever. I'd have to look into this, this may be a solution to the whole problem, but probably optional, as this may be a lot of work simulating a controller. Also, this isn't written in python anymore, i've moved to c++ in favour of a far better performance (startup time used to be ~20 seconds, now <1 second), so this makes this even more difficult as there may not be a library out there, fulfilling these requirements.

With the betting, I am not exactly sure what you mean, but with the newest version (1.1.0), these rules apply:

  • The program will always bet on the horse with the highest chance of winning (so 'lowest number' e.g. would bet on 2/1 and not 3/1).
  • The lowest probability the bot will bet on, is 5/1, as at least a 5/1 must exist, probably a 4/1 is the lowest (never seen 5/1 only and lower).
  • Therefore, the horses probabilities can be evens, 2/1, 3/1, 4/1 and 5/1. Any other probabilities are not recognised and thus ignored by the bot.
  • It will bet on evens if the next highest probability is 4/1 or lower.
  • It will not bet when there are two horses with the same probability of winning higher than 5/1.
  • When no bet should be placed, it will place $100 on the first horse in the list, ignoring its chance of winning. This is just to reset the probabilities, it will only lose time and a small amount of money. This 'resetting' used to be easier, but it was patched with online patch 1.49/1.50, so this is what we do now.

Another checkbox for version 1.1.1:

  • Add betting rules to some sort of wiki

If it does not follow one of these rules, tell me which one and maybe send more debugging info. To do this, start with cmd argument --debug:full, it will create a zip folder called autobet_debug.zip (i think) on your desktop. This will include screenshots and a log file, so make sure to delete any personal data from the zip folder before sending it in. After starting the program, let it run for a while (so use it as normal, let it do some betting), doesn't need to be a long time, maybe 3-5 bets, during which the problem should occur.

It may have also something to with the scaling problem, the program not cropping the screenshots the right way. Since you are indeed running at your screens native resolution, are there any unusual things, programs, etc. you are running, that may cause these issues? If this has to do with the scaling problem, I am kind of screwed, but having some logs would help.

Yeah, that's all.

@MarkusJx
Copy link
Owner

Okay, so for the controller thing, I could use vJoy to simulate a controller, but I'd have to look more into that, so this will only be optional for the next version. But thanks for the suggestion.

@MarkusJx MarkusJx changed the title Add option to set the 'increase bet' button position/'increase bet' button detection not working Add option to set the 'increase bet' button position/Use vJoy to click the 'increase bet' button Aug 18, 2020
MarkusJx added a commit that referenced this issue Aug 18, 2020
…d by #6

Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com>
MarkusJx added a commit that referenced this issue Aug 18, 2020
…ation requested by #7 and suggested by #6

Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com>
@MarkusJx MarkusJx added the awaiting response Awaiting response from author label Aug 26, 2020
@MarkusJx MarkusJx added the inactive Will be or was closed due to inactivity label Sep 10, 2020
@github-actions
Copy link

This issue is closed because it has been open 30 days with no activity

MarkusJx added a commit that referenced this issue Nov 12, 2020
…d by #6

Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com>

Former-commit-id: baf8e02
MarkusJx added a commit that referenced this issue Nov 12, 2020
…ation requested by #7 and suggested by #6

Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com>

Former-commit-id: 3e2e8b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Awaiting response from author documentation Improvements or additions to documentation enhancement New feature or request inactive Will be or was closed due to inactivity
Projects
None yet
Development

No branches or pull requests

1 participant