pwnt Posted May 6, 2009 Share Posted May 6, 2009 Ok, I am having a problem here, I have a script that I'm working on that is gonna record mousepos with the click of a button. When I click the button, Autoit will save the value with mousegetpos, If i click the button multiple times I want the mouse positions to be saved in a "bin" where I can access them later in a different function. Something like this I was thinking... HotKeySet( "{f8}","record") HotKeySet("{F5}","Start") while 1 sleep(10) WEnd func record() ;trying to make the record values go up in value every time i click so I can use it multiple times in a row. ;trying to use a mathematical function that adds +1 to the function every time, like: first time record1, second record2, record 3 $record1+1= MouseGetPos() ;will that +1 work? ; and now I want to save the value it just got in a "bin" so I can use it later in other functions SAVING SCRIPT HERE -.-..-.-.-.-.-.-..-..- EndFunc func start() while 1 mousemove($record1+1[0],$record1+1[1],50) ;does this check if there is a function called if $record2+1 = False then;gonna go to another value no need to have it here EndIf WEnd EndFunc so, most importantly, will that +1 work after functions to make the func be called record2 and next time record3 ETC. and how do you save the values to a bin so you can access them later in a different function. Link to comment Share on other sites More sharing options...
exodius Posted May 6, 2009 Share Posted May 6, 2009 (edited) You'll most likely want to use an Array. Example:#include <Array.au3> ; Only necessary for easy display using _ArrayDisplay below Dim $array[10] For $x = 0 To UBound ($array)-1 $array[$x] = $x Next _ArrayDisplay($array) ; Only necessary for easily displaying the results, you can use a For...Next Loop identical to the one above to read back through them.*Edit - You can also dynamically increase your array size using ReDim Edited May 6, 2009 by exodius Link to comment Share on other sites More sharing options...
pwnt Posted May 6, 2009 Author Share Posted May 6, 2009 You'll most likely want to use an Array. Example: #include <Array.au3> ; Only necessary for easy display using _ArrayDisplay below Dim $array[10] For $x = 0 To UBound ($array)-1 $array[$x] = $x Next _ArrayDisplay($array) ; Only necessary for easily displaying the results, you can use a For...Next Loop identical to the one above to read back through them. *Edit - You can also dynamically increase your array size using ReDim Ok, I've been trying to learn arrays for a while now, I understand it atleast decently, but when it comes to mousepos, I can't use the [0], and [1], after the $array[2] for example. Atleast it solved one of my problems, the global functions, thanks for that. So got any ideas? been searching around for about an hour now, just cant find it. Thanks in advance Link to comment Share on other sites More sharing options...
pwnt Posted May 7, 2009 Author Share Posted May 7, 2009 Anyone got a solution? (bump) Link to comment Share on other sites More sharing options...
Aceguy Posted May 7, 2009 Share Posted May 7, 2009 there ya go #include<misc.au3> #include<array.au3> dim $array[1] Do if _ispressed("01") Then while _IsPressed("01") sleep(50) WEnd $ms=MouseGetPos() _ArrayAdd($array,$ms[0]&","&$ms[1]) EndIf until _ispressed("1b");press escape to quit _ArrayDisplay($array) [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now