[Outdated] MBDev - 0.2 (Updated 5/12)

Users who are viewing this thread

Thorgrim

Knight at Arms
MBDev is a little utility that is designed to help speed up your mod development when doing python scripting. It is not a stand alone tool, rather it is designed to be used in conjunction with your text editor of choice.


Download - MBDev 0.2

Requires .NET framework: Download

Version 0.2

- Autocomplete should now allow autocompletion of all operations, ids, constants etc defined in the header and ID files after typing the fourth character.
- Compile should now work correctly (both compile all and compile)
Compile will attempt to compile the minimum nuber of files required for those module files which have changed.



Version 0.1.7

- Highlighted variables auto display their value / declaration in the bottom info bar. This will display the whole declaration line, including comments etc, which is quite handy for operations etc.
- Fixed some tuple hint problems.
- Can now use enter for auto completion as well as tab
- Pressing up & down while the autocomplete box is open should jump lines a bit less often.

Version 0.1.5

- Fixed a number of bugs (such as one that may have cause MBDev not to open)
- Added most header variables (except operations) to the auto complete lists
- Added a tuple "hint" box at the bottom of the screen. This displays what value you should currently be entering. (Requires auto completion to be enabled)
- Started Adding Game Menus dialog. Cant do much with it yet except view the menus you have, what they link to, and double click names to jump to that entry.

Recommended companion editor: Notepad++

Some of the features:

  • Shortcut button to run Mount & Blade
  • Shortcut button to compile your module (uses a "smart" compiler that only compiles the files that have changed)
  • Drop down menu for quick file selection
  • Tool to check for bracketing, and try-end_try errors: These tools can find and highlight the exact location of the error in many cases.
    Considering try blocks are not checked by the default python compiler, this should be quite handy.
    (Note that these tools may not work with all editors, however they should work with all officially supported ones)
    These are also automatically run on the open file at compile time.
  • Shortcut to open BRFEdit with the BRF containing a highlighted mesh name (requires BRFEdit 0.7.2)
  • Tool to jump to the declaration of a highlighted variable. Can also jump to declarations of items, menus etc within the other module files.
  • Initial test version of "Auto complete", which allows auto completion of most entities defined in the ID files (items, menus, factions etc), and some header variables . You can press tab or double click the value to perform the auto completion, or press up and down to change the selection within the list.

Officially supported text editors: Notepad++, Notepad (yes, the standard windows notepad), Notepad2, Sciboo

A few useability points:

When you loose focus on the compiler window it will be minimised.
Clicking it after it auto minimises will expand it again, or if you minimize it yourself you will need to click the little Arrow.
You can freely adjust the compiler window location, for example to place it on the right side of the screen if you prefer.
You can reset the windows location in the options menu.
The "Bind to editor" Option may cause MBDev to not stay on top if you are using a non official editor, so if you are having this problem, or prefer MBDev to be on top of everything, uncheck this option.


The Editor I recommend using with MBDev is Notepad++. This Editor is the one I use, and so will probably be the most compatible with MBDev. Notepad, Notepad2, Sciboo have all been confirmed to work too.

Notepad++ has a ton of great features, such as:

  • Tabs for having multiple files open
  • Configurable Syntax highlighting.
  • Block commenting/un-commenting.
  • Can remember what you had open, and restore it to the exact state you were in last time.
  • Has powerful find, bookmark etc tools

The basic MBDev features should work with other editors if you have something else you prefer using. However auto completion etc most probably will not. If you have an editor you really want supported let me know.

If you wish to use something like IDLE or SPE you must type the whole command into the "Default Editor" field.
For example if you wish to use IDLE, use:

"C:\Python24\pythonw.exe" "C:\Python24\Lib\idlelib\idle.pyw" -n -e

Assuming you installed to the default location.


Thanks to Janus for the hosting, and to everyone who has helped test this in its various stages (In particular Winter, Highelfwarrior and Reaper)
 
Last edited by a moderator:
This isn't working for me. It was at running fine at first, however it was not minimising with Notepad++. I "cut" the file, thinking that there was somewhere in the Notepad++ directory for me to paste it into but there wasn't. I pasted it back to the desktop where it was before and got an error message. Now whenever I run it I get told there was an error and it had to close. I've re-downloaded the file and it still isn't working.
 
Maybe it is better to make a new version of UE that works with Python files?
It would be an extremely useful tool.
I could make one myself but I'm busy with university and have no time.
 
Iberon said:
This isn't working for me. It was at running fine at first, however it was not minimising with Notepad++. I "cut" the file, thinking that there was somewhere in the Notepad++ directory for me to paste it into but there wasn't. I pasted it back to the desktop where it was before and got an error message. Now whenever I run it I get told there was an error and it had to close. I've re-downloaded the file and it still isn't working.

Might you have set one of the directories in the options wrong?

I think there is a bit of a bug with that, I'll try fix it and upload a new version tonight.

Edit: Did a quick fix and uploaded it... try download it again and hopefully it should load up ok now.  If not let me know.

Invictus said:
Maybe it is better to make a new version of UE that works with Python files?
It would be an extremely useful tool.
I could make one myself but I'm busy with university and have no time.

I have thought about this for a while, and discussed it with other people.  Really, there are not enough advantages with a UE like interface to make it worth it IMO.  For those who are used to scripting it is impossible for an interface like that to be faster to use.  The other problem is that if you parse all the module files, you need to go through and update all that code each time Armagan changes the system even slightly.  MBDev is designed to work even is Armagan makes fairly radical changes to the module system.  Of course there will still be minor things I need to update, but not nearly as much as creating whole new forms for each python file that is added or modified.

Of course a UE like interface would be great for a number of things, and there is no reason I could not add something like it for specific module files at a later date... and I do have that planned.

If there is anything in particular from the UE that you think makes life far easier than doing it in python, let me know.  The main things I have in mind to start with are dialogs, items and possibly troops.
 
Thorgrim said:
Iberon said:
This isn't working for me. It was at running fine at first, however it was not minimising with Notepad++. I "cut" the file, thinking that there was somewhere in the Notepad++ directory for me to paste it into but there wasn't. I pasted it back to the desktop where it was before and got an error message. Now whenever I run it I get told there was an error and it had to close. I've re-downloaded the file and it still isn't working.

Might you have set one of the directories in the options wrong?

I think there is a bit of a bug with that, I'll try fix it and upload a new version tonight.

Edit: Did a quick fix and uploaded it... try download it again and hopefully it should load up ok now.  If not let me know.

I've downloaded it again and it is still not working, with the same error. As it was working origionally I think that it's my computer, I am just going to try re-installing Notepad++ and any else related.

From what I could see before it stopped working, it looked like a good, helpful tool. Same with the Map Editor and BRFEdit.
 
@Thorgrim

Exactly! Items, troops and dialogs, maybe party templates and props...
all the things where check boxes and drop-down lists could be used :smile:
The hardest work for me is editing units and weapon stats as it takes 3/4 time. I do not enjoy it absolutely.
Also item preview would VERY VERY...VERY GREAT feature.

Honestly, I've never used UE so I can't really say what I like there  :oops:
But I always prefer GUI rather than typing most of the things myself.
 
Not sure if anyone uses this, but I updated it.

Added a few features and am hosting it on my own site while the repository is down.

Let me know if you find any bugs or have any suggestions.


Iberon said:
I've downloaded it again and it is still not working, with the same error. As it was working origionally I think that it's my computer, I am just going to try re-installing Notepad++ and any else related.

I think this should be fixed now.
 
:shock: I love you. I just got it working, and downloaded Notepad++, and... wow.

EDIT: Quick question: does the program automatically recognise what module to compile to?
 
Yes.  It uses the last modified dates, so it will compile all files that have been modified since the text files were created.  This means it should work with all editors.

But of course Notepad++ is the best... since it can hook into the text window and read exactly where your cursor is for auto-complete etc :smile:

Edit: Oops, think I missread that.  It uses module_info.py like usual, so as long as you have the module path set right in Options, it will just read that, and it should be fine.
 
it was on the one I messed with but that was pre-release, I don't know if Thorigrim changed it to use paths or not, I haven't had a chance to download it yet, cause I've been away playing Army for the last couple of weeks.
 
Iberon said:
It's finally working (:grin:) however I get an error message if the file is not in the same folder as the python files, is this intended?

Ahh, you are opening the python files with MBDev?

Your right, it seems MBDev crashes if you try and open anything else, however I had more designed it so that you just open the MBDev exe, then select the module files from the dropdown list, or open other files normally (ie have notepad ++ as the default for opening py files).

I'll try and sort it out in future versions, because the other problem is that each time you open a file using MBDev, it starts a new instance of it, which causes a bit of a problem.  So for now, best stick with just opening the exe.

Glad its working though :smile:
 
I Had been using the "edit with idle" for all my python editing which was unpleasant in itself (can't scroll left to right) so notepad++ was an improvement just trying that out...but now with this if it does even half of what you say it does I will be one happy modder! A big thanks for myself and modders in general for your amazing contributions :grin:

Humbly
Ahadhran

Edit: tried it and I have to say very nice, the auto completion is nice. now I can make up complicated names without having to stress about typing them over and over :lol: Anyway another big thanks.
 
Very nice, work, Thor. Once again, you do not cease to amaze and astound! :smile: This may actually get me off using IDLE as my editor.

Two things:

1) I noticed while editing module_dialogs that it has the order of tuple items wrong, showing speaker, initial dialog state, text, condition block, end dialog state, consequences block. Text and condition block should be switched.

2) How do I turn on auto complete?
 
Fujiwara said:
1) I noticed while editing module_dialogs that it has the order of tuple items wrong, showing speaker, initial dialog state, text, condition block, end dialog state, consequences block. Text and condition block should be switched.

Hmm, it automatically parses the comment at the top, so if its displaying the wrong order at the bottom, your comment must be wrong (it seems to be in the right order for me)

Highlander said:
Fujiwara said:
2) How do I turn on auto complete?
double click on the bottom with the content you want to have

You can also press tab (or enter in the new version).  It should pop up with the list by default... if it is not check your options.


BTW: Just uploaded 0.1.6.  Haven't added much, but let me know if anything is broken  :wink:
 
Fujiwara said:
Very nice, work, Thor. Once again, you do not cease to amaze and astound! :smile: This may actually get me off using IDLE as my editor.

Two things:

1) I noticed while editing module_dialogs that it has the order of tuple items wrong, showing speaker, initial dialog state, text, condition block, end dialog state, consequences block. Text and condition block should be switched.

2) How do I turn on auto complete?

the tuples were switched around for me too in the way expressed above...such that once I have completed a line of dialogue, if I put the curser in the text block the little bar at the bottom says condition block and vice versa. Let me know if you would like to see a screenshot.
 
Back
Top Bottom