HelpRandom # key generation

Posts 1–11 of 11 · Page 1 of 1
Random # key generation
I am trying to make autoit script that will send a random # key

i have tried many different things this is the most recent two

Code:
 func key()
	 $key = Random(1, 9)
	If $key = 1 Then  send("{1}")
	If $key = 2 Then  send("{2}")
	If $key = 3 Then  send("{3}")
	If $key = 4 Then  send("{4}")
	If $key = 5 Then  send("{5}")
	If $key = 6 Then  send("{6}")
	If $key = 7 Then  send("{7}")
	If $key = 8 Then  send("{8}")
	If $key = 9 Then  send("{9}")
	endfunc
Code:
 

func send()
	 $key = Random(1, 9)
	If $key = 1 Then  $key1 = "{1}"
	If $key = 2 Then  $key1 = "{2}"
	If $key = 3 Then  $key1 = "{3}"
	If $key = 4 Then  $key1 = "{4}"
	If $key = 5 Then  $key1 = "{5}"
	If $key = 6 Then  $key1 = "{6}"
	If $key = 7 Then  $key1 = "{7}"
	If $key = 8 Then  $key1 = "{8}"
	If $key = 9 Then  $key1 = "{9}"
        send($key1)
	endfunc
but this doesnt work. there is no syntax errors but does nothing. thanks for anyhelp
I havent done AutoIT in a while, but doesnt the quotations have to be inside with the numbers?
Quote Originally Posted by Pie View Post
I havent done AutoIT in a while, but doesnt the quotations have to be inside with the numbers?
which numbers ?
Wow that is pretty rediculous coding.. personally this is my random sendkey for randomizing server selection if that is what you're doing..

ControlSend($wWindow, "", "", Random(125, 200, 1))

This will randomize the server selection between 125-200. Leaving the third digit as 1 will force the number to be a integer rather than a float/decimal.

Refer to this webpage to how to make it work for you

http://www.autoitscript.com/autoit3/...ons/Random.htm
Quote Originally Posted by nick2412 View Post
Wow that is pretty rediculous coding.. personally this is my random sendkey for randomizing server selection if that is what you're doing..

ControlSend($wWindow, "", "", Random(125, 200, 1))

This will randomize the server selection between 125-200. Leaving the third digit as 1 will force the number to be a integer rather than a float/decimal.

Refer to this webpage to how to make it work for you

Function Random
^^ this, here some more examples
Code:
HotKeySet("{F1}", "test1")
HotKeySet("{F2}", "test2")
HotKeySet("{F3}", "test3")
While 1
WEnd

Func test1()
  Send( random(1, 10, 1) )
EndFunc

Func test2()
  $rand = random(1, 10, 1)
  Send($rand)
EndFunc

Func test3()
  $rand = random(0, 9, 1)
  Send("{Numpad" & $rand & "}")
EndFunc
You know that this is the Vindictus section?
Quote Originally Posted by Nico View Post
You know that this is the Vindictus section?
its for vindi. for some reason nothing i try will actually put a random # key into a chat box. i just didnt mention it in my post but you already see its application to the game of choose^^
Quote Originally Posted by lawyer666 View Post
its for vindi. for some reason nothing i try will actually put a random # key into a chat box. i just didnt mention it in my post but you already see its application to the game of choose^^
What do you need a random number in the chat box for?

Regardless, what I would do is something along the lines of:

Code:
Dim $RandomNumber, $RandomLetter, $Letter, $Vindictus

$Vindictus = "Vindictus.exe"
$RandomNumber = Random(1, 200, 1)
$RandomLetter = Random(0, 1)

If $RandomLetter < 0.5 Then
    ;Capitals
    $Letter = Chr(Random(Asc("A"), Asc("Z"), 1))
Else
    ;Lower case
    $Letter = Chr(Random(Asc("a"), Asc("z"), 1))
Endif

WinActivate($Vindictus)
WinWaitActive($Vindictus)

;Put mouse commands or keystroke commands here to get to wherever you want the text.

Send("Insert text here" & $RandomNumber & $Letter)
Of course, I'm not a real good programmer, so this may or may not work.
Shet. shet geighz ! I only had to add a 1 to "random(1,9,"1") . ah. man that is crazy. thanks guys.
lol ... the only reason I see why you need to put a random number in your chatbox is for gold advertising, but then again, that's just my intuition.

Good luck with whatever you're trying to accomplish.
Quote Originally Posted by azngamerztim View Post
lol ... the only reason I see why you need to put a random number in your chatbox is for gold advertising, but then again, that's just my intuition.

Good luck with whatever you're trying to accomplish.
Yeah, that was exactly my thought too. But until he tells us why he needs it, we'll never truly know.
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us