Booo Posted May 22, 2014 Share Posted May 22, 2014 can any one help me please i'm new in autoit my code please fix it HotKeySet("{ESC}", "Terminate") local asd = { "{SPACE}", "{W}", "{D}", "{A}", "{S}", } While 1 Local $iRandom = Random(1, 5) Send(asd[$iRandom]) WEnd Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted May 22, 2014 Developers Share Posted May 22, 2014 can any one help me please i'm new in autoit my code please fix it Assume this is a language knowledge gap or else this is a little rude way of asking for help. So, what is your problem? What is it you can't get solved yourself? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Booo Posted May 22, 2014 Author Share Posted May 22, 2014 Assume this is a language knowledge gap or else this is a little rude way of asking for help. So, what is your problem? What is it you can't get solved yourself? Jos sorry my friend but i'm bad in english i see wiki http://www.autoitscript.com/wiki/Arrays and i fix it thank u any way HotKeySet("{ESC}", "Terminate") Local $arr[4] = ["{W}", "{D}", "{A}","{S}"] While 1 Local $iRandom = Random(0, 3) Send($arr[$iRandom]) WEnd Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted May 22, 2014 Share Posted May 22, 2014 Use... Local $iRandom = Random(0, 3, 1) Or Random will return a float decimal, for example 1.24 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jdelaney Posted May 22, 2014 Share Posted May 22, 2014 (edited) Looks good to me, except the 3rd param on random: HotKeySet("{ESC}", "Terminate") Local $arr[4] = ["{W}", "{D}", "{A}","{S}"] While 1 ConsoleWrite($arr[Random(0, UBound($arr)-1, 1)] & @CRLF) Sleep(10) WEnd Func Terminate() Exit 0 EndFunc Edited May 22, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Booo Posted May 22, 2014 Author Share Posted May 22, 2014 Use... Local $iRandom = Random(0, 3, 1)Or Random will return a float decimal, for example 1.24 thank u bro i fix it Looks good to me, except the 3rd param on random: HotKeySet("{ESC}", "Terminate") Local $arr[4] = ["{W}", "{D}", "{A}","{S}"] While 1 ConsoleWrite($arr[Random(0, UBound($arr)-1, 1)] & @CRLF) Sleep(10) WEnd Func Terminate() Exit 0 EndFunc thank u I like the function UBound, 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