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: 10 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: 4 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.
[11:39 pm]
Corbo -- I wouldn't go to say it's unbelieveable but silly it definitely is
[11:39 pm]
Corbo -- but yes, the plot is silly
[11:38 pm]
Corbo -- don't hate
[11:38 pm]
Corbo -- Salazar was great
[11:25 pm]
KrayZee -- The President of the United States only sending only 1 man equipped with a pistol to rescue his daughter? Then Leon has to deal with midget Napoleon, how can you take that seriously? :P
[11:23 pm]
KrayZee -- The plot in Resident Evil 4? It's just too silly.
[11:07 pm]
Corbo -- You don't find that believeable?
[07:38 pm]
Wing Zero -- I played 6 for a bit but wasn't too happy with it. Haven't played another one since then though.
[2019-12-14. : 8:18 am]
KrayZee -- If Resident Evil 4 is getting a remake, they better make the plot believable. Like actually send an entire team to rescue the President's daughter but the team was ambushed and all equipment were lost. Leon is the only survivor and only kept a handgun. Later he would hitchhike and get picked up. He then asked to be dropped off the nearest town.
[2019-12-14. : 4:01 am]
RIVE -- The significance is lessened by the probability of future RE titles ignoring either conclusion in favor of a rewrite anyway.
Please log in to shout.


Members Online: Roy, jjf28, UEDCommander, Cushingberryaq20, CaptainWill