Hello xstrikerx123.
Welcome to the AutoHotkey community forums.
Random command takes only 3 parameters, so there should be no comma after the third.
Code: Select all
Random, randX, 0, 145
Random, randY, 0, 35
When you put a comma after the third parameter, which is the last of this command, you cause AutoHotkey to think the value of the third parameter includes a comma, which means it will process that value as text instead of number. And since a Text has no defined mathematical value, the command Random will run without any maximum value, which will cause it to output enormously high numbers. Using these enormous numbers in MouseMove will than causes the cursor to be sent to somewhere along the borders of the screen.
As a side note, when things don't run smoothly with your code, it is usefull to use messagebox to check the contents of the variables most critical to your code, which is what revealed the issue to me.
Code: Select all
Random, randX, 0, 145,
messagebox, %RandX%
Best wishes.