Staredit Network > Forums > SC1 Mapping Tools > Topic: YATAPI - Python friendly API for trigger generation
YATAPI - Python friendly API for trigger generation
Feb 28 2019, 12:45 am
By: sethmachine  

Feb 28 2019, 12:45 am sethmachine Post #1



Hi everyone,

I have created a Python API to generate TrigEdit style triggers that can be copy and pasted into SCMDraft called YATAPI (Yet Another Trigger API).

Please see the GitHub repo for full information: https://github.com/sethmachine/yatapi

Yet Another Trigger API (YATAPI) is a Python based generator of SCMDraft TrigEdit triggers featuring type annotations, autocompletion (with a Python IDE) one-to-one correspondence with TrigEdit triggers, and object oriented programming design. YATAPI is designed to work with PyCharm, a modern Python IDE, and requires only basic Python scripting knowledge and how Starcraft Triggers work. YATAPI is minimalist and extensible, and can be used as the base for more advanced triggering. Since YATAPI is a whitebox--it has a one-to-one correspondence with Starcraft Triggers, there is no need to learn a new specialized triggering language or framework.

I am aware there are numerous other tools and frameworks that accomplish this and more. However, none of them were able to meet my development needs. In particular being easily usable in a modern IDE like PyCharm and easy to understand. It also appears many of the macro triggers projects aren't active anymore. I have a table in the GitHub repo README.md comparing YATAPI to other tools according to the dimensions I needed for my projects.

Note YATAPI does not add new triggers or features, just an OOP interface to easily and verifiably generate triggers in large numbers. YATAPI does not add new syntactic sugar or useful features like death counter management. I believe these could be developed in another Python based project that builds upon YATAPI (as a dependency).

YATAPI is not complete and most obviously is missing some Actions and Conditions. I encourage anyone to contribute to this open source project who is interested!



None.

Apr 13 2019, 5:12 am Tassaar930 Post #2



This looks pretty great but I noticed that in your documentation in comparing the various trigger preprocessors out there that you didn't seem to have included TrigEdit++. Ironically, I also only stumbled across your project because I was looking for the open source listing for TrigEdit++, which also happens to be sourced on GitHub.

Given that TrigEdit++ is a full-native solution (you can just open up the editor in SCMDraft, CTRL+A, CTRL+V, CTRL+S, and then close the window and your triggers are automatically saved), it already has strong advantages that YATAPI cannot have (unless you include an option to compile directly to map or something like that). Still, this looks like it is probably a very good solution for those who like Python (over Lua, which is what TrigEdit++'s parser is written for).



None.

May 11 2019, 4:51 pm sethmachine Post #3



Quote from Tassaar930
This looks pretty great but I noticed that in your documentation in comparing the various trigger preprocessors out there that you didn't seem to have included TrigEdit++. Ironically, I also only stumbled across your project because I was looking for the open source listing for TrigEdit++, which also happens to be sourced on GitHub.

Given that TrigEdit++ is a full-native solution (you can just open up the editor in SCMDraft, CTRL+A, CTRL+V, CTRL+S, and then close the window and your triggers are automatically saved), it already has strong advantages that YATAPI cannot have (unless you include an option to compile directly to map or something like that). Still, this looks like it is probably a very good solution for those who like Python (over Lua, which is what TrigEdit++'s parser is written for).

I can't seem to find TrigEdit++ on GitHub, would you mind sharing a link? :D

YATAPI targets a workflow that excludes using the GUI editor, i.e. all triggers/logic are maintained and written separate of the actual map. I agree that it's a disadvantage that you still have to copy+paste the output of YATAPI into SCMDraft. I am working on a separate project called chkjson to address this, which will create a Python API to directly compile triggers into a map without ever having to open it in a GUI like SCMDraft (no more copy+paste!).

It is a distinct advantage that YATAPI is in Python, as this allows for using any modern IDE like PyCharm, Notepad++, etc. with all features like autocompletion, syntax highlighting, etc. for free. It sounds like TrigEdit++ is restricted to the SCMDraft GUI, and can't be used in a typical programming IDE? I think it's a disadvantage to have to open up an editor with SCMDraft and YATAPI shares this because it still relies on SCMDraft TrigEdit format (which will be removed once I have a true trigger parser and compiler in the chkjson project).



None.

May 20 2019, 8:16 am Arta(M) Post #4

Armoha

WOW 57.6MB gif in GitHub repo...

Quote from sethmachine
I can't seem to find TrigEdit++ on GitHub, would you mind sharing a link? :D

TrigEditPlus GitHub repo: https://github.com/phu54321/TrigEditPlus
Post in StarEdit.net : http://www.staredit.net/topic/17036/



maintainer of euddraft and eudplib.
Armo#6637 at Discord :teehee:

Jul 17 2020, 9:31 am Saox Post #5



Trigedit saves do not work for me in SCMDraft. I am unable to save and have them reflected. Any ideas ?



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: Roy, jun3hong