Staredit Network > Forums > SC1 Mapping Tools > Topic: Python tool to parse SCMDraft triggers into objects/OOP represen
Python tool to parse SCMDraft triggers into objects/OOP represen
Dec 30 2018, 4:17 pm
By: sethmachine  

Dec 30 2018, 4:17 pm sethmachine Post #1


Is there an existing Python library that will take as input the raw trigger strings from SCMDraft and parse each trigger into different object representations, e.g. a Trigger should have a list of conditions, list of actions, etc. There would be a sublcass of Trigger_Action for each action, like Set Deaths, which would have fields/methods to set the different parameters: "Set Deaths("Player 8", "Alan Turret", Set To, 0);", e.g. there might be a .player field, a .unit field, etc.

Nice to have would also be automatic compilation and checking of trigger format inside Python, rather than copy-pasting into SCMDraft and then getting a notification.

If I'm not being clear, I will provide a Python example showing what I mean.


Dec 30 2018, 4:25 pm Suicidal Insanity Post #2

I see you !

Wouldn't it make more sense to parse the binary triggers? Or is that too much overhead with the various required datafiles and string table / switch table / location table?

Dec 30 2018, 6:22 pm poiuy_qwert Post #3

PyMS and ProTRG developer

I don't think there is a tool that does exactly what you are looking for, but there are some other options you could look into. I put a more detailed reply of the options in your other thread:

  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:02 pm]
Suicidal Insanity -- So you can do that
[10:02 pm]
Suicidal Insanity -- But the new text trigger engine uses "Unused location (%d)" for locations which are either unused or have no name
[10:01 pm]
Suicidal Insanity -- Not sure if I disabled that
[10:01 pm]
Suicidal Insanity -- I think scmdraft autogenerates names for you if you do that on map load
[09:59 pm]
Wormer -- Where are those colors for locations which name ends with a color code? :P
[09:54 pm]
Wormer -- Yeah locations with same names are restrictive if I say want to give all locations empty names to save strings
[09:45 pm]
Suicidal Insanity -- One thing I did change - it no longer uses "Invalid Location" for all unused locations
[09:45 pm]
Suicidal Insanity -- And locations
[09:45 pm]
Suicidal Insanity -- You can also give multiple units the same custom name
[09:40 pm]
Wormer -- a thing that can break triggers on recompile
Please log in to shout.

Members Online: O)FaRTy1billion[MM], Roy, CecilSunkure