TEP lets you write triggers as text in Lua syntax. The result is the same as clicking conditions and actions one at a time in the classic editor, but because it is text you can search it, replace in it and copy it. Once there are hundreds of triggers that difference is everything.
| 세미콜론 | Required inside a trigger; optional outside one. |
|---|---|
| 플레이어 | P1 or 0 - P2 is 1 and P12 is 11. |
| 유닛 | The original name, your renamed one, or the number. A Marine is "Terran Marine" or 0. |
| 주석 | Everything after -- is a comment. |
You can use variables, and this is the important part of the lesson: a TEP variable is effectively a constant.
a = 3;
Trigger {
players = {P1},
conditions = { Always(); },
actions = {
CreateUnit(a, "Terran Marine", "Location 1", CurrentPlayer);
},
}The trigger does not run according to what is in a; the trigger is WRITTEN according to what is in a. Computing during a game, or putting a value produced during a game into a variable, is not something TEP can do - and the moment you need that is the moment you move to EUD.
That is what makes loops useful: instead of writing the same trigger eight times for eight players, a for loop emits eight of them from one piece of text.
Everything you wrote in Lua - comments, loops, variables - disappears the moment you touch the triggers with the classic editor. What remains is the expanded result. If you have chosen to work in TEP, do not open the classic editor.
Custom functions go in .lua files inside ScmDraft's lua folder. F5 compiles, and when it reports an error the line number is not always exact - look around it.
