How does one utilize "Allow Multiple" option for parameters? Figured something so basic had already been asked and answered, but I can't seem to find anything via search.
Edit: In particular, my problem is writing the function itself - let's say you have the following:
Did a quick check myself as I always wondered, but it does exactly what it says, allows multiples of the same paramater type to be added. Ever messed with combine strings multiple, or comine text multiple when working with strings/text? Remeber how it had Text+ or whatever as the paramater and you could add multiple paramater types for combining? It uses the Allow Multiple checkbox to do that, so in essance instead of having a paramater type you take and only able to take in one argument you can acutally put in multiples by using this option.
To try it out, take any fuction/action/condition etc you may have and find a parameter and check the box Allow Multiple, now goto a trigger or another function/action/condition, where ever you call that unction/action/condition you just checked the Allow Multiple on and go to that paramater. Now right click on the paramter type and click on select new paramater, you can do this as many times as you like.
Havn't really played with it myself but neat stuff. Hope that helps.
Hey thanks for the help. I really should have been more specific. I get how to make a parameter allow multiple, and I understand how to pass parameters to that function (just like the arithmetic / string functions). My problem is writing the function itself - let's say you have the following:
The "allow multiple" behavior has been acting wonky for me. Even with only one parameter and having "allow multiple" enabled on it, I'll receive compiler errors if there are more than 1 parameters calling the action definition. But yes, even if I can get rid of this compiler error ("Script failed to compile: Wrong number of parameters"), it's not intuitive at all how to access the various parameters.
I attempted to use the advice in that thread and make a custom function such that:
voidgf_addPoints(pointlp_points,...)//and similar calls like this
I believe the ", ..." is how it's done in C, but it didn't work here with a compiler error on that line. :( I wish I could look at the "combine multiple text" galaxy code for myself to see how it's done.
I looked into the thing a little more closely and came to the following conclusion:
Allow Multiple is actually only a "dummy" which is used for a few GUI actions (combine string/real/int/..). If you try using it yourself it blows up (= doesn't work).
I believe they added it when they had plans for function overloading, but that feature never made it in. Since there's no overloading, Allow Multiple is useless.
The few GUI actions that use this option actually don't translate into real galaxy equivalents, but will be immediately resolved, so:
Combine Strings ( "a", "b", "c") will be instantly turned into "a"+"b"+"c". So there's basically nothing which really uses this option.
Quote:
I believe the ", ..." is how it's done in C, but it didn't work here with a compiler error on that line. :( I wish I could look at the "combine multiple text" galaxy code for myself to see how it's done.
And just to clear it up for everyone reading this: Azkit's assumption is wrong. The ", ..." only means that there could be more parameters you can add, but doesn't mean that you can define multiple params at will. The writer just didn't care to write down the others.
I know this is something of a necro but since I didn't see this anywhere else. My experience with it recently seems to point to using custom script. using #PARAM(var, " stuff ") with var being the allow multiple and the " stuff " being what you want to put in between it. It works the same as #SUBFUNCS(var, "stuff") after the comma anything in the quotes gets put as an in-between of each variable which will show as exactly what you put into it.
So for me I used a string and put just a single space in between the quotes and it would return my string as whatever the inputs were with a space in between.
IE:
"#PARAM(s, ",")" (with the quotes around the param part)
With s being say an integer with allow multiple and the input values of say 1 2 3 4 5 would result in this string: "1,2,3,4,5" in the script itself after the gui stuff has been removed, note that if you didn't put the quotes around the #PARAM() the result would be 1,2,3,4,5 which would probably give you an error.
One note is you cant put quotes in between the quotes IE "#PARAM(s, ""something"") would not put a "something" in between each var not that it really matters though.
How does one utilize "Allow Multiple" option for parameters? Figured something so basic had already been asked and answered, but I can't seem to find anything via search.
Edit: In particular, my problem is writing the function itself - let's say you have the following:
What actions do you use to access each individual "A" or "D"?
Bump :)
@SiNiquity: Go
Did a quick check myself as I always wondered, but it does exactly what it says, allows multiples of the same paramater type to be added. Ever messed with combine strings multiple, or comine text multiple when working with strings/text? Remeber how it had Text+ or whatever as the paramater and you could add multiple paramater types for combining? It uses the Allow Multiple checkbox to do that, so in essance instead of having a paramater type you take and only able to take in one argument you can acutally put in multiples by using this option.
To try it out, take any fuction/action/condition etc you may have and find a parameter and check the box Allow Multiple, now goto a trigger or another function/action/condition, where ever you call that unction/action/condition you just checked the Allow Multiple on and go to that paramater. Now right click on the paramter type and click on select new paramater, you can do this as many times as you like.
Havn't really played with it myself but neat stuff. Hope that helps.
@Quickshot14: Go
Hey thanks for the help. I really should have been more specific. I get how to make a parameter allow multiple, and I understand how to pass parameters to that function (just like the arithmetic / string functions). My problem is writing the function itself - let's say you have the following:
What actions do you use to access each individual "A" or "D"?
@SiNiquity: Go
The "allow multiple" behavior has been acting wonky for me. Even with only one parameter and having "allow multiple" enabled on it, I'll receive compiler errors if there are more than 1 parameters calling the action definition. But yes, even if I can get rid of this compiler error ("Script failed to compile: Wrong number of parameters"), it's not intuitive at all how to access the various parameters.
I found s3rius reply on custom triggers in this thread: http://forums.sc2mapster.com/development/map-development/3788-where-to-write-scripts-when-using-editor/
I attempted to use the advice in that thread and make a custom function such that:
I believe the ", ..." is how it's done in C, but it didn't work here with a compiler error on that line. :( I wish I could look at the "combine multiple text" galaxy code for myself to see how it's done.
It's a couple of months later, but this still hasn't been answered.
Any help?
@YiffMaster: Go
I looked into the thing a little more closely and came to the following conclusion:
Allow Multiple is actually only a "dummy" which is used for a few GUI actions (combine string/real/int/..). If you try using it yourself it blows up (= doesn't work).
I believe they added it when they had plans for function overloading, but that feature never made it in. Since there's no overloading, Allow Multiple is useless.
The few GUI actions that use this option actually don't translate into real galaxy equivalents, but will be immediately resolved, so:
Combine Strings ( "a", "b", "c") will be instantly turned into "a"+"b"+"c". So there's basically nothing which really uses this option.
And just to clear it up for everyone reading this: Azkit's assumption is wrong. The ", ..." only means that there could be more parameters you can add, but doesn't mean that you can define multiple params at will. The writer just didn't care to write down the others.
Anyway,
TLDR; That option doesn't work
I use Allow Multiple on my Unit Dies Function...
No Complier Errors for me... BTW I used it on a Unit Type
@s3rius: Go
I know this is something of a necro but since I didn't see this anywhere else. My experience with it recently seems to point to using custom script. using #PARAM(var, " stuff ") with var being the allow multiple and the " stuff " being what you want to put in between it. It works the same as #SUBFUNCS(var, "stuff") after the comma anything in the quotes gets put as an in-between of each variable which will show as exactly what you put into it.
So for me I used a string and put just a single space in between the quotes and it would return my string as whatever the inputs were with a space in between.
IE:
"#PARAM(s, ",")" (with the quotes around the param part)
With s being say an integer with allow multiple and the input values of say 1 2 3 4 5 would result in this string: "1,2,3,4,5" in the script itself after the gui stuff has been removed, note that if you didn't put the quotes around the #PARAM() the result would be 1,2,3,4,5 which would probably give you an error.
One note is you cant put quotes in between the quotes IE "#PARAM(s, ""something"") would not put a "something" in between each var not that it really matters though.