tgibson
Resource contributor
- Messages
- 11,875
- Country

Hi,
I'm looking for a method to loop through variable indexes (FS9). Here is the current code I'm using, which stops at station load 10:
G:Var8 is incremented by a loop, and the code above totals up the Station Loads. But what I would really prefer is to say "loop through the station loads until you reach one that is 0, then stop". I tried to put a variable into an incrementing loop and pass that to the macro each time as the index value, but I could never get that to work. I also tried using the PAYLOAD STATION COUNT variable but it always returned 0 in my hands. Does anyone have any clues? Was I just doing something wrong?
Thanks,
I'm looking for a method to loop through variable indexes (FS9). Here is the current code I'm using, which stops at station load 10:
Code:
<Macro Name="StaLoad"> (G:Var8)
s0 1 == if{ (A:Payload Station Weight:1, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 2 == if{ (A:Payload Station Weight:2, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 3 == if{ (A:Payload Station Weight:3, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 4 == if{ (A:Payload Station Weight:4, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 5 == if{ (A:Payload Station Weight:5, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 6 == if{ (A:Payload Station Weight:6, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 7 == if{ (A:Payload Station Weight:7, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 8 == if{ (A:Payload Station Weight:8, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 9 == if{ (A:Payload Station Weight:9, pounds) (L:Payload, number) + (>L:Payload, number) } els{
l0 10 == if{ (A:Payload Station Weight:10, pounds) (L:Payload, number) + (>L:Payload, number) }
} } } } } } } } }
<!-- add station loads: max = 10 -->
</Macro>
G:Var8 is incremented by a loop, and the code above totals up the Station Loads. But what I would really prefer is to say "loop through the station loads until you reach one that is 0, then stop". I tried to put a variable into an incrementing loop and pass that to the macro each time as the index value, but I could never get that to work. I also tried using the PAYLOAD STATION COUNT variable but it always returned 0 in my hands. Does anyone have any clues? Was I just doing something wrong?
Thanks,


