Sign in to follow this  
Followers 0
TwoDesperateMen

[FIRST TIME WITH AUTOIT] Minesweeper Bot help?

18 posts in this topic

btw this is on windows 7, and I have VERY basic knowledge of autoit right now. I've been using it for exactly 4 hours. Anyways, so I'm trying to make a bot that actually PLAYS minesweeper for you. Doesn't win, doesn't edit memory, I just want it to be like an actual player. So I had no idea what to do and this is the first part of my script. I'm pretty sure theres a better way to make the mouse click on a box than pixel colors, but I don't know how. Any suggestions?

WinWaitActive( "Minesweeper" )
Beep(500, 1000)
WinActivate("Minesweeper")
$coord= PixelSearch( 0,0, @DesktopWidth, @DesktopHeight, 0x8FC2F3)
If Not @error Then
    MouseClick( "left", $coord[0], $coord[1], 1, 0)
EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First of all, welcome to the forums! ;)

Second, about your question.

Straight from the helpfile:

Remember, a typical display at 1024 x 768 has 786432 pixels. Although PixelSearch is optimized, narrowing the search area helps speed up the result.

Take a look at WinGetPos and WinGetClientSize.

If you use these functions first to get Minesweeper coords and size, you can optimize the speed of PixelSearch.

Like this.

HotKeySet("{ESC}", "_Exit")

Global $sTitle = WinGetTitle("Minesweeper")
Global $sColor = 0x8FC2F3

If (Not WinActive($sTitle)) Then WinActivate($sTitle)
WinWaitActive($sTitle)

Dim $aWinPos = WinGetPos($sTitle)
Dim $aWinSize = WinGetClientSize($sTitle)

While 1
    $aCoord = PixelSearch($aWinPos[0], $aWinPos[1], $aWinSize[0], $aWinSize[1], $sColor)
    If (IsArray($aCoord)) Then
        MouseClick("left", $aCoord[0], $aCoord[1], 1, 0)
    EndIf
WEnd

Func _Exit()
    Exit
EndFunc

EDIT: Added While, WEnd.

The script now keeps looking for the color until you press ESCAPE.

Also, I have no idea if this will work. I can't test on Win7 because I simply don't have it.

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Welcome to the forum !

See this post first...


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Welcome to the forum !

See this post first...

:)!

I think Minesweeper is allowed.

I even did a minesweeper bot once before.;)

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

I don't see any exception in Valik Annoucement...Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

That's true.

But on the other side, where are the Windows Minesweeper ToS? ;)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

That's true.

But on the other side, where are the Windows Minesweeper ToS? ;)

What's that ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Terms of Service... Or did I mean Terms of Agreement? ;)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Terms of Service... Or did I mean Terms of Agreement? ;)

Ok, but I think forums rules are availables for all games ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

As far as I can see is that Valik made it very clear.

There aren't any exceptions.

DO NOT DISCUSS GAME AUTOMATION HERE

Edited by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

Oh well, just thought so because of all the previous minesweeper bots. ;)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

It's called Valik's TOS.

Oh-oh... ;) Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

I would like to know where the line is drawn. I do not BOT and do not think that it is fair to BOT (CHEATING), but have seen many threads that do not get blocked/closed and there needs to be a stand. NO $!#$@#$ BOTS or allow them - but make up YOUR mind.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

[================================================================================]

legend:

'[' Left border.

']' Right border.

'=' Line.

if this topic gets locked its probably because the bickering about (whatever). And not the minesweeper game part.

But request like "but make up YOUR mind" could do the trick to.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

I would like to know where the line is drawn. I do not BOT and do not think that it is fair to BOT (CHEATING), but have seen many threads that do not get blocked/closed and there needs to be a stand. NO $!#$@#$ BOTS or allow them - but make up YOUR mind.

Excuse me.... Go play somewhere else when things are making you emotional but don't vent it here.

The rules are clear these days!

*click*

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0