Let's say I have a function/action that has 2 parameters. I use that function in many, many places in my map. After some time, I realize I need a 3rd parameter, so I add it. Now in all those places I used that function, there's an empty 3rd parameter that will cause errors
Is there any way I can set that 3rd parameter to it's default value without going through all the code and doing it manually?
The only way I could think of ATM (but that's not GUI though...) is saving the galaxy file that pops out when you try to save in a text document and replace all occurences of ", )" which are your unset parameters, by the value you want to have (you can get the functions default value's galaxy code by pressing ctrl+D in the trigger editor if it's a function/preset/variable. Oh and don't forget the gf_/gv_ prefix for functions and variables which are not displayed in the trigger editor ).
You then save the map as SC2Components and open the galaxy file you find inside. Replace the conent by the code with the replacements, save it and reload the saved folder in the editor.
I never though about doing it like that... It's simple and effective, and I can replace any old function with the new one if I need to use a non-default 3rd param. I'll do it your way.
I was thinking about using the find/replace option somehow, or even wild stuff like editing the trigger xml file :S
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Let's say I have a function/action that has 2 parameters. I use that function in many, many places in my map. After some time, I realize I need a 3rd parameter, so I add it. Now in all those places I used that function, there's an empty 3rd parameter that will cause errors
Is there any way I can set that 3rd parameter to it's default value without going through all the code and doing it manually?
The only way I could think of ATM (but that's not GUI though...) is saving the galaxy file that pops out when you try to save in a text document and replace all occurences of ", )" which are your unset parameters, by the value you want to have (you can get the functions default value's galaxy code by pressing ctrl+D in the trigger editor if it's a function/preset/variable. Oh and don't forget the gf_/gv_ prefix for functions and variables which are not displayed in the trigger editor ).
You then save the map as SC2Components and open the galaxy file you find inside. Replace the conent by the code with the replacements, save it and reload the saved folder in the editor.
SImpler way would be making your current function with 2 args a wrapper of your new function with 3 args.
Itwould look like
void MyOldFunction(int par1, int par2){ MyNewFunction(par1, par2,[default value for par3 here]) }
Go play Antioch Chronicles Remastered!
Also, coming soon, Antioch Episode 3: Thoughts in Chaos!
Dont like mapster's ugly white? Try Mapster's Classic Skin!
it shouldn't break existing functions, i added parameters like that many time and all i had to do is to re-click them in each trigger.
Thanks for all the replies.
@Alevice: Go
I never though about doing it like that... It's simple and effective, and I can replace any old function with the new one if I need to use a non-default 3rd param. I'll do it your way.
I was thinking about using the find/replace option somehow, or even wild stuff like editing the trigger xml file :S