Jump to content
Sign in to follow this  
trillion

Multiple variable nesting

Recommended Posts

trillion

i have many variable doing different task , hope someone can fix this dead knot

this variable is declared and use $1num1 ..... until $10num10

is there any way to call the above variable using a loop

eg: $x =1 and loop to $x=10 , $y=1 and loop to $y=10

to fulfill this condition :

if $($x)num($y) then ;{do something}

thank you

Share this post


Link to post
Share on other sites
weaponx

For $X = 1 to 10

ConsoleWrite(Eval($X & "num" & $X))

Next

Edited by weaponx

Share this post


Link to post
Share on other sites
PsaltyDS

i have many variable doing different task , hope someone can fix this dead knot

this variable is declared and use $1num1 ..... until $10num10

is there any way to call the above variable using a loop

eg: $x =1 and loop to $x=10 , $y=1 and loop to $y=10

to fulfill this condition :

if $($x)num($y) then ;{do something}

thank you

You should just work with an array:

Global $avNum[10] = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90] ; indexes are 0 thru 9

$x = 1
$y = 2

$avNum[$x] = "This is my variable."
$avNum[$y] = "There are many like it, but this one is mine."
$avNum[$x + $y] = $avNum[$x] & "  " & $avNum[$y]

For $n = 0 To 9
    ConsoleWrite("Debug: $avNum[" & $n & "] = " & $avNum[$n] & @LF)
Next

And weaponx knows better: "Assign/Eval are evil!" "Bad mutant!"

:P


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

Share this post


Link to post
Share on other sites
weaponx

I don't use either in my scripts. Much like the movie Hellraiser, I have been to the 4th dimension and I am the array master.

Share this post


Link to post
Share on other sites
Monamo

I don't use either in my scripts. Much like the movie Hellraiser, I have been to the 4th dimension and I am the array master.

4-dimensional arrays *shudder*

Took me long enough to juggle some of my 2-dim issues effectively


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

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  

×