Scripting Tool: mb_ext_script (A new syntax for scripting)

Users who are viewing this thread

Hey guys. Some months ago I made post about a new module system (oxidsys) but I realized at some point that this was simply too big and complicated for me with my experience and amount of time. So I settled on something smaller scale that I felt would still be nice, basically a subset of what oxidsys was supposed to do.

Essentially I've made a fairly simple Python module that acts as an extension to the modsys. It allows you to write your module scripts in separate modular files in a new but still familiar syntax.

Here's an example of the "game_get_total_wage" script translated.

Code:
assign :total_wage 0;
party_get_num_companion_stacks :num_stacks p.main_party;

try_for_range :i_stack 0 :num_stacks;
    party_stack_get_troop_id :stack_troop p.main_party :i_stack;
    party_stack_get_size :stack_size p.main_party :i_stack;
    call_script script.game_get_troop_wage :stack_troop 0;
    val_mul reg.0 :stack_size;
    val_add :total_wage reg.0;
try_end;

assign reg.0 :total_wage;
set_trigger_result reg.0;

If you want to learn more you can check out the readme on my github repository. https://github.com/AustinHaugerud/mb_ext_script

I'll upload some binaries soon since no-one probably wants to try to build the module from source themselves, but for now feedback just based on first impressions would be appreciated if you have time.

Thanks

Update: You can look at the releases here https://github.com/AustinHaugerud/mb_ext_script/releases . Make sure your Python version matches.
 
Haugerud15328 said:
I'll upload some binaries soon since no-one probably wants to try to build the module from source themselves
Well, there are plenty of mods who managed to get developed with the module system and the sources we have ^^

Something in my head is also tingeling, not sure if someone else already worked on something similar...
 
Well, there are plenty of mods who managed to get developed with the module system and the sources we have ^^

Sorry, can you clarify? I didn't mean any sort of offense. This python module is written in native code, so I just figured most people wouldn't want to go through the trouble of building the .pyd themselves.

I wouldn't be surprised is someone has done something similar to this, but I haven't seen it before.
 
I mean that a lot of people here managed to get stuff done with the Native code, a look to the released mods is enough proof. There are plenty of tutorials and OSP-codes for people who are starting to mod.
People who don't understand how the Native code works at all have most probably no understanding of how to code at all and also wouldn't use your method. A big group here only wants to make minor changes and are therefore also better of with tweaking a few lines of code in Native when pointed to the right place. The majority won't touch the code at all, no matter how tasty you prepare it for them.
This shall not discourage you! I only don't really see the use yet of what you try to enable and fear that you might in the end just waste time (or not if you use your method for your own modding projects).
 
Another proof that programmers are great at devising solutions that no one needs.  :grin:
You can't change the syntax of a programming language that's not controlled by you just because it saves you some typing. No one is going to use your alternative.
 
In the end I made the tool because I plan on using it. The purpose I had in mind when making it is written in the readme. Basically I just find writing scripts through python lists and tuples clumsy and unpleasant. This lets you write your scripts without all the annoying cruft. I'm just sharing it in case anyone else has had similar frustrations and wants to try  an alternative. I'd agree that most likely 99% of people here won't care, but I'll work on it either way for myself ¯\_(ツ)_/¯.
 
Rodrigo Ribaldo said:
Another proof that programmers are great at devising solutions that no one needs.  :grin:
You can't change the syntax of a programming language that's not controlled by you just because it saves you some typing. No one is going to use your alternative.

Actually I can, I just did.  :roll:
 
It depends on your use case. If you're just making tweaks then I wouldn't use this either, but sometimes new code is necessary. I'm not trying to force this on anybody, it's just an option. It's 100% fine if you guys feel it's not useful to you.
 
Most of the new code in any given language is copy-pasted and edited old code. It's not a use case, it's a universal rule of efficiency.

Anyway, if you really like parsing (and young programmers just love this for some reason), try adding value by staying compatible and improving the compile scripts (although this has been done with more robust error checking and faster compiling).
 
I'm sorry, but as a software engineer I have to strongly disagree with that. Copy and pasting code != good reuse. Reusing code is good, but we absolutely do not do that by copy and pasting.

Anyway, I'm curious if you've actually taken a look at how this module works before giving advice?

It outputs the exact same tuple format for scripts. It doesn't even slightly touch the compilation process, there are no compatibility breaks anywhere. Something like Lav's enhanced compiler wouldn't know the difference between a traditional script and one loaded from a .mbs script. That was very intentional on my part. You can plug it in with minimal effort and very little disruption.
 
Yeah, a lot of us here are or were software engineers and know our software engineer stuff. Iirc, 70% of new code is copy-pasted and edited for a good reason - it saves time and syntax errors, at some risk of bugs from overlooked extraneous code.
The lack of compatibility is with the language, not the output. You can't insert useful snippets from elsewhere and you can't post code for others to use, without proprietary converters, and no one is going to bother with that. This is why programming languages don't have alternative syntax versions. Or thr r no alt splng.
There's also a learning curve, and dependence on 3rd party support (i.e. you). Can you be relied to be here to fix bugs? To maintain it if a new module system changes things or people have good suggestions? I wouldn't bet on it. Even WSE failed here.
This is why no one would (or should) use it. The problem is really the typical engineering mindset, engineers like to do what they think is challenging or neat, and then try to justify its usefulness, instead of looking at real problems of real users. This thread is all the proof anyone needs.

But, kudos for trying to contribute to the community and I wish you well with further efforts.
 
Yeah, a lot of us here are or were software engineers and know our software engineer stuff. Iirc, 70% of new code is copy-pasted and edited for a good reason - it saves time and syntax errors, at some risk of bugs from overlooked extraneous code.

I am a software engineer and I can tell you that this is not true. Copy and pasting code is looked down on. You're much better off reusing code by defining it in a function, using some sort of generics, a macro, a library etc. Also the mentality that you can just "copy and paste" code is a mentality I've seen bite people before as well. They think they can just copy stuff elsewhere in the project or off of stackoverflow for everything and the moment they have to actually solve any sort of problem on their own they're totally lost. Again code reuse is good but not by means of copy and pasting.  Copy and pasting makes your code look repetitive, bloated, and anytime you copy and past some code that requires a change, you have to update each and every instance of that code, rather than at one place. Please don't advise people that they should copy and paste, it really isn't good practice.

As far "language compatibility" goes I get what you're saying, but I think you're dramatizing it a bit. The languages map to one another very one to one, it's easy to read one and know how to express it in the other both ways. This mindset also makes me chuckle a bit, because I can just imagine this scenario. "You cannot insert useful snippets from elsewhere or post code for others to use in C without proprietary compilers, and no one is going to bother with that. This is why we don't have alternative syntax to create assembler programs, and so why we will use assembler and only assembler forever." It's true you can't just copy and paste anymore, but that was not much of a loss from my perspective (if you're just copying and pasting snippets there's a good chance you don't know how your code works). We're probably just going to disagree on that one no matter what. One other small nitpick, this tool isn't proprietary, I'm intentionally making the source code publicly available for public domain.

The maintenance is a good point to bring up but that could be argued for basically anything that touches the modsys. What if Talewords slightly changed any of the formats outputted by the process_*.py files and outdated W.R.E.C.K? Not likely, but then neither is changing the data structure of script objects. I've written alternate faster compilers for select pieces of the module system. Why should I expect you to say anything different were I to share one of those? If you're really worried about this then don't use anything but the native modsys. I'm not sure why WSE is your example, because that's probably one of the hardest possible things to maintain to have ever sprung up here. It's in the same vein as SKSE over in the Skyrim community, every time a new binary comes out they have to relocate everything. Most of the tools here don't work with something nearly so volatile, including this one. In general this is not even remotely close to being as complicated as WSE.

Lastly, and again, to me there is a problem that I aim to solve with this, but it's what we'd classify more as a "non-functional issue". We already have a functional requirement met for a method to create scripts, that doesn't mean the method is ideal however. If you don't find writing M&B scripts the old-fashioned way problematic at all, awesome, that's totally cool. Please don't come in here tell me that my issue isn't real simply because we don't share it however. I'll 100% agree that this is not even close to the biggest issue or most useful tool to be posted here. I wouldn't trade something like Cartographer for 10 of these. This tool took a few hours to write and about 20 minutes to make a readme for though. It's a pretty simple module that didn't take too much effort to write and doesn't have a very big problem space. The chance of it seriously breaking after getting a stable version out isn't very likely, so even if I were to die the next day it'd probably continue working fine.
 
Your work is appreciated and some coders might definitely take a look at it. Only keep in mind that the absolute majority here only wants minor things to be changed and they are therefore better of with copy pasting code, no matter how a software engineer thinks about that. They will never dig deeper into the scripting, they simply don't need more. At this point I have to support the opinion of Rodrigo.

The few of us who are doing more are either relaying on OSP codes like me, simply because we don't want to wrap our head around a problem which is already solved and also lack the time to think about a new solution due to our workload, or are writting their own, relaying here on the structure they already get used to since it has the better support by the rest of the community.

The handful of persons who do more than that might evaluate your work as a really good idea. We will see^^
 
Back
Top Bottom