jeeswg wrote:.
@jeeswg, here is the thing,
I like to put OnMessage() functions inside other functions and run them at script execution through static variables!
So, it means that, it is not necessary to use OnMessage() function at the beginning of the script, because OnMessage() is already inside the other functions!
But, as you can see in the example below, it seems that the OnMessage() from "y()" function deactivates the OnMessage() from "x()" function, and so, only y count occurs!
Code: Select all
global x := 20, y := 20
gui, add, text, w200 h200 vtext,
gui, show
return
guiclose: ;_____________ gui close ____________
exitapp
x() ;_____________
{
Static RunAtScriptExecution := onmessage(0x200, "x")
X++
tooltip, % "x" x " - y" y
}
y() ;______________
{
Static RunAtScriptExecution := onmessage(0x200, "y")
y++
tooltip, % "x" x " - y" y
}
So, @CapnOdin solution may be the best way to go! (Though I don't like to use OnMessage at the beginning of the script, but anyway, I can live with that!)
Code: Select all
OnMessage(0x200, "MouseMove")
MouseMove()
{
x()
y()
}
global x := 20, y := 20
gui, add, text, w200 h200 vtext,
gui, show
return
guiclose: ;_____________ gui close ____________
exitapp
x() ;_____________
{
X++
tooltip, % "x" x " - y" y
}
y() ;______________
{
y++
tooltip, % "x" x " - y" y
}