I need to run the above SetVariable more than 100 times, so it would be much better with a compressed custom script.
I wonder if it is possible to replace the number in the back of the region name with an integer, like this:
Sadly, galaxy doesn't have a ForEach function like PHP, we're stuck with while loops only. All for loops built in GUI are also converted into while loops I believe.
and you really dont need a "for each" since you have to pre-create all the regions ahead of time either through the terrain editor or though code. You should know how many regions actually exist......
for i = 0 to (number of existing regions) should do everything you need.....
what do you mean by "compressed" script? Means nothing to me honestly.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
whoops.. didn't read the question properly. Are region names keyed in as strings? If yes, then it should be possible, otherwise I don't know any method to achieve what you're trying to do.
without having to type all of these SetVariable lines.
The thing is, that 01_Area01, 01_Area02, 01_Area03 and so on, are not variables, but preset regions (made in the editor, not through triggers.
I wondered, since it is not possible with GUI, if it is possible, to set the variables without having to type all of the lines, in a custom script.
This is the GUI generated script for setting a region variable. Despite all your regions having names, all of them have an ID. You can iterate this ID. The only issue is if you want your regions in a specific order, you're going to have to make sure they were created in that order.
So, I will have to remove all of my regions, and create them in the correct order? Will be time consuming, but will most likely save me some time in the end.
So, I will have to remove all of my regions, and create them in the correct order? Will be time consuming, but will most likely save me some time in the end.
I think so. Did you end up recreating your regions? I'm not sure how the editor reapplies region ID's when one is deleted and a new one is created. For example if I have 10 regions and delete them all and recreate them. Will my 10 regions still have ID's from 1-10? or would it be from 11-20?
Well as we said its not entirely true. Its ok if you have lets say 100 regions for something and that's it. but if you have more other regions for other things this will most likely fail because there's possibility of pointing at incorrect region.
As mentioned i recommend (and i will use it myself :)) to name your regions like: 001_name since beginning of creating any regions.
Hello,
I wonder if there is a way, through custom scripts, to compress the following actions into a For each Integer, or similar.
area[ ] [ ] is a region-variable with two arrays.
01_Area01, 01_Area02, 01_Area03 are regions
I need to run the above SetVariable more than 100 times, so it would be much better with a compressed custom script. I wonder if it is possible to replace the number in the back of the region name with an integer, like this:
I am not really into galaxy scripts, and as I am not able to construct a script myself, I am now asking for your help.
Sadly, galaxy doesn't have a ForEach function like PHP, we're stuck with while loops only. All for loops built in GUI are also converted into while loops I believe.
This should work.
@ScorpSCII: Go
well you dont have to use "scirpt" for this....
and you really dont need a "for each" since you have to pre-create all the regions ahead of time either through the terrain editor or though code. You should know how many regions actually exist......
for i = 0 to (number of existing regions) should do everything you need.....
what do you mean by "compressed" script? Means nothing to me honestly.
I believe he means "Can i type region name instead of editor's variable" like set regions[0][i] = "0_region"+i
Setting region from script side looks like var = RegionFromId(1)
1 is some sort of index probably based on creation order starting at 1
@Nerfpl: Go
whoops.. didn't read the question properly. Are region names keyed in as strings? If yes, then it should be possible, otherwise I don't know any method to achieve what you're trying to do.
@FuzzYD: Go
nope, from what i found they are only stored in editor and selecting them from "value" tab inputs their index.
Sorry for not being accurate enought in my question.
Basically, what I am looking for, is a way to run
without having to type all of these SetVariable lines. The thing is, that 01_Area01, 01_Area02, 01_Area03 and so on, are not variables, but preset regions (made in the editor, not through triggers. I wondered, since it is not possible with GUI, if it is possible, to set the variables without having to type all of the lines, in a custom script.
I hope my question is clear now.
@ScorpSCII: Go
This is the GUI generated script for setting a region variable. Despite all your regions having names, all of them have an ID. You can iterate this ID. The only issue is if you want your regions in a specific order, you're going to have to make sure they were created in that order.
@FuzzYD: Go
So, I will have to remove all of my regions, and create them in the correct order? Will be time consuming, but will most likely save me some time in the end.
Problem Solved
I'll post the solution in case anyone has, or gets, a similar problem.
I think so. Did you end up recreating your regions? I'm not sure how the editor reapplies region ID's when one is deleted and a new one is created. For example if I have 10 regions and delete them all and recreate them. Will my 10 regions still have ID's from 1-10? or would it be from 11-20?
Good to know you got the problem solved though
Well as we said its not entirely true. Its ok if you have lets say 100 regions for something and that's it. but if you have more other regions for other things this will most likely fail because there's possibility of pointing at incorrect region.
As mentioned i recommend (and i will use it myself :)) to name your regions like: 001_name since beginning of creating any regions.
@Nerfpl: Go
Yea that would be the best solution, and that is exactly what I am going to do. Thank you for your, and everybody else's, help.