Coder Social home page Coder Social logo

Comments (5)

MarkusJx avatar MarkusJx commented on June 22, 2024

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 :)

from autobet.

 avatar commented on June 22, 2024

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.

from autobet.

MarkusJx avatar MarkusJx commented on June 22, 2024

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.

from autobet.

MarkusJx avatar MarkusJx commented on June 22, 2024

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.

from autobet.

github-actions avatar github-actions commented on June 22, 2024

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

from autobet.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.