[Plugin] MB Warband API (Sublime Text 3 Syntax Plugin)

Users who are viewing this thread

autocompl.png





Ru-board: http://rusmnb.ru/index.php?topic=19691.0
Download: mb_warband_api_1.165_sublime3_plugin.zip

New in ver: 1.165.0

+ Support M&B module system v1.165
+ New plugin command: Command Palette ⇒ cb (MB Warband API: Clear Bytecode (*.pyc))
+ Plugin install: via Package Control unzip to Sublime folder (Readme)


Features:

+ Scripting speed +50
+ Operators auto complete
+ Auto set warband syntax when open module_system file
+ Syntax highlight
+ Highlighting of missed coma at the end of op-tuple
+ F1 help (en|ru):
+ Module system builder: (set the path to the module system folder: Preferences> Package Settings> MB Warband API> Settings - User)
- F7 - build current file​
- Ctrl+F7 - build full module system. For cleaning *.pyc-files after full_module_building (Ctrl+F7), copy del.py to module_system folder and edit build_module.bat:​
build_module.bat said:
...
...
@del *.pyc
python del.py
...
...
OR just edit build_module.bat (-B = don't create bytecode):
build_module.bat said:
...
@echo off
python -B process_init.py
python -B process_global_variables.py
python -B process_strings.py
python -B process_skills.py
...
...

Structure operator:

new_script
# "script_name"
# Description
# Input: none
# Output: none

("name",
[
|
]),

Block operators shortcuts:

tb
(try_begin),
|
(try_end),

tbe
(try_begin),
|
(else_try),
|
(try_end),

et
(else_try),
|

tfr
(try_for_range, ":unused", _begin, _end),
|
(try_end),

tfb
(try_for_range_backwards, ":unused", _begin, _end),
|
(try_end),

tfa
(try_for_agents, ":agent_no"),
|
(try_end),

tfp
(try_for_parties, ":party_no"),
|
(try_end),

Install:

plugin_install.png

1. Download, install Sublime Text 3 http://www.sublimetext.com/3
2.1. Auto download and install plugin via PacketControl: Preferences > PackageControl > PackageControl:Install Package > MB Warband API
or 2.2. manual unpack plugin to SublimeText3\Data\Packages\MB Warband API\..
3. Restart Sublime if need
4 To change the Help Language edit Preferences > Package Settings > MB Warband API > Settings - User

Plugin Activation:

* Plugin v1.158.1+ will auto activate when module file opened. Hand activation must be in case of creating new module file.

1. Open module_system file or create new one
2. Switch to MB Warband API syntax:
a) Tools > Command Pallete[Alt+~] => mb
b) or View > Syntax > MB Warband API

Keys & Commands:

[F1] - show module_system operator's help
[F7] - build current module_file
[Ctrl+F7] - build full module_system
[Alt + ~] - show Command Palette
Command Palette ⇒ cb (MB Warband API: Clear Bytecode (*.pyc)) - clear all *.pyc files in module_system folder
 
Last edited:
Ikaguia said:
I wish this was for N++, whatever, great job mate!
Before this time N++ was my favore code editor.. But when Projects consisted of more than a dozen files, and between them have to constantly switch, I switched to Sublime with his side bars, python-based plugins, multiline editing, others nice features and no regrets.

Cheers =)
 
seems to be a very nice program, that sidebar is exactly the kind of thing I miss in N++, but, where are those littles + and - to show/hide the stuff? :razz:

edit: oO found them, this is so cool, thanks for sharing it mate
 
Yes.. Sublime3 + MB API plugin is a new level of Warband Scripting =) Is [MUST HAVE] convenience and speed.

The plugin has a simple realisation based on snippets, so do not even require knowledge of Python to edit or add new staff such as new langs, snippets, syntax colors, etc:

mb_warband_api.py - F1-help functions (show F1 window, insert selected operator)
warband_api_help_en.json - EN help data base
warband_api_help_ru.json - RU help data base
val_sub.sublime-snippet - operator snippet
mb_warband_api.JSON-tmLanguage - source of syntax colors
mb_warband_api.tmLanguage - syntax colors (compiled)


For example a new structure operator new_script which unfolds to:

    # "script_name"
    # Description
    # Input: none
    # Output: none

    ("name",
    [
        |
    ]),

is snippet:
new_script.sublime-snippet said:
<snippet>
    <content>
<![CDATA[# "script_${1:name}"
# ${2:grin:escription}
# Input: ${3:none}
# Output: ${4:none}
("${1}",
[
    ${5}
]),
]]>

</content>
    <tabTrigger>
new_script</tabTrigger>
    <scope>
source.mb_warband_api</scope>
    <description>
Script STRUCTURE</description>
</snippet>
 
v1.165.0 up

+ module  system v1.165
+ plugin command to clean *.pyc
+ plugin moved to repository, so now it available for install via Package Control.
[!] If you have a previous version of plugin in SublimeText3\Data\Packages\MB Warband API - remove it manually and install new version via Package Control (see first topic).
 
Will this also work with Lav's WRECK? I am thinking of moving to Sublime (currently using notepad ++), but I am using Lav's integrated module sys (WRECK), because the compilation time is so much faster, which allows for easy testing between builds. Lav introduced a few minor modifications to the sytax. Will that be a problem?
 
DerGreif said:
Will this also work with Lav's WRECK? I am thinking of moving to Sublime (currently using notepad ++), but I am using Lav's integrated module sys (WRECK), because the compilation time is so much faster, which allows for easy testing between builds. Lav introduced a few minor modifications to the sytax. Will that be a problem?

@DerGreif: I am using WRECK for my plugins and it works fine, as it still uses WBScript and all the header_operations commands.

I expanded it to include my own extensions (WRECK feature allows us to create new 'fake' operations) quite easily thanks to Sublime and @Shcherbyna.

Say you create a new operation to do a try_range for companions filtered by only the ones in you party: (try_for_companions_in_party, <destination>). You add it to the plugin and it will work with all the cool shortcuts and colour code!

Cheers
 
kalarhan said:
@DerGreif: I am using WRECK for my plugins and it works fine, as it still uses WBScript and all the header_operations commands.

I expanded it to include my own extensions (WRECK feature allows us to create new 'fake' operations) quite easily thanks to Sublime and @Shcherbyna.

Say you create a new operation to do a try_range for companions filtered by only the ones in you party: (try_for_companions_in_party, <destination>). You add it to the plugin and it will work with all the cool shortcuts and colour code!

Cheers
Great! Thank you for the quick answer!
 
So sorry to necro, but has anyone got a copy of this lying around that they could re-upload? Can't find it anywhere on interwebs and the repository is gone :'(
 
Could you please add syntax highlighting to things like:

script_
p_
pt_
fac_
trp_
mnu_
str_
ca_
skl_
wpt_
slot_
itp_
imodbits_
snd_

": (variables)
s1/s2/s3/etc
"$ (globals)

module_mission_templates.py
mtef_scene_source
mtef_visitor_source

module_items.py
cut
weapon_length
swing_damage
blunt
pierce
ixmesh_
weight

i suck at regex so i cannot help in this XD
Thanks for the work btw.
 
Back
Top Bottom