Jump to content
Sign in to follow this  
Valkyrie

print a random value

Recommended Posts

Valkyrie

Dear readers,

Mij code is as displayed here:

$msgrand = 1

$text0 = "....."
$text1 = "....."
$text2 = "....."
$text3 = "....."

Now I do this:

if $msgrand >= 1 Then
    $nr = Random(0, 9)
;WHAT HERE?
EndIf

The problem is, that it wont send the chosen text. Can someone tell me what I am doing wrong?

I want to display (send) one of the random text that has been set with $text0 up to $text3.

Best regards

P.S. the ;WHAT HERE? part should need a code, but I dont know the correct one!

something like Send($text[$nr]) maybe?

Edited by Valkyrie

Share this post


Link to post
Share on other sites
monoceres

Use arrays instead.

Local $Texts[4]=["This","Array","Contains","Text"]

$Rand=Random(0,UBound($Texts)-1,1)

Send($Texts[$Rand])

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Valkyrie

oke got it now, thanks a lot :D

Edited by Valkyrie

Share this post


Link to post
Share on other sites
monoceres

I cant use

local $text = ["world domination!?", "level?", "boooooorrrringgg!"]

gives me the error:

C:\Users\Angelo\Desktop\sknnr.au3(4,9) : ERROR: syntax error

which points to:

local $text = ["world domination!?", "level?", "boooooorrrringgg!"]
Look at my code again. Notice that I specified how many items I was adding.

Broken link? PM me and I'll send you the file!

Share this post


Link to post
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
Sign in to follow this  

×