I've written quite a long tutorial on best practices in the Starcraft 2 Trigger Editor. The purpose of this tutorial is to teach people what best practices are and give people a decent idea of how to begin implementing them in their triggers and galaxy code.
Hopefully this tutorial will help people to write cleaner, more readable, and more efficient triggers and galaxy code.
Feel free to post any suggestions and comments etc. Though if you want to post a criticism, I'd ask that you make it constructive and not just "lol you suck" =)
I've written the tutorial on google docs, because it's easier to format there than in this post.
Apart from that, very nice : = ]
Everyone should read the parts about naming conventions and using constants. Very important for clean and easy scripting!
Some things:
- You could point that loops are a good substitute to periodic timer events in most cases - and less memory intense.
- Althought Switch/Case looks cleaner in GUI, behind the curtains it's nothing more than nested If/Then/Elses. So no speed gain there, sadly :/ It doesn't really matter, but I'd say I throw it in here.
- The part about Libraries is a little short I think.
- And the part about Arrays could also cover multi-dimensional arrays.
But it's very useful, as most of these things are so fundamental that it'll give you a hard and messy time using the editor if you're new and don't know about them.
Thanks for the input s3rius, I'll actually add in multi-dimensional arrays now, I completely forgot about that. The information about switch-case isn't really necessary in this tutorial because it's more about the best ways to write your code, that's why I didn't include it =)
I'll think about adding more information to the section on libraries, and your point about loops replacing periodic timers is also something I'll think about adding, though that might be too specific and situational for this kind of tutorial, I'm not sure yet.
This isn't too bad, for warcraft 3 maybe, I dont know if people just arn't noticing or not maybe were all just to used to our old warcraft 3 ways but a lot of the old pratices with triggers are obsolte with the new editor. Action & Condition Defintions along with functions gives us huge control make the use of acutal triggers very small or much mroe limted. Think about it, using custom action defintions, functions and condition defintions and the like you can acutally have just one peroidc timer and have it call an action defintion that does all the work. Instead of calling another trigger or anything else.
I think not enough map makers, partiuclary tirggering know about just how usefull this stuff is. Advance topic somewhat, but its very uesfull. There is a few tutorials out there about these and how they work, and i'm hoping to intgrate more of how it all comes togetehr and works. I think the inclusion of this along wth what you already have would be a great idea at least at some point. So i'd thought i'd share.
I already described when and why you use custom function and action definitions in this tutorial. I'll definitely include custom event and condition definitions sometime though =)
Love the post, its very concise and well stated given the topic ; )
A point of interest or two about function and actions.
You mentioned libraries, in addition though... by going to data->manage labels (off the top of my head) you can define your own labels for your library. This can be useful as keeping your functions/events/conditions separate from the built-in blizzard ones which can make it a lot faster to find them.
And as quickshot said, custom action/functions/events/conditions are VERY powerful in SC especially given they work between your maps.
Another point on that, if you define your own labels, it in my experience its helpful to give them their own pics, and to pick a non gold (maybe blue or green?) border for the picture so that at a glance anyone looking at your triggers (yourself included) can see that the action is one you have defined rather than one that's built-in.
Also you could possibly give an example as to advantages/disadvantages of script vs triggers... e.g.
Custom script is a powerful way of doing menial tasks (such as complex maths) which can be time consuming to set up/edit in a trigger, where triggers are more suited to higher level uses such as setting up dialogs/actor events where you want quick customization without looking up a plethora of different function names/argument orders.
You mentioned libraries, in addition though... by going to data->manage labels (off the top of my head) you can define your own labels for your library. This can be useful as keeping your functions/events/conditions separate from the built-in blizzard ones which can make it a lot faster to find them.
Well hot-damn look at that! Heh not sure how I missed that, thats a very usefull thing to have indeed, thanks for the info Umbra!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I've written quite a long tutorial on best practices in the Starcraft 2 Trigger Editor. The purpose of this tutorial is to teach people what best practices are and give people a decent idea of how to begin implementing them in their triggers and galaxy code.
Hopefully this tutorial will help people to write cleaner, more readable, and more efficient triggers and galaxy code.
Feel free to post any suggestions and comments etc. Though if you want to post a criticism, I'd ask that you make it constructive and not just "lol you suck" =)
I've written the tutorial on google docs, because it's easier to format there than in this post.
Here is the tutorial link
lol you suck
Apart from that, very nice : = ]
Everyone should read the parts about naming conventions and using constants. Very important for clean and easy scripting!
Some things:
- You could point that loops are a good substitute to periodic timer events in most cases - and less memory intense.
- Althought Switch/Case looks cleaner in GUI, behind the curtains it's nothing more than nested If/Then/Elses. So no speed gain there, sadly :/ It doesn't really matter, but I'd say I throw it in here.
- The part about Libraries is a little short I think.
- And the part about Arrays could also cover multi-dimensional arrays.
But it's very useful, as most of these things are so fundamental that it'll give you a hard and messy time using the editor if you're new and don't know about them.
Thanks for the input s3rius, I'll actually add in multi-dimensional arrays now, I completely forgot about that. The information about switch-case isn't really necessary in this tutorial because it's more about the best ways to write your code, that's why I didn't include it =)
I'll think about adding more information to the section on libraries, and your point about loops replacing periodic timers is also something I'll think about adding, though that might be too specific and situational for this kind of tutorial, I'm not sure yet.
Very useful, at least with me, cause i'm really stupid in trigger :D
This isn't too bad, for warcraft 3 maybe, I dont know if people just arn't noticing or not maybe were all just to used to our old warcraft 3 ways but a lot of the old pratices with triggers are obsolte with the new editor. Action & Condition Defintions along with functions gives us huge control make the use of acutal triggers very small or much mroe limted. Think about it, using custom action defintions, functions and condition defintions and the like you can acutally have just one peroidc timer and have it call an action defintion that does all the work. Instead of calling another trigger or anything else.
I think not enough map makers, partiuclary tirggering know about just how usefull this stuff is. Advance topic somewhat, but its very uesfull. There is a few tutorials out there about these and how they work, and i'm hoping to intgrate more of how it all comes togetehr and works. I think the inclusion of this along wth what you already have would be a great idea at least at some point. So i'd thought i'd share.
I already described when and why you use custom function and action definitions in this tutorial. I'll definitely include custom event and condition definitions sometime though =)
Thanks for the feedback Quickshot.
@Pandepic: Go
Lol you suck.
No, but really, in all serious you do suck.
Na, I'm just joking haha... you really don't not suck!
Anyway, but yeah, aside from that, pretty good tutorial! Glad you finished it. lol you suck. <3
OneTwo, I thought we had something special =(
Also you have to link me to the other place to post these tutorials.
I can already feel my brain swell with all this trigger knowledge! Too bad now my ears are bleeding and im feeling light headed...
Thanks for noticing payne007, I fixed it =D
Love the post, its very concise and well stated given the topic ; )
A point of interest or two about function and actions.
You mentioned libraries, in addition though... by going to data->manage labels (off the top of my head) you can define your own labels for your library. This can be useful as keeping your functions/events/conditions separate from the built-in blizzard ones which can make it a lot faster to find them.
And as quickshot said, custom action/functions/events/conditions are VERY powerful in SC especially given they work between your maps.
Another point on that, if you define your own labels, it in my experience its helpful to give them their own pics, and to pick a non gold (maybe blue or green?) border for the picture so that at a glance anyone looking at your triggers (yourself included) can see that the action is one you have defined rather than one that's built-in.
Also you could possibly give an example as to advantages/disadvantages of script vs triggers... e.g.
Custom script is a powerful way of doing menial tasks (such as complex maths) which can be time consuming to set up/edit in a trigger, where triggers are more suited to higher level uses such as setting up dialogs/actor events where you want quick customization without looking up a plethora of different function names/argument orders.
Well hot-damn look at that! Heh not sure how I missed that, thats a very usefull thing to have indeed, thanks for the info Umbra!