|
Mortis Beginner
Joined: 10 Feb 2004 Posts: 21 Location: Sweden
|
Posted: Tue Oct 26, 2004 2:37 pm
Index values in 2 or more #forall |
Hello!
As the topic implies I have a problem with Index values.
Without dragging into what Iam build these variables/lists are exemples of the real ones except their real names.
#VAR Mains {Main1|Main2}
#VAR Main1 {Alt1|Alt2|Alt3}
#VAR Main2 {Alt4|Alt5|Alt6}
#VAR Alt1 {Info1|Info2|Info3}
#VAR Alt2 {Info4|Info5|Info6}
#VAR Alt3 {Info7|Info8|Info9}
#VAR Alt4 {Info10|Info11|Info12}
#VAR Alt5 {Info13|Info14|Info15}
#VAR Alt6 {Info16|Info17|Info18}
Now I want to be able to view all 3 index values of 3 #FORALL commands that's stacked.
I'll write an example.
#FORALL @Mains {#FORALL @%i {#FORALL @{%%i} {#SAY %%i}}}
That code works in the command line but when I put this line in as alias, it stops working.
I assumed he couldnt understand my functions somehow so I changed the code to this:
#FORALL @Mains {#FORALL @%i {#FORALL %eval( @%repeatnum) {#say %repeatnum}}}
Bold part of the code is the part i changed. Now it works both command line and in alias.
Now it shows me the last index value, which is the most important part.
Here comes the problem. I want to be able to use/view the current index value of ALL the 3 #FORALL.
This code below is the same as above but Iam trying to #say all 3 values.
#FORALL @Mains {#FORALL @%i {#FORALL %eval( @%repeatnum) {#say %i - %repeatnum - %repeatnum}}}
The bold selection is the bit of code I have a problem with. Donno what I should write.
This will show:
Code: |
Main1 - Info1 - Info1
Main1 - Info2 - Info2
Main1 - Info3 - Info3
Main1 - Info4 - Info4
Main1 - Info5 - Info5
Main1 - Info6 - Info6
Main1 - Info7 - Info7
Main1 - Info8 - Info8
Main1 - Info9 - Info9
Main2 - Info10 - Info10
Main2 - Info11 - Info11
Main2 - Info12 - Info12
Main2 - Info13 - Info13
Main2 - Info14 - Info14
Main2 - Info15 - Info15
Main2 - Info16 - Info16
Main2 - Info17 - Info17
Main2 - Info18 - Info18
|
When I want him to show:
Code: |
Main1 - Alt1 - Info1
Main1 - Alt1 - Info2
Main1 - Alt1 - Info3
Main1 - Alt2 - Info4
Main1 - Alt2 - Info5
Main1 - Alt2 - Info6
Main1 - Alt3 - Info7
Main1 - Alt3 - Info8
Main1 - Alt3 - Info9
Main2 - Alt4 - Info10
Main2 - Alt4 - Info11
Main2 - Alt4 - Info12
Main2 - Alt5 - Info13
Main2 - Alt5 - Info14
Main2 - Alt5 - Info15
Main2 - Alt6 - Info16
Main2 - Alt6 - Info17
Main2 - Alt6 - Info18
|
So... Anyone have any ideas on how I can get all three index values in the last #forall??
I know it can be done with some temporary variables but I hate code that uses to much variables
Sorry for the amount of text in the post but I didnt know of a good way to describe my problem. |
|
_________________ When you lose, dont lose the lesson. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Oct 26, 2004 7:31 pm |
increment i to the next letter for each inner loop
#foral {%i;#forall {%j;#forall {%k;#forall {%l}}}} |
|
|
|
|
|