How would one go about creating a custom "Pick Each" action definition?
Pick each Integer/Player is useful, but can't be nested and sometimes a function like "For each X in VarArray from Y to Z" is run multiple times throughout a script, and would be easier to simply list as "Pick each _ and Do:"
So,presuming someone is familiar with creating sub-functions and action definitions, how would they go about creating a custom "Pick each" loop? I'm assuming this would require a little galaxy scripting?
I suppose you could create an action definition that uses the "For Each X in VarArray from Y to Z" and has a local variable as X. Then you could put the remaining actions within that action definition. I don't think that would be any easier than just using the For Each function like you normally would, but it might make your triggers look a bit cleaner.
Basically, you can't nest the same Pick Each function because the two iterations would be referencing one element (which would be Picked Integer or Picked Unit.) You might be able to create a duplicate function in script, like Pick Each Unit 2 or something. But that gets into territory of which I am unfamiliar.
I suppose you could create an action definition that uses the "For Each X in VarArray from Y to Z" and has a local variable as X. Then you could put the remaining actions within that action definition. I don't think that would be any easier than just using the For Each function like you normally would, but it might make your triggers look a bit cleaner.
Basically, you can't nest the same Pick Each function because the two iterations would be referencing one element (which would be Picked Integer or Picked Unit.) You might be able to create a duplicate function in script, like Pick Each Unit 2 or something. But that gets into territory of which I am unfamiliar.
Right, Pick Each elements utilize a local variable which is why they cant be nested, however if I could have a custom pick each with a custom local variable, I could eliminate a lot of headache and repetition in the code, make it even cleaner, and make it more flexible (Say at some point the array im looping through changes from size 3 to 6, I'd only have to change it in one spot instead of 100.
"Pick each _ and Do:" - pick what?and where? i have hard time following your logic on what you try to achieve.
"For each var..." does what you try to achieve, unless you use custom collection.
link you use macros like #PARAM #AUTOVAR and that's about it.
PickedTeamOptions:Function,CustomScriptReturnType:IntegerParametersGrammarText:PickedintegerHintText:Returnsthepickedteam.Thisfunctionisonlyforusewiththe"Pick Each Team"action.Itwilldonothingwhenusedoutsideofapickeachteamloop.CustomScriptCodereturn#AUTOVAR(pickedTeam)
Edit2: Looks like your using galaxy or something. I don't understand some of that stuff. Sorry can't help. Shouldn't you post this within the galaxy forum or something?
the entire thing as i said is mostly GUI only macro for code behind. When you type #AUTOVAR think there will be one of those AE24252b_ae variables. When you type #PARAM think there will be your parameter instead of this.
Again. if you would explain concretely what's your issue and what solution you seek we would most likely help right away.
the entire thing as i said is mostly GUI only macro for code behind. When you type #AUTOVAR think there will be one of those AE24252b_ae variables. When you type #PARAM think there will be your parameter instead of this.
Again. if you would explain concretely what's your issue and what solution you seek we would most likely help right away.
I'm trying to create a Pick Each Interger loop with custom variables so they can be nested and read easier. They loop through an array of values. What I'm trying to accomplish is this:
For each variable a from 0 to 100 do
Actions
For each variable b from 0 to 30 do
Actions
For each variable from c from 0 to 77 do:
But it is already most simple as it can be. Anyway if your know what your doing you should know its like 100*30*70*whatever so it may error unless you add wait 0.0
if it's not what you mean, and i actually guess it's not. then at least you can see how it works. Forget about "Picked whatever". Only way you can imitate Picked is removing var A,B,C,D. in custom script replacing them with global variables and from action call referring to those globals.
@Nerfpl: Go
Thanks for the help, but thats not what I'm looking for.
I'll keep looking into it. Where there's a will, there's a way.
I dont believe I need to set a gv, because the pick each functions set a local variable inside the calling script. I just have to find out how I can do the same.
Actually... You could just define the actions for each player directly in the action definition using a Integer Parameter Named Player ID.
Also how you are doing this is kinda bad... Using loops inside loops inside loops is going to cause your map to crash. Try to use action definitions to filter the data. Look up my tutorial at the bottom of my post. It covers some of that. I hope this helps. If you ever need more help feel free to contact me through PM, by posting here on the forums or on skype: Mab.youyoux.
Also be sure to check out the Sc2mapster IRC channel for live help. Its not always lively but you can find help there.
lol. Well, the example I gave isnt exactly what I was trying to do. The emphasis is on retrieving the current alliteration of a loop for use in the #SUBFUNC(actions), a.k.a "Picked _". I'm not actually nesting actions like that as you're right, it probably would crash a map. I'll try the chat. Might have better luck explaining there.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How would one go about creating a custom "Pick Each" action definition? Pick each Integer/Player is useful, but can't be nested and sometimes a function like "For each X in VarArray from Y to Z" is run multiple times throughout a script, and would be easier to simply list as "Pick each _ and Do:"
So,presuming someone is familiar with creating sub-functions and action definitions, how would they go about creating a custom "Pick each" loop? I'm assuming this would require a little galaxy scripting?
I suppose you could create an action definition that uses the "For Each X in VarArray from Y to Z" and has a local variable as X. Then you could put the remaining actions within that action definition. I don't think that would be any easier than just using the For Each function like you normally would, but it might make your triggers look a bit cleaner.
Basically, you can't nest the same Pick Each function because the two iterations would be referencing one element (which would be Picked Integer or Picked Unit.) You might be able to create a duplicate function in script, like Pick Each Unit 2 or something. But that gets into territory of which I am unfamiliar.
Right, Pick Each elements utilize a local variable which is why they cant be nested, however if I could have a custom pick each with a custom local variable, I could eliminate a lot of headache and repetition in the code, make it even cleaner, and make it more flexible (Say at some point the array im looping through changes from size 3 to 6, I'd only have to change it in one spot instead of 100.
"Pick each _ and Do:" - pick what?and where? i have hard time following your logic on what you try to achieve. "For each var..." does what you try to achieve, unless you use custom collection.
link
you use macros like #PARAM #AUTOVAR and that's about it.
Well, heres what I have so far. Hopefully this explains better.
Edit: Reviewing above post. forget this for now.
Edit2: Looks like your using galaxy or something. I don't understand some of that stuff. Sorry can't help. Shouldn't you post this within the galaxy forum or something?
@zandose: Go
Alright, I'll try there.
it's perfectly explained in link
the entire thing as i said is mostly GUI only macro for code behind. When you type #AUTOVAR think there will be one of those AE24252b_ae variables. When you type #PARAM think there will be your parameter instead of this.
Again. if you would explain concretely what's your issue and what solution you seek we would most likely help right away.
I'm trying to create a Pick Each Interger loop with custom variables so they can be nested and read easier. They loop through an array of values. What I'm trying to accomplish is this:
The problem is it currently looks like this
But it is already most simple as it can be. Anyway if your know what your doing you should know its like 100*30*70*whatever so it may error unless you add wait 0.0
Here the custom action
copy it exactly the same.
here's the custom code inside "Custom Script Code"
if it's not what you mean, and i actually guess it's not. then at least you can see how it works. Forget about "Picked whatever". Only way you can imitate Picked is removing var A,B,C,D. in custom script replacing them with global variables and from action call referring to those globals.
@Nerfpl: Go Thanks for the help, but thats not what I'm looking for. I'll keep looking into it. Where there's a will, there's a way. I dont believe I need to set a gv, because the pick each functions set a local variable inside the calling script. I just have to find out how I can do the same.
@ckSynergy: Go
Actually... You could just define the actions for each player directly in the action definition using a Integer Parameter Named Player ID.
Also how you are doing this is kinda bad... Using loops inside loops inside loops is going to cause your map to crash. Try to use action definitions to filter the data. Look up my tutorial at the bottom of my post. It covers some of that. I hope this helps. If you ever need more help feel free to contact me through PM, by posting here on the forums or on skype: Mab.youyoux.
Also be sure to check out the Sc2mapster IRC channel for live help. Its not always lively but you can find help there.
Good luck
Example:
@DarlD: Go
lol. Well, the example I gave isnt exactly what I was trying to do. The emphasis is on retrieving the current alliteration of a loop for use in the #SUBFUNC(actions), a.k.a "Picked _". I'm not actually nesting actions like that as you're right, it probably would crash a map. I'll try the chat. Might have better luck explaining there.