Python Bots! Coding a Better Auto Clicker.

Sdílet
Vložit
  • čas přidán 28. 03. 2022
  • I love code bullet but what code does he use? Today I'm going to show you exactly how he did his last video start to finish. This will include the most popular libraries and how to take the project to the next level. Any questions let me know in our discord.
    github.com/ClarityCoders/Auto...
    Subscribe to our new streaming channel! If I get 50 I'll do a live stream.
    / @claritystreams1393
    👊You got something to say to me?? Join our discord!✌️
    / discord
  • Věda a technologie

Komentáře • 37

  • @wandevv
    @wandevv Před 2 lety +8

    Nice video, I would recommend for the first code a small program that ask the user to click the last upgrade, then it will get the rest using offset or ask to click each upgrade, then store in a JSON file, then your program just read that config.

  • @alexm-vb9dv
    @alexm-vb9dv Před 2 lety +1

    Awesome video, as per usual! Love your content. I see you with that metamask wallet extension 😉😉

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +1

      Been playing around with the idea of botting some play to earn games. Thanks for watching and commenting!

    • @alexm-vb9dv
      @alexm-vb9dv Před 2 lety

      @@ClarityCoders Your video put that exact thought in my head! I'm sure you'd get a lot of traction on that video. Looking forward to it, if you decide to do it!

  • @iPrint3D
    @iPrint3D Před 2 lety +7

    Just released? Had me excited....

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +3

      SORRY! I meant relative to have often he releases 😂. Thanks for the comment.

    • @iPrint3D
      @iPrint3D Před 2 lety

      @@ClarityCoders All good. Love these!

  • @Lea-ww9hf
    @Lea-ww9hf Před 2 lety

    Hello Jake! Great video!!! I am learning a lot from your videos!
    Can you make one about how to make a bot work in a game that uses DirectX? I tryed different methods but couldn't do it

  • @CandorZofain
    @CandorZofain Před 2 lety +1

    I created an auto bot for this game, but I did it entirely in JavaScript. All the game data is publicly available and you can use the Cookie Monster 'mod' to get the most efficient building upgrade. Then it is just a matter of calculating what to upgrade and when. All the 'clicking' can be replaced by using the game's own functions to buy buildings and upgrades, and anything else can be done by calling '.click()' on the html element itself. I also fully utilize Golden Cookies and the Wraiths. I eventually want to create a bot for the farm, bank, etc. minigames.

    • @mr.viewer3579
      @mr.viewer3579 Před 5 měsíci

      Would you create some bot for an old game of mine im playing still when i have free time(Talisman Online) if its ring a bell,would you please good sir/maam can create a bot for farming or scripts for clearing a dungeons or if you can ,can you teach some basics about creating bot program and maybe i can learn and im the one who will create my own bot 😊

  • @DaxtAttack
    @DaxtAttack Před 2 lety +1

    Great. Thanks for the video.

  • @forensicsman320
    @forensicsman320 Před 2 lety

    Great video! Could you please do a match 3 python bot tutorial? Would love to see how it is done in python.

  • @b391i
    @b391i Před 2 lety +1

    Thanks Man ✌😁

    • @ClarityCoders
      @ClarityCoders  Před 2 lety

      Anytime my guy! Thanks for watching and commenting.

  • @shrankai7285
    @shrankai7285 Před 2 lety +2

    Nice video!

  • @TheDevilzAngelz
    @TheDevilzAngelz Před 2 lety +6

    Didn't finish watching yet, but I thought a few quick improvements/optimizations.
    Rather than manually getting the coords for each upgrade, I would take a screenshot of the image (or name of the item) you're upgrading and save it as a local file. When the program starts, search the screen for those images and save the coordinates. There's something in the pyautogui library called locatecenteronscreen() which should do just this. You could even make an "update_image_locations" function which would ensure the images are where you expect them to be to help with screen scrolling, resizing, different web browsers, the "bookmarks bar" being open, ads, etc. which may change the position of the hard-coded coordinates randomly. In fact, you event commented on it around 13:00 and said "I didn't adjust the pixel values... so it's a little off". One major concern being "buyable" vs "can't afford" upgrades since they change highlighting - but you can provide a "confidence" into the locatecenteronscreen() and it should be sufficient.
    This can be expanded to work on multiple monitors, but the image search function will obviously take longer. But it saves you from having to do the "swap your code and your game" around the 11:55 mark.
    This can also be used for the "golden cookie" which is randomly placed throughout the screen and offers the player some benefits. Every ~100 clicks or something, check for the golden cookie, and click it.
    Secondly, your choice of data constructs is a bit awkward/confusing. The "name" fields of your dictionaries within your click_locations list are completely unused. You could just use a comment instead, or if you actually need the dictionary entry (I can't see why you would), then use it. While you're at it, your X/Y values can be combined into a list, which can be passed direct into the pyautogui.click() function so you don't have to index into them. This might save a few instructions and increase code speed.
    Ideally you would find a way to do the clicking even when the screen is inactive/hidden. AutoHotKey (AHK) does this well, but I haven't found a reliable way to do this in Python.
    Either way, not a bad implementation of a simple little script. Keep up the good work!

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +3

      Amazing points. I really appreciate the feedback I hope you stay around the channel!
      I tend to use template matching most of the time for dynamically finding coordinates. Like you mention this would fix the buy able not buy able issue. I left this out of this program just because I was following what code bullet did and keeping it simple.
      The name field is unused in this program but I use it in my Reddit bot I show later. For this program though you are correct I should have eliminated the key value pair.
      Thanks again for commenting and such great feedback!

    • @daddyofalltrades
      @daddyofalltrades Před 2 lety

      Beautiful comment.

  • @philip8232
    @philip8232 Před 2 lety

    Liked the video, but could you please create some bot that can run in the background? How can that be done for web game or for any other, i.e. reading memory.

  • @WilliamFaf
    @WilliamFaf Před rokem

    please continue uploading python contents

  • @abdullahfaiyaz7624
    @abdullahfaiyaz7624 Před 2 lety +1

    Nice

  • @jakelake8113
    @jakelake8113 Před 2 lety +1

    I WAS THE 50TH SUB!!!

  • @klm.4809
    @klm.4809 Před 2 lety

    nice

    • @ClarityCoders
      @ClarityCoders  Před 2 lety

      Thanks! Appreciate you taking the time to comment.

  • @PhunkyBob
    @PhunkyBob Před 2 lety

    Why don't you use `python -m venv venv` for your virtual env? What are the benefits of `virtualenv` module?

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +1

      Honestly you're right unless you have a reason not to you should probably use the built in venv in Python 3.3+. I used virtualenv out of habit.

  • @oskarma2473
    @oskarma2473 Před 2 lety

    Can you make ai for maplestory?

  • @MadMan123654
    @MadMan123654 Před 2 lety

    2 module 3 is remainder 2. 3 goes into 2 0 times. You said it backwards but I’m sure you know that.
    I do not understand how ‘for location in click_locations’ works, as ‘location’ is neither reserved nor defined. Is ‘location’ just a placeholder for each {} within click_locations, meaning ‘for clicks in click_locations’ would work too?

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +1

      Dang on first point thanks for the correction!
      "location" used there is just a chosen variable name. You could have chosen anything as long as you then reference it in the loop as such. Each time you go through the loop in this case location will be assigned one dictionary inside of click_locations. Let me know if I'm not explaining that well enough.
      Because we are going backwards...
      First Loop
      location = {
      "name": "Store",
      "x": 1632,
      "y": 216,
      }
      Second loop
      {
      "name": "Time Machines",
      "x": 1722,
      "y": 1032,
      }

    • @MadMan123654
      @MadMan123654 Před 2 lety

      @@ClarityCoders “every loop, ‘location’ will be assigned one dictionary entry”
      This makes it very clear, thank you, confirming what I was trying to ask in a more succinct way

    • @HoloDoctor90
      @HoloDoctor90 Před 2 lety +1

      ​@@MadMan123654 location is just a temporary variable, like in C++ the i: for(int i=0

    • @MadMan123654
      @MadMan123654 Před 2 lety

      @@HoloDoctor90 I started with C, where every instruction is specific, so yeah that helps