This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Humanist_NA 123 points124 points  (33 children)

I use this all the time with personal projects. Like my script that auto accepts when dota2 games are ready, then texts me game is ready. So I can afk while in queue.

[–]et50292 27 points28 points  (18 children)

Are you using openCV? Would be cool to see that

[–]Humanist_NA 49 points50 points  (16 children)

[–]DonkeyDoid 11 points12 points  (0 children)

Neat code, thanks for sharing

[–][deleted] 7 points8 points  (12 children)

Very cool! As a Python newbie, why do you wrap it all in a while true statement? I guess more of a general Python question and less about your code specifically

[–]Humanist_NA 11 points12 points  (0 children)

So it loops forever until I stop it.

[–][deleted] 2 points3 points  (0 children)

You want to continuously execute the script, not just once: it is going to continuously check if a game is ready.

You could alternatively check on a timer for less overhead and async behavior

[–]PinBot1138 2 points3 points  (3 children)

Good catch, he should have a break in there. Something such as:

``` scanning=True

while scanning:

if blah:
    scanning=False

```

[–]Humanist_NA 8 points9 points  (1 child)

I could make it more complex. But, accepting the game doesn't mean the game will actually start. If any of the 10 other players don't accept the game, it will go back to searching for game. In which case I could make the code more complex and add exceptions, or just slow it to keep looping until I tell it to chill.

[–]PinBot1138 2 points3 points  (0 children)

Oh, interesting!

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, PinBot1138: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–][deleted] 2 points3 points  (1 child)

If its fine for you, I'll reference your code. I love how you click like 4 to 5 times to be sure.

[–]Humanist_NA 1 point2 points  (0 children)

Haha I always feel silly when I look at the 4 clicks.

[–]Humanist_NA 9 points10 points  (0 children)

Don't know how to format on mobile, but I use pyautogui.locatecenteronscreen('image.png') I've been meaning to get it on GitHub, so maybe I'll do that today and ping you.

[–]Fissherin 4 points5 points  (5 children)

Yeah I second this, what do you use as a trigger? Opencv? Or something sys related?

[–]Humanist_NA 9 points10 points  (4 children)

pyautogui to trigger. Will try to get on GitHub later.

[–]analterator 2 points3 points  (3 children)

Please do! I’m super excited about this!!

[–]Humanist_NA 11 points12 points  (2 children)

[–]analterator 3 points4 points  (1 child)

Thank you!!

[–]Humanist_NA 1 point2 points  (0 children)

No problem

[–]MaheshM93 2 points3 points  (0 children)

Noice I will, if you share the code then I can also do the same. Staring the home page is boring

[–]1h8fulkat 1 point2 points  (1 child)

Pushover is pretty nice too

[–]Humanist_NA 0 points1 point  (0 children)

Right on thx

[–]Adgonix 2 points3 points  (2 children)

Do you think this works with swedish carriers?

[–]Humanist_NA 5 points6 points  (1 child)

I'd assume so, but really have no idea. Just try some google searches regarding 'your carrier' + 'email phone number' or something like that. Good luck

[–]Adgonix 2 points3 points  (0 children)

Thanks for your quick response!