Staredit Network > Forums > SC1 Mapping Tools > Topic: scmdraft2 sample plugin
scmdraft2 sample plugin
Aug 19 2014, 10:25 pm
By: trgk  

Aug 19 2014, 10:25 pm trgk Post #1



Modified version of SCMDraft2 sample plugin. (Original : one on Scmdraft2 beta site)
See Release\Scmdraft Plugin.sdp for sample plugin.
This plugin manipulates some string / dumps stirng table / unit names / location names.

This version of plugin works with SCMDraft2 2.0.8.0

Attachments:
SCMDraft2_Plugin.zip
Hits: 20 Size: 51.27kb

Post has been edited 6 time(s), last time on Aug 21 2014, 7:26 am by trgk.



EUD

Aug 20 2014, 3:07 am CecilSunkure Post #2



So which files should we be looking at here? Which ones did you write? Could you please post a short description about the pieces of code you did write? I don't have a login so I didn't check -did you find resources for writing this plugin (like the interface headers) at that site?

This can all be very helpful for anyone else interested in writing a plugin (like myself).



None.

Aug 20 2014, 3:29 am trgk Post #3



Almost everything is based on SI's sample plugin code.

What I did is:
- Plugin version : 1 -> 2
- Made interface for string table related functions. SI_VirtSCStringTable methods are not working anymore.

You should see RunPlugin function inside Scmdraft Plugin.cpp
Inside it, I've written a simple example for what I've found so far. Basic string manipluation, Getting unit names/location names.
It seems like that SCMDraft2 plugin system is strictly designed to support TrigEdit.
Every supported functions are used by TrigEdit, and are only suitable to create another Trigger Editor.




+
Code
        ...
        int findindex = StringTable_FindString(stb, str);
        printf("(should be the same)  %d %d\n", test_stringid, findindex);                 /// THIS
        const char* str2 = StringTable_GetString(stb, findindex);
        ...


Two number printed on there can be different if duplicate strings exists inside map.






Summay) See scmdraft plugin.cpp -> RunPlugin function.
Every string is reference-counted, and you'll have to manually dereference it if you need.

Post has been edited 2 time(s), last time on Aug 20 2014, 3:35 am by trgk.



EUD

Aug 20 2014, 3:32 am CecilSunkure Post #4



Great thanks a lot. This helps.

Yeah I always imagined the plugin system was specifically for trigedit, since nothing else was ever made. Nonetheless I'll see if I like it all and perhaps I'll make something :)



None.

Aug 20 2014, 10:14 pm CecilSunkure Post #5



Took another look and decided I don't have any time to devote to this, too many other things to finish.

However, if someone (trgk) were to write a plugin that could load triggers from a string I'd be extremely grateful! What I'd like to do is:
Press button in SCMDraft and have it run the plugin. If I had code to load triggers into SCMDraft from string, I could run LIT and read LIT's output triggers.



None.

Aug 21 2014, 12:15 am trgk Post #6



Quote from CecilSunkure
Took another look and decided I don't have any time to devote to this, too many other things to finish.

I wonder how creating plugin with scmdraft2 plugin system can be harder than building one with ChkDraft.


Quote from CecilSunkure
However, if someone (trgk) were to write a plugin that could load triggers from a string I'd be extremely grateful! What I'd like to do is:
Press button in SCMDraft and have it run the plugin. If I had code to load triggers into SCMDraft from string, I could run LIT and read LIT's output triggers.

My trigger format is different from that of scmdraft2. :)
I'll open source my trigger editor once it's completed.


+ I refactored the plugin base. See the main post

Edit08210425 : Edited pic

Attachments:
dkzuek.png
Hits: 4 Size: 24.24kb

Post has been edited 4 time(s), last time on Aug 21 2014, 7:26 am by trgk.



EUD

Aug 23 2014, 11:27 am trgk Post #7



Example trigger editor source code.
I've not yet finished this, but it's already in usable level.

This plugin decodes your trigger into lua script.
You modify lua script, and this program will compile it to triggers.


Compiled plugin : TrigEditPlus.sdp. Put this inside (SCMDraft2 folder)\Plugin\
Source code : TrigEditPlus.zip

I used Lua because I was to lazy to make another script engine. No relation with LIT.




Usage : Push TrigEdit++ button & after popup, open trigeditplus.lua at scmdraft2 directory. (It should be opened automatically, but if not.)
Modify it & save. Push compile button.

Error -> Modify again and press yes / No to not compile.

Attachments:
TrigEditPlus.sdp
Hits: 1 Size: 193kb
TrigEditPlus.zip
Hits: 5 Size: 233.26kb

Post has been edited 1 time(s), last time on Aug 23 2014, 11:32 am by trgk.



EUD

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06: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?
[2024-4-20. : 7:56 pm]
Oh_Man -- lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
Please log in to shout.


Members Online: lil-Inferno, Dem0n, C(a)HeK