t0pcraft Posted August 8, 2008 Share Posted August 8, 2008 (edited) hi! i made a script where the user can put some text into input boxes. after clicking apply those texts will be displayed in the chat line, everything works fine. now i decided that the messages (10) should be displayed randomized, meaning in a random order so i tried it out, now the code is: expandcollapse popup$randommessage = Random(1, 10) Select Case $randommessage = 1 Send($msg1) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 2 Send($msg2) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 3 Send($msg3) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 4 Send($msg4) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 5 Send($msg5) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 6 Send($msg6) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 7 Send($msg7) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 8 Send($msg8) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 9 Send($msg9) Send ("{ENTER}") Sleep ($interval) Case $randommessage = 10 Send($msg10) Send ("{ENTER}") Sleep ($interval) EndSelect the problem: no error, but nothing is displayed.... what am i doing wrong? any help is highly appreciated regards, t0pcraft Edited August 8, 2008 by t0pcraft Link to comment Share on other sites More sharing options...
DW1 Posted August 8, 2008 Share Posted August 8, 2008 (edited) you are not using whole numbers, try this: int(Random(1, 10))oÝ÷ ØjtáÆ®¶se&æFöÒ Edited August 8, 2008 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
monoceres Posted August 8, 2008 Share Posted August 8, 2008 Hi! You should really learn how to use arrays, it will simplify these things a lot! Dim $messages[5]=["Hello","Good bye","Good morning","Good night","Good afternoon"] _RandomizeArray($messages) For $i=0 To Ubound($messages)-1 Send($messages[$i]) Send("{ENTER}") Sleep(50) Next Func _RandomizeArray(ByRef $array) For $i=0 To Ubound($array)*2 $rand1=Random(0,Ubound($array)-1,1) $rand2=Random(0,Ubound($array)-1,1) $temp=$array[$rand1] $array[$rand1]=$array[$rand2] $array[$rand2]=$temp Next EndFunc Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 8, 2008 Share Posted August 8, 2008 you are not using whole numbers, try this: int(Random(1, 10)) How about just using the integer flag in the function? Random(1, 10, 1) What makes that funny is I know you've been around long enough to know that, Dan! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
DW1 Posted August 8, 2008 Share Posted August 8, 2008 ahahaha, so right... wasn't even thinking about it that hard, just saw it wasn't an integer so I put it in an int() lol. good call PsaltyDS. lol /sheepish AutoIt3 Online Help Link to comment Share on other sites More sharing options...
t0pcraft Posted August 8, 2008 Author Share Posted August 8, 2008 (edited) thanks for your answers! i'm trying it out now edit: yeah it works!! thanks alot you all @monoceres ye arrays are a good solution! i think i will do that, but not now Edited August 8, 2008 by t0pcraft 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