Jump to content

Func Recursion and GUICtrlSendMsg


Recommended Posts

I'm trying to finish up the Tic-Tac-Toe game I've been working on for the last day or so, but I've finally come to a complete brick wall.

Currently, if you play against the computer, the computer will generate a button of a number, and return with the ControlID of the button it wants to press. The problem is, I can't figure out how to send a message to GUIGetMsg() saying that it wants to be pressed.

The other problem is, if it draws near to a stalemate, it errors out saying that the recursion level has exceeded (if the button is pressed, the function is run again, I can change to a while loop if necessary).

Any help will be GREATLY appreciated

Tic_Tac_Toe.au3

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Func BotTurn()
    Local $numgen = Random(0, 8, 1)
     While $buttons[$numgen] == 1
         $numgen = Random(0, 8, 1)
    WEnd
    $botturn = $buttons[$numgen]
    ControlClick ( "Tic-Tac-Toe", "", $CtrlButtons[$numgen] )
EndFunc;==>BotTurn

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...