Jump to content
Sign in to follow this  
LotusCobra

New to AutoIT - Can't Get a Simple MouseClick working...

Recommended Posts

LotusCobra

I'm trying to program a simple program for self use in Magic Online. I followed a few simple tutorials to get accustomed to the syntax (used to C++) and I've hit a bit of a brick wall with the simplest of functions. I cannot seem to get the program to click anywhere on the game window. I don't get any errors or anything, it just doesn't do anything. (Seemingly)

I'm using a GUI button to call this incredibly simple function:

Func GoToCollection()
MouseClick("Left",240,1021, 2)
EndFunc

My GUI code:

GUICreate("Test Window",500,500)
GUISetState(@SW_SHOW)

$startbutton = GUICtrlCreateButton("Start", 8, 8, 60)

While 1
$msg = GUIGetMsg()

Select

Case $msg = $startbutton
WinActivate("Magic Online", "")
Sleep(1000)
Call(GoToCollection())

Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop

EndSelect

WEnd

Obviously, I've double and triple decked that the mouse coordinates are correct before posting, so it's not something as silly as that, but I imagine it's something rather simple that I'm overlooking, but I can't seem to figure it out via Google searches. The window switch works, but then nothing happens. I've tried it without the function call and just doing it in the switch, I've tried clicking a lot of different buttons but none of them will click. Any idea what I'm overlooking here?

Edited by LotusCobra

Share this post


Link to post
Share on other sites
MrChiliCheese

Have a look in the help file at Opt / MouseCoordMode.

My guess is that you got the values with WinInfo. Within the default setting the mouse is moved to the absolut screen coordinates. Try this in the beginning of your script:

Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client

Share this post


Link to post
Share on other sites
water

Welcome to Autoit and the forum!

Unfortunately you've missed to read the forum rules (link is in the lower right corner of this page).

Game automation isn't allowed here.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
LotusCobra

Have a look in the help file at Opt / MouseCoordMode.

My guess is that you got the values with WinInfo. Within the default setting the mouse is moved to the absolut screen coordinates. Try this in the beginning of your script:

Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client

Hmm, tried it in all 3 modes and none of them seemed to change anything.

Welcome to Autoit and the forum!

Unfortunately you've missed to read the forum rules (link is in the lower right corner of this page).

Game automation isn't allowed here.

Even when it's widely supported by the game? The game's entire economy is run by bots. (And it's mostly seen as a good thing) Edited by LotusCobra

Share this post


Link to post
Share on other sites
water

The Mods handle the rules rather strict when it comes to game automation. Let's see what the Mods say ...


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

LotusCobra,

water is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. We have no interest in what goes on elsewhere - here we do not support bots. Follow the rules or leave. Thread locked. :naughty:

MrChiliCheese,

If a post is obviously game-related (and "for self use in Magic Online" is a pretty good clue) best not to offer any help. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


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

×