Howdy all! I've seen various macros that are able to define a range of variables and then calculate/define another variable which is, itself, just the sum total of the NUMBER of variables previously set. For example, this snippet here in a macro that checks an ini for how many merchants are listed in it, and defines the total merchant count which is then later used in a /for loop:
[CODE title="example"]/declare MerchantCount int local ${Ini[${IniFile},${Zone.ShortName}-Merchants].Count[|]}
/declare MerchantCount2 int local ${Ini[${IniFile},${Zone.ShortName}-Merchants2].Count[|]}
/declare MerchTotal int local 0
/varcalc MerchTotal ${Math.Calc[${MerchantCount}+${MerchantCount2}]}[/CODE]
Two questions about this. First, just so I have a better knowledge of all this stuff, in the /declare MerchantCount lines what is the purpose of the [|] being placed after "Count" ??
But to my more specific question, can you only count up the number of variables if pulling the information from an ini? Stated otherwise, can I achieve this same thing from within--and ONLY within--a macro? I don't mind the answer being no, just trying to find out if I can do like a "Item1" "item2" "item3" etc. from within a macro and then run the macro from a /for loop instead of having 10 placeholder variables where 7 are named NULL
[CODE title="example"]/declare MerchantCount int local ${Ini[${IniFile},${Zone.ShortName}-Merchants].Count[|]}
/declare MerchantCount2 int local ${Ini[${IniFile},${Zone.ShortName}-Merchants2].Count[|]}
/declare MerchTotal int local 0
/varcalc MerchTotal ${Math.Calc[${MerchantCount}+${MerchantCount2}]}[/CODE]
Two questions about this. First, just so I have a better knowledge of all this stuff, in the /declare MerchantCount lines what is the purpose of the [|] being placed after "Count" ??
But to my more specific question, can you only count up the number of variables if pulling the information from an ini? Stated otherwise, can I achieve this same thing from within--and ONLY within--a macro? I don't mind the answer being no, just trying to find out if I can do like a "Item1" "item2" "item3" etc. from within a macro and then run the macro from a /for loop instead of having 10 placeholder variables where 7 are named NULL



