Jump to content

help: Code random string


Recommended Posts

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

  • Developers

 

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

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

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 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...