K3STROS Posted October 20, 2015 Posted October 20, 2015 (edited) I have 35 variables (as shown below) in an array and i want it to randomly select one, and then another and another and another so on, until all 35 are selected but never selecting the same one twice.. this has been my only issueGlobal $example[35][ex1, ex2, ex3....,] Global $ex1 = MouseClick("Left", x1, y1) Global $ex2 = MouseClick("Left", x1, y1) Global $ex3 = MouseClick("Left", x1, y1) ; ect..... Func Something() Random($example) ;35 Times, cant be same var EndFuncThanks in advance Edited October 20, 2015 by K3STROS Forgot to change it with new vars
JohnOne Posted October 20, 2015 Posted October 20, 2015 Show your code.And by the way you cannot get 35 unique variables from an array with 28 elements. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
K3STROS Posted October 20, 2015 Author Posted October 20, 2015 I dont have the code, ive been doing trial and error with suggestions from others with alot of trials & errors with no success
LarsJ Posted October 20, 2015 Posted October 20, 2015 It's not that difficult:#include <Array.au3> Global $aArray[35], $aIndex[35] For $i = 0 To 34 $aArray[$i] = "ex" & $i + 1 $aIndex[$i] = $i Next For $i = 34 To 0 Step -1 $j = $aIndex[Random( 0, $i, 1 )] ConsoleWrite( $aArray[$j] & @CRLF ) _ArrayDelete( $aIndex, _ArraySearch( $aIndex, $j ) ) Next K3STROS 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
jchd Posted October 20, 2015 Posted October 20, 2015 _ArrayShuffle does exactly that. K3STROS 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
K3STROS Posted October 20, 2015 Author Posted October 20, 2015 _ArrayShuffle does exactly that.Im very new to this, how and where would i put _ArrayShuffle ?
kylomas Posted October 20, 2015 Posted October 20, 2015 hmmmm...after looking the function up in the help file you would have come up with something like this...#include <Array.au3> Global $aArray[35] For $i = 0 To 34 $aArray[$i] = "ex" & $i + 1 Next _arrayshuffle($aArray) _arraydisplay($aArray)kylomas K3STROS 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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