'for each x' function (we are in triggers section ;) )
i'm interested in "how/where" not how it should work because that's easy part. For example 'for each string "asd" in MyString' and i mean GUI implementation
I'm guessing he can't get the "Actions" part to show up beneath it as it does with all other loops. Only recommendation I have is to look at the Galaxy code for the default loops and see if there's anything in there that would make an action definition work that way. I'll ask Küken whether he knows anything about this once I see him on skype.
- You have to create a new action and select the options "loop" and "subfunctions".
- Add a "g" parameter to your action of type "xgroup". "xgroup" can be a group of players, a group of units, whatever group of things you want.
- Add a "var" parameter to your action of type "x". For a group of players this would be the player id, for a group of units this would be the picked unit.
- Add a new subfunction of type actions.
- Then, under the custom script code field, write the following code:
Note that you have to replace the xGroupx function calls inside this code to whatever function you need. This would be a playerGroupPlayer function call if you were using a player group, or a unitGroupUnit function call for an unit group.
So, as an example, if you want to create a ForEachPlayerInGroup loop, you will have the following action declaration:
ForEachPlayerInGroupOpciones:Acción,Subfunciones,BucleTipoderetorno:voidParámetrosvar<Cualquiervariable-int>group=(PlayerGroupAll())<playergroup>Textogramatical:Paracada~var|jugador~jugadoren~group~hacer(acciones)Pista:Ejecutaunbucleutilizandounvalorentero.Estoejecutaráelconjuntodeaccionesincluidobajolaacción"Para cada jugador en un grupo"paracadajugadorenelgrupojugadorespecificado.Por...CódigodescriptpersonalizadoTiposdesubfunciónactions
And the following code under the custom script code field:
As a side note, these kind of actions are very useful. I use them to embed custom galaxy code inside my triggers, and to declare array sizes based on constant variables.
@TheAlmaity: Go
exactly, i mean the have part with having it as workable GUI part with actions section. In galaxy they are while's but that's the mentioned easy part :p
@IliIilI: Go
Wow thanks :) That's... i would never figure this out. So it seems those are snippets and not an actual functions
Hi
As topic says, how?
'for each x' function (we are in triggers section ;) )
i'm interested in "how/where" not how it should work because that's easy part.
For example 'for each string "asd" in MyString' and i mean GUI implementation
you type 'for each' in triggers search bar and there's entire list.
Iterate through the collection (and i don't mean array)
Main issue is how to build it, like what's the template because in "Bult-in" lib 'for each' are blank so you can't really see the body
I'm guessing he can't get the "Actions" part to show up beneath it as it does with all other loops. Only recommendation I have is to look at the Galaxy code for the default loops and see if there's anything in there that would make an action definition work that way. I'll ask Küken whether he knows anything about this once I see him on skype.
- You have to create a new action and select the options "loop" and "subfunctions".
- Add a "g" parameter to your action of type "xgroup". "xgroup" can be a group of players, a group of units, whatever group of things you want.
- Add a "var" parameter to your action of type "x". For a group of players this would be the player id, for a group of units this would be the picked unit.
- Add a new subfunction of type actions.
- Then, under the custom script code field, write the following code:
Note that you have to replace the xGroupx function calls inside this code to whatever function you need. This would be a playerGroupPlayer function call if you were using a player group, or a unitGroupUnit function call for an unit group.
So, as an example, if you want to create a ForEachPlayerInGroup loop, you will have the following action declaration:
And the following code under the custom script code field:
--------As a side note, these kind of actions are very useful. I use them to embed custom galaxy code inside my triggers, and to declare array sizes based on constant variables.
@IliIilI: Go
That's the first time I've ever seen the # key being used in custom script. What does it do? Is it like the define statement in normal C?
Sorry bout the off topic post =/
@TheAlmaity: Go exactly, i mean the have part with having it as workable GUI part with actions section. In galaxy they are while's but that's the mentioned easy part :p
@IliIilI: Go Wow thanks :) That's... i would never figure this out. So it seems those are snippets and not an actual functions
@FuzzYD: GoFor me it seems like some macro
This key is only read by the the trigger editor when it translates triggers into galaxy code.
#AUTOVAR(var, type) = value;
will result into a new variable definition inside the function.
#SUBFUNCS(actions)
will add the subfunctions defined in the action trigger.
#PARAM(var)
will result into lp_var when translated to the galaxy code.
Got it. yea! :)