Jump to content

Getting Variables Out Of An Array ?


Recommended Posts

Hi,

I have the folowing script :

#include <Array.au3>

Dim $R[7]

Dim $Num1

Randomize()

_ArrayDisplay( $R, " Array")

MsgBox (0, "Test", $Num1)

Func Randomize()

$R[1] = Random(1, 45, 1)

$R[2] = Random(1, 45, 1)

$R[3] = Random(1, 45, 1)

$R[4] = Random(1, 45, 1)

$R[5] = Random(1, 45, 1)

$R[6] = Random(1, 45, 1)

If $R[1] = $R[2] Or $R[1] = $R[3] Or $R[1] = $R[4] Or $R[1] = $R[5] Or $R[1] = $R[6] Then Randomize ()

If $R[2] = $R[3] Or $R[2] = $R[4] Or $R[2] = $R[5] Or $R[1] = $R[6] Then Randomize ()

If $R[3] = $R[4] Or $R[3] = $R[5] Or $R[1] = $R[6] Then Randomize ()

If $R[4] = $R[5] Or $R[1] = $R[6] Then Randomize ()

_ArraySort($R, 0, 1)

$Getal1 = _ArrayToString ($R, 1, )

EndFunc

This script generates a Array with 7 numbers between 1 and 45. How can I get a value out of an Array and put it in a string. I want to do this because the array is sorted. For example I want to create variables like this

$Num1 = _ArrayToString ($R, 1, 1, )

$Num2 = _ArrayToString ($R, 2, 2, )

$Num3 = _ArrayToString ($R, 3, 3, )

$Num4 = _ArrayToString ($R, 4, 4, )

$Num5 = _ArrayToString ($R, 5, 5, )

$Num6 = _ArrayToString ($R, 6, 6, )

$Num7 = _ArrayToString ($R, 7, 7, )

Is this posible ?

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