I´m working on my map atm and encountered the "problem" that i now have like 250 lines of trigger code that i need duplicated and changed.
One big problem ist, the editor is lagging like ass and even changing one line takes only on the clicking and updating part about 10 seconds - selecting the right variables not included.
This clearly is a totally pain-in-the-ass work and i wonder if and how it might be possible to ease thhings up a bit.
The triggers are refering to points, so i have all points set up and wouldl ike to just copy and paste all the triggers as code and then assign these points.
Is that in any way possible?
Ofcourse i searched a bit and found out that points have their PointID thing - so i would need to know that for each point individually.
Is it possible to get that ID from any source? (like opening the map with an mpq editor or something?)
And if so, or any other way to speed things up, how do i insert the code?
Do i have to import it anyhow or could i just use that MyScript.galaxy file extracted out of the map, change it and reapply it afterwards?
Split your code up into multiple action definitions, it is what we had to do with Tofu ... cause we have a lot of data that needs to be processed at map initilzation and havine 1 super long script wouldn't cut it (cause it would lag when updating variables) so we split it up into chunks and it became a lot easier to access.
First and I don't mean to be rude, get a better computer or lower your settings (if that doesn't work go back to buy a better computer)
Second, triggering is like data. You need to link everything together and you need to know how the tools at your disposal work. (Ex.: While, For each integer loops, Records, Arrays, etc...)
Knowing your way around the editor is key to success. Practice makes perfect. If you ever want help with triggering I'd be more than happy to show you what I know. Good luck!
First of all, sorry for the wrong forum.. had several threads opened and it seems i just used the wrong one..
Splitting it up could be done, ofcourse.. but we already thought about it and thats not the way we want to go here, because it makes no sense at this point.
Thanks anyways, probably we think about this again.
First, and i also don't mean to be rude, but i am no idiot nor don't i know how to use the editor (gui based, at least) and how triggering, data editing - and even 'real' programming works.
And even if i only know the basics of several real programming languages and some advanced stuff in 1 or 2 others, i definitly know how these things work.
No, seriously.
My computer is perfectly fine and definitly not the problem here regarding the performance of the editor.
Also i don't need lessons in how to use basics or advanced triggering at all. Sorry.
All i wanted to know is, if it is possible to copy and paste bigger lines of code and change them text based to what i need them to be (like i said, points and their id´s) while the map has been made in the GUI, and if so how the best approach would look like (importing or extracting?)
Yeah, what Dogmai said, split code into multiple triggers/actions. Extra organizing never hurts + if now it takes 10 sec to update after adding 250 more lines it would freeze editor for even longer duration, do you need that? If you're worried about how it looks in GUI list just create a folder with the same name as trigger and hide sub-triggers in it.
Edit: I remember using custom script to save visible GUI space. Gonna check it out and report back soon.
Edit2: Yup, there is action for custom script. Copy-paste existing script in there, delete copy-pasted triggers and enjoy you effective space usage for map initialization:D
@PatchOne: Go
First and I don't mean to be rude, get a better computer or lower your settings (if that doesn't work go back to buy a better computer)
My computer is oc i7 930 with 12gb lowlat ram running off dual ssd and my computer lags in the trigger editor with huge single "triggers", where as if this was opened in say Notepad there would be no lag. I am not sure why it lags but it is the editor and not computers ... (my old computer couldn't even open the data editor without lag which is why when I made Tofu I started with scripting).
No, they are exactly the same but you should only ever have one Map Initialization trigger which contains nothing but Action Definitions for debugging purposes + ease of organising. This way you can create a 'modular' engine which will allow you to turn things on and off easily.
Triggers should only ever be used for "event" purposes, action definitions for everything else.
I have one Map Initialization trigger which runs other triggers which run other triggers. Basically what you said with only triggers instead of action definitions (because you can set trigger to be initially off giving them a nice transparency effect in the list).
I would agree with Dogmai on using triggers as sparingly as possible. There are functions and other things for the rest, just need the triggers to track certain events. This makes for more lag free maps.
Looks like i misunderstood some little thing back there.
I already do action definitions, for map init aswell as the "trigger" i am talking about in my copy and paste issue.
Small example, you see my map init in the attachement, aswell as that trigger.
I think that mapinit is okay like this.
Problem on that trigger at the end was, see that scroll bar? That raster condition blocks continue for 25 blocks and then again for team 2.
While we managed to change team 1´s positions manually, team 2´s is now work for the ass - and thats why i wanted to see if its scriptable.
So, about the custom script thing... I never used that before.
Do i understand it right that i can take the real code of my triggers now and use one "custom script" action, paste all in there and that will work?
Would at least definitly fix that lag issue.
I am pretty sure, you can use a better algorithm to replace your raster thingy. Some arrays, some loops, and you won't need that giant if/then/else anymore.
I cannot tell you the solution right away, because I don't know, what exactly you want to do, but I am pretty sure such a solution exists.
Well, there are 200 points on the map that need to be set if the conditions match.
In this case there are 25 of these raster conditions with 4 variable sets inside each of them - and that´s only for team 1, so icluding team 2 there would be 400 of them.
I do not find any other way, at least not right now - and my mapping partner does not either, while he actually is very skilled in programming. And i'd say if he doesnt find some... Well, i wouldn't say there isn't one, but if there is one it surely is extremely complicated.
Edit> After DeadZerglings post ... I gotta expand a bit more.
So basically you should only ever run a trigger for an event, Tofu has 16 Triggers (Not including Hotkeys) which the entire game runs off. + 1 Timer Trigger.
A Timer Trigger is basically a game loop that is always running, this will not lag down the game - because you can set how often things are ran ... instead of having a Trigger with the event (When unit changes life) to update the HealthBars (which would run 32 times a second), you have a Timer which runs the healthbar function 10 times a second ... so theoritically you just reduced your lag by 67%.
Well, there are 200 points on the map that need to be set if the conditions match.
In this case there are 25 of these raster conditions with 4 variable sets inside each of them - and that´s only for team 1, so icluding team 2 there would be 400 of them.
I do not find any other way, at least not right now - and my mapping partner does not either, while he actually is very skilled in programming. And i'd say if he doesnt find some... Well, i wouldn't say there isn't one, but if there is one it surely is extremely complicated.
Sometimes you have to do stuff by hand, and if you are looking for a quick solution (like using a loop) for unique data entry it is going to be near impossible. The single worst moment of Tofu was when I had to add like 16 heros to the game at one time, because it took me a bloody long time to update all their data in the trigger editor and I basically have set it up to be as streamlined as possible. If you really need to add all those unique points to the game then you have to do it by hand.
The other option is to use custom script, but at the same time all points are from IDs, PointFromId(1779) for example, you wouldn't be able to do use string for a loop ... so either way those point IDs need to be put somewhere, which means you are back at square one. Just bit your lip, do the work, and be happy when its finished.
If you create the points one after another, they get assigned with consecutive ids, making it possible to simply loop through all of them. Might be worth the effort to replace all of them.
You could also not use pre-placed points, just set some coordinates via trigger and create points dynamically based on those.
An algorithm might be complicated, but again, I am pretty sure given enough time and dedication, somebody can find one, for your case :)
Of course, sometimes it might be impossible, but your trigger doesn't seem to be THAT complicated. Not saying, I would find an algorithm right away, but it doesn't seem unsolveable for me.
Press Ctrl+F11 to see your galaxy script, explore how things work for a while, then find your function and copy-paste code to custom script window/trigger action. You can experiment with this on new map first to feel more comfortable.
Yeah, I get it. Don't use event for more than one trigger, try to optimize map so that a single event doesn't run 100 times per second. I was asking if there is any technical difference between running and event-less trigger (through run trigger action) and action definition (other than trigger always creates a thread).
I guess you already answered that question twice but then deadzergling confused me. Damn I sure am easily confused D:
If you create the points one after another, they get assigned with consecutive ids, making it possible to simply loop through all of them. Might be worth the effort to replace all of them.
You could also not use pre-placed points, just set some coordinates via trigger and create points dynamically based on those.
An algorithm might be complicated, but again, I am pretty sure given enough time and dedication, somebody can find one, for your case :)
Of course, sometimes it might be impossible, but your trigger doesn't seem to be THAT complicated. Not saying, I would find an algorithm right away, but it doesn't seem unsolveable for me.
this is the correct answer for dealing with your points
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
@ slow trigger changes in GUI problem
solution:
1. duplicate the function
2. Go into the duplicate. Chose a part of the code you want to edit like first 33% of the trigger, delete the rest of the code.
3. do your changes
4. delete that part of the code in the original function, place your changed code into the old function.
5. Cut out the next chunk of code, paste it in the other function and change it, cut and paste it back into the original. Repeat that until you changed all code.
6. delete the duplicate function
You said you have some experience in programming. If so you should really aim to create given solution as short and flexible as possible.
Instead of triggers use actions. Like always; unless you just set few variables. My personal concept is to use triggers like events. I add actions to them which take given event data as parameters and then they preform their task inside them. In real programming you actually never create 'another event', you just subscribe to one per rising object. In Galaxy due unknown reasons most of events will be 'Any' object related so 1 event is enough already
GUI editor blows so hard it will lag with anything which is 100line+. With no reason as there's no really any background compiling or anything. Did you tried to create library yet? :) it lags like 20x harder with 10x less code. And it's obviously 100% flaw in design/coding. Most of use probably know Visual Studio which will compile your code in background, list everything you have/can imagine, check is everything ok, keep indentation, syntax, highlighting, grouping and all this in instant.
You said you have some experience in programming. If so you should really aim to create given solution as short and flexible as possible.
Instead of triggers use actions. Like always; unless you just set few variables. My personal concept is to use triggers like events. I add actions to them which take given event data as parameters and then they preform their task inside them. In real programming you actually never create 'another event', you just subscribe to one per rising object. In Galaxy due unknown reasons most of events will be 'Any' object related so 1 event is enough already
GUI editor blows so hard it will lag with anything which is 100line+. With no reason as there's no really any background compiling or anything. Did you tried to create library yet? :) it lags like 20x harder with 10x less code. And it's obviously 100% flaw in design/coding. Most of use probably know Visual Studio which will compile your code in background, list everything you have/can imagine, check is everything ok, keep indentation, syntax, highlighting, grouping and all this in instant.
Hello.
I´m working on my map atm and encountered the "problem" that i now have like 250 lines of trigger code that i need duplicated and changed. One big problem ist, the editor is lagging like ass and even changing one line takes only on the clicking and updating part about 10 seconds - selecting the right variables not included.
This clearly is a totally pain-in-the-ass work and i wonder if and how it might be possible to ease thhings up a bit.
The triggers are refering to points, so i have all points set up and wouldl ike to just copy and paste all the triggers as code and then assign these points.
Is that in any way possible?
Ofcourse i searched a bit and found out that points have their PointID thing - so i would need to know that for each point individually. Is it possible to get that ID from any source? (like opening the map with an mpq editor or something?)
And if so, or any other way to speed things up, how do i insert the code? Do i have to import it anyhow or could i just use that MyScript.galaxy file extracted out of the map, change it and reapply it afterwards?
Wrong forum.
Split your code up into multiple action definitions, it is what we had to do with Tofu ... cause we have a lot of data that needs to be processed at map initilzation and havine 1 super long script wouldn't cut it (cause it would lag when updating variables) so we split it up into chunks and it became a lot easier to access.
@PatchOne: Go
Lol.
First and I don't mean to be rude, get a better computer or lower your settings (if that doesn't work go back to buy a better computer) Second, triggering is like data. You need to link everything together and you need to know how the tools at your disposal work. (Ex.: While, For each integer loops, Records, Arrays, etc...)
Knowing your way around the editor is key to success. Practice makes perfect. If you ever want help with triggering I'd be more than happy to show you what I know. Good luck!
Hah..
First of all, sorry for the wrong forum.. had several threads opened and it seems i just used the wrong one..
Splitting it up could be done, ofcourse.. but we already thought about it and thats not the way we want to go here, because it makes no sense at this point.
Thanks anyways, probably we think about this again.
@DarlD: Go
Seriously? I lol´d aswell.
First, and i also don't mean to be rude, but i am no idiot nor don't i know how to use the editor (gui based, at least) and how triggering, data editing - and even 'real' programming works.
And even if i only know the basics of several real programming languages and some advanced stuff in 1 or 2 others, i definitly know how these things work.
No, seriously.
My computer is perfectly fine and definitly not the problem here regarding the performance of the editor.
Also i don't need lessons in how to use basics or advanced triggering at all. Sorry.
All i wanted to know is, if it is possible to copy and paste bigger lines of code and change them text based to what i need them to be (like i said, points and their id´s) while the map has been made in the GUI, and if so how the best approach would look like (importing or extracting?)
Nothing else. But thanks anyways.
@PatchOne: Go
Yeah, what Dogmai said, split code into multiple triggers/actions. Extra organizing never hurts + if now it takes 10 sec to update after adding 250 more lines it would freeze editor for even longer duration, do you need that? If you're worried about how it looks in GUI list just create a folder with the same name as trigger and hide sub-triggers in it.
Edit: I remember using custom script to save visible GUI space. Gonna check it out and report back soon. Edit2: Yup, there is action for custom script. Copy-paste existing script in there, delete copy-pasted triggers and enjoy you effective space usage for map initialization:D
@DogmaiSEA: Go
Is there really any difference in using triggers or action definitions for these one time initialization actions?
My computer is oc i7 930 with 12gb lowlat ram running off dual ssd and my computer lags in the trigger editor with huge single "triggers", where as if this was opened in say Notepad there would be no lag. I am not sure why it lags but it is the editor and not computers ... (my old computer couldn't even open the data editor without lag which is why when I made Tofu I started with scripting).
@DuckyTheDuck: Go
No, they are exactly the same but you should only ever have one Map Initialization trigger which contains nothing but Action Definitions for debugging purposes + ease of organising. This way you can create a 'modular' engine which will allow you to turn things on and off easily.
Triggers should only ever be used for "event" purposes, action definitions for everything else.
@DogmaiSEA: Go
I have one Map Initialization trigger which runs other triggers which run other triggers. Basically what you said with only triggers instead of action definitions (because you can set trigger to be initially off giving them a nice transparency effect in the list).
This is purely for benefits of organizing and having a clear and pretty GUI list, right?
(Sorry for offtopic PatchOne:D)
@PatchOne: Go
I would agree with Dogmai on using triggers as sparingly as possible. There are functions and other things for the rest, just need the triggers to track certain events. This makes for more lag free maps.
@DuckyTheDuck: Go
No ducky it isn't, is more about optimization.
Looks like i misunderstood some little thing back there.
I already do action definitions, for map init aswell as the "trigger" i am talking about in my copy and paste issue.
Small example, you see my map init in the attachement, aswell as that trigger.
I think that mapinit is okay like this.
Problem on that trigger at the end was, see that scroll bar? That raster condition blocks continue for 25 blocks and then again for team 2.
While we managed to change team 1´s positions manually, team 2´s is now work for the ass - and thats why i wanted to see if its scriptable.
@DuckyTheDuck: Go
So, about the custom script thing... I never used that before.
Do i understand it right that i can take the real code of my triggers now and use one "custom script" action, paste all in there and that will work?
Would at least definitly fix that lag issue.
I am pretty sure, you can use a better algorithm to replace your raster thingy. Some arrays, some loops, and you won't need that giant if/then/else anymore.
I cannot tell you the solution right away, because I don't know, what exactly you want to do, but I am pretty sure such a solution exists.
Well, there are 200 points on the map that need to be set if the conditions match.
In this case there are 25 of these raster conditions with 4 variable sets inside each of them - and that´s only for team 1, so icluding team 2 there would be 400 of them.
I do not find any other way, at least not right now - and my mapping partner does not either, while he actually is very skilled in programming. And i'd say if he doesnt find some... Well, i wouldn't say there isn't one, but if there is one it surely is extremely complicated.
@DuckyTheDuck: Go
Yeah and no ...
Edit> After DeadZerglings post ... I gotta expand a bit more.
So basically you should only ever run a trigger for an event, Tofu has 16 Triggers (Not including Hotkeys) which the entire game runs off. + 1 Timer Trigger.
A Timer Trigger is basically a game loop that is always running, this will not lag down the game - because you can set how often things are ran ... instead of having a Trigger with the event (When unit changes life) to update the HealthBars (which would run 32 times a second), you have a Timer which runs the healthbar function 10 times a second ... so theoritically you just reduced your lag by 67%.
Just as an example ...
Sometimes you have to do stuff by hand, and if you are looking for a quick solution (like using a loop) for unique data entry it is going to be near impossible. The single worst moment of Tofu was when I had to add like 16 heros to the game at one time, because it took me a bloody long time to update all their data in the trigger editor and I basically have set it up to be as streamlined as possible. If you really need to add all those unique points to the game then you have to do it by hand.
The other option is to use custom script, but at the same time all points are from IDs, PointFromId(1779) for example, you wouldn't be able to do use string for a loop ... so either way those point IDs need to be put somewhere, which means you are back at square one. Just bit your lip, do the work, and be happy when its finished.
If you create the points one after another, they get assigned with consecutive ids, making it possible to simply loop through all of them. Might be worth the effort to replace all of them.
You could also not use pre-placed points, just set some coordinates via trigger and create points dynamically based on those.
An algorithm might be complicated, but again, I am pretty sure given enough time and dedication, somebody can find one, for your case :)
Of course, sometimes it might be impossible, but your trigger doesn't seem to be THAT complicated. Not saying, I would find an algorithm right away, but it doesn't seem unsolveable for me.
@PatchOne: Go
Press Ctrl+F11 to see your galaxy script, explore how things work for a while, then find your function and copy-paste code to custom script window/trigger action. You can experiment with this on new map first to feel more comfortable.
@DogmaiSEA: Go
Yeah, I get it. Don't use event for more than one trigger, try to optimize map so that a single event doesn't run 100 times per second. I was asking if there is any technical difference between running and event-less trigger (through run trigger action) and action definition (other than trigger always creates a thread). I guess you already answered that question twice but then deadzergling confused me. Damn I sure am easily confused D:
this is the correct answer for dealing with your points
@ slow trigger changes in GUI problem
solution:
1. duplicate the function
2. Go into the duplicate. Chose a part of the code you want to edit like first 33% of the trigger, delete the rest of the code.
3. do your changes
4. delete that part of the code in the original function, place your changed code into the old function.
5. Cut out the next chunk of code, paste it in the other function and change it, cut and paste it back into the original. Repeat that until you changed all code.
6. delete the duplicate function
I know how it is to use long functions. :)
3 days old but i have to add something :)
@PatchOne: Go
You said you have some experience in programming. If so you should really aim to create given solution as short and flexible as possible.
Keeping your code clean and organised