Extra Scripting Functions

Feedback on past, current, and future development.
Klepto
Posts: 19
Joined: 16 Apr 2015, 03:56

Extra Scripting Functions

Post by Klepto »

Hello everyone.

Firstly, thank you for OpenMW and for it's being FOSS.

I'd love to play OpenMW, but it has problems with some mods I'd really rather not do without, mostly gameplay things like GCD and some MWE plugins. I have a bit of a fetish for restrictive and quirky scripting languages so I'm more than happy to write a bunch of omwaddons myself. There are some extra scripting commands that would be very useful. I'm a novice with Morrowind scripting, so please forgive me if I ask anything stupid.

While C++ is not a language I claim to know I have added commands to get base attributes and skills to my local openmw. This is very useful for a levelling mod and almost completely removes the hacky nature of such things. I imagine I may want to do something similar for health too, for state based hit points. I am of course happy to release my changes, but really, I never learned C++ :)

Another obvious thing that would be nice is a way to intercept level up. GCD simply disables the vanilla levelling system by setting all the iLevel GMSTs to zero (except iLevelTotal), and currently I'm doing the same. This works fine but has a few drawbacks. Firstly it breaks the level up meter. Secondly it has no way of telling which is a major, minor or miscellaneous skill. If I'm wrong on that last point then I'd love to know how it's done. I'm not sure quite what extra commands would best intercept level up, perhaps GetPCLevelPending and ResetPCLevel to reset the level counter? Is there a better way?

Also, is there a repository of existing omwaddons, or perhaps some kind of registry of what people are working on? I expect I'm not the only person who'd like a non-hacky GCD for OpenMW, perhaps one already exists?
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: Extra Scripting Functions

Post by pvdk »

Check out maqifrnswa's SWIG Scripting Extensions project and the wiki page on how to compile it and write scripts. Also, make sure to check out this topic about future (post 1.0) plans regarding scripting.
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: Extra Scripting Functions

Post by sjek »

great and very much welcome :D

have been tryin to get handle of morrowind scripting for dummies 9.0 but really i'm not a coder by nature.

but if you want development ideas on modder side then bethsoft forums like this guy or just a heads up ;)
http://forums.bethsoft.com/topic/150980 ... ding-mwse/

they have been working with mwse and mwe for years so they definitely ask about those first or some kinda like.

as the bug tracking go would guess merging is after 1.0 but it doesn't hurt to plan and develop it already :D
and maybe find some script bugs for 1.0 in the same.

point by point. no rush or how you like it. would definitely give building a new go for this ^^
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: Extra Scripting Functions

Post by sjek »

Ps. Or you can skip that hassle and make a pull reguest for code review or do the review part partly here but others know more about that one
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Extra Scripting Functions

Post by Zini »

@Klepto: Of course you are free to play around with these script enhancements. I would just like to point out that with the de-hardcoding planned for 1.1 and ahead all the areas you mentioned will change extensively. Most of the enhancements done now on the current backend/worldmodel will become non-viable (or at least will require a complete rework). That being said I would be more than happy with having someone helping me out with scripting enhancements once 1.0 is done (which shouldn't be too far away). I have extensive plans that actually cover pretty much everything you mentioned.
Klepto
Posts: 19
Joined: 16 Apr 2015, 03:56

Re: Extra Scripting Functions

Post by Klepto »

Thanks for the welcome and the helpful responses. I know a lot more after reading the various links provided.

While I think that the SWIG bindings are really cool, I agree with Zini's reasons for keeping them at arm's length. For my purposes all I need are a few extra commands that are pretty trivial to implement. I now realise this is a bad time for doing this, what with the very nice planned enhancements/changes to scripting post 1.0, but I'll continue anyway. Even if my minor extensions are thrown away they will allow me to do the modding part now, which is what really interests me, and then change my mods later when the features I need are supported in openmw.

I'd love to help when scripting is being overhauled, although I'm reluctant to make any commitments. I'm likely to disappear whenever I find some other obscure task that obsesses me, like writing a xmpp linux server administration tool, in busybox/ash, that sounds like fun :)

I have added GetBase<Attribute>, GetBase<Dynamic>, GetBase<Skill>, GetLevelPending and ResetLevelProgress so far. I still plan to add GetSkillType which will work in a similar way to GetArmorType, and also add openmw settings to optionally disable notifications for pending levels and skill improvements. Hopefully I'll have that done soon, at which time I'll upload to github here.

The levelling mod itself is coming along nicely. Attributes and levels are applied in the background with configurable random delays so it (optionally) takes time to learn from your experiences. It is possible to both level up and down, so if you serve time in prison your attributes will decrease in accordance with your skill decreases and your level progress will decrease too, removing levels if required. This makes prison time more of an inconvenience and less of a reason to reload.

Am I right in thinking that skills and attributes in OpenMW are already uncapped? GCD implements a skill slowdown system that effectively caps level in quite a nice way. I currently use a similar system, but I may add the forgetting of neglected skills, I'm not quite sure about that, any ideas?

Is it possible to declare globals programatically? It takes ages to put them into open-cs, I have them in my scripts as comments anyway.

Am I right in thinking that the correct way to add extra configuration options to OpenMW is to use the settings.cfg file rather than GMSTs?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Extra Scripting Functions

Post by Zini »

Is it possible to declare globals programatically? It takes ages to put them into open-cs, I have them in my scripts as comments anyway.
Nope. But if you need so many that it becomes a problem, maybe that is the issue. You could as well just put them all into a global script.
Am I right in thinking that the correct way to add extra configuration options to OpenMW is to use the settings.cfg file rather than GMSTs?
Depends on what you mean with extra configuration. I have some plans for that too (not quire finished) and it might involve GMSTs.
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: Extra Scripting Functions

Post by sjek »

Am I right in thinking that skills and attributes in OpenMW are already uncapped?
there's no problem making handtohand skill 199999 at least. same goes for attributes althought it doesn't update the attribute selection screen. capped at hundred on that. can be vanilla assests
https://bugs.openmw.org/issues/1751

for settings gmst have the benefit that it's easier to change ingame and via mod. cfg file could go kinda crowded fast with multiple mods and keeping the modifying the plugin files via cfg clean. vanilla ini weather settings are handy thought as they effect globally the basegame.

https://bugs.openmw.org/issues/2016
Attributes and levels are applied in the background with configurable random delays so it (optionally) takes time to learn from your experiences. It is possible to both level up and down, so if you serve time in prison your attributes will decrease in accordance with your skill decreases and your level progress will decrease too, removing levels if required. This makes prison time more of an inconvenience and less of a reason to reload.
that sounds nice .p any possibilty to get it to penalty the most trained / used skills like if you are a fighter the strenght and agility / endurance are getting the hit along with weapon and armor skills and with mage willpower and intelligence with alchemy and magic schools .?
GCD implements a skill slowdown system that effectively caps level in quite a nice way. I currently use a similar system, but I may add the forgetting of neglected skills, I'm not quite sure about that, any ideas?
that would make it more like a roleplaying experience and books more valuable as can't make anymore easily 100 lv all uber character : )

for implementation kinda same as previous is there a way to keep track of lv up times currently .?
maybe a gmst whitch activates everytime skill is praised and set's the counter or directly via scripts.
that would make it better as optional for playing from the start thought

ps. from attributes to stats intelligence updates magicka directly, fatigue updates on cell load and health on lv up

on gcd note
https://bugs.openmw.org/issues/2036
https://bugs.openmw.org/issues/2422 idea how that first one works .?
Klepto
Posts: 19
Joined: 16 Apr 2015, 03:56

Re: Extra Scripting Functions

Post by Klepto »

Zini wrote:
Is it possible to declare globals programatically? It takes ages to put them into open-cs, I have them in my scripts as comments anyway.
Nope. But if you need so many that it becomes a problem, maybe that is the issue. You could as well just put them all into a global script.
I only just learned I can do that. I believe I will be somewhat hampered by the inability to use the references to external locals on the right ride of assignments, unless that limitation is not present in OpenMW. As it is I have a couple of dozen globals that I'm using as configuration variables. Really I'd like to be able to feed a command line version of open-cs a file and have it output an omwaddon, but that might be a silly idea, so I won't mention it :)
Zini wrote:
Am I right in thinking that the correct way to add extra configuration options to OpenMW is to use the settings.cfg file rather than GMSTs?
Depends on what you mean with extra configuration. I have some plans for that too (not quire finished) and it might involve GMSTs.
Specifically I want to optionally disable the skill increase and level up notifications in the game, I'd like to know which is the best way to do that. You are planning to move much of the game logic out of the engine and into scripting? So things like vanilla level up would be scripted and rewriting the system would be a breeze as all the features required to do it would have to already exist.
sjek wrote:for settings gmst have the benefit that it's easier to change ingame and via mod. cfg file could go kinda crowded fast with multiple mods and keeping the modifying the plugin files via cfg clean. vanilla ini weather settings are handy thought as they effect globally the basegame.
I suppose a GMST is the way to go. I was under the (possibly false) impression that GMSTs were being used for legacy Morrowind settings and OpenMW specific settings were going in the settings files. Adding a configuration option to OpenMW isn't really part of the mod, and it should function even if the mod isn't present. I can see problems in the future with people being tempted to add mod-specific features to the engine, I expect you guys have thought about that already.
sjek wrote:
Am I right in thinking that skills and attributes in OpenMW are already uncapped?
there's no problem making handtohand skill 199999 at least. same goes for attributes althought it doesn't update the attribute selection screen. capped at hundred on that. can be vanilla assests
I have disabled the level up menu like GCD does, it's good to know I have freedom to play with my own capping mechanism.
sjek wrote:any possibilty to get it to penalty the most trained / used skills like if you are a fighter the strenght and agility / endurance are getting the hit along with weapon and armor skills and with mage willpower and intelligence with alchemy and magic schools .?
Hmm, I see what you mean. In vanilla Morrowind penalties for prison are applied randomly, I'm just taking advantage of the fact that they are skill penalties and it is skill changes that drive levelling, my own skill neglect system is disabled while in prison. I did think about weighting neglect penalties between major/minor/misc skills, I may still do that. Currently a skill that has not increased in 30 game days has a five percent chance of decreasing per day. There may be scope for ripping out the current slowdown and neglect systems and producing some elegant combined system, but I'll wait until it's working and released before I do that. As for prison, we'll see, it's a good idea.
sjek wrote:for implementation kinda same as previous is there a way to keep track of lv up times currently .?
maybe a gmst whitch activates everytime skill is praised and set's the counter or directly via scripts.
that would make it better as optional for playing from the start thought
I'm tracking skill changes in my script anyway, and yes that's just how I'm doing it (as of last night). Currently you need to start a new character to use the levelling mod, but now I can easily differentiate between major/minor/misc skills it should be possible to allow import of existing characters. The script needs to know the initial skill values at character creation in order to calculate skill slowdowns.
sjek wrote:on gcd note
https://bugs.openmw.org/issues/2036
https://bugs.openmw.org/issues/2422 idea how that first one works .?
No, I haven't a clue :) GCD is a huge inspiration, and I wouldn't play Morrowind without it. It's also is very hacky, due to the limitations of the Morrowind scripting engine. I've had many saves where my attributes got all out of whack because of GCD. The changes I have made to OpenMW are required to implement such mods in a way that isn't problematic. Speaking of which, my modified OpenMW is available on github. It seems to work fine, needs more testing, and may be horribly broken due to me not actually knowing C++.

I have added: GetBase<attribute>, GetBase<dynamic>, GetBase<skill>, GetLevelProgress, SetLevelProgress, Get<attribute>Increase, Set<attribute>Increase and GetSkillType.

Mod should be ready for first release next week.
User avatar
Greywander
Posts: 119
Joined: 04 Dec 2014, 07:01

Re: Extra Scripting Functions

Post by Greywander »

First time poster, but I've been following this project for a few months. Just wanted to chime in to say that I like what I see here. Morrowind and Oblivion have horrendous leveling systems, and I refuse to play them unmodded, with natural grow mods like GCD being my favorite leveling mods. I was actually considering trying to create my own version of GCD that was fully compatible with OpenMW, but I'm not exactly a seasoned modder.

(Actually, how difficult would it be to create OpenMW mods using the Morrowind CS? Or how soon will the OpenMW-CS be usable for mod creation? Creating a GCD clone would be a fun and educational experience. Does OpenMW remember what specialization (Combat, Magic, or Stealth) and what favored attributes you chose at character creation? Because that would make it much easier to implement a GCD-like system on an existing save file, not to mention other modding possibilities.)

I might go so far as to say that alternate leveling systems should be one of the first things the OpenMW team does after 1.0, since it's such a core part of the game and vanilla leveling is so bad (in my opinion at least, as I tend to be OCD about getting perfect level ups, but YMMV). That said, though, it should be possible to fix up GCD to be fully compatible with OpenMW, assuming the mod license allows it, or to write a mod from scratch that does the same thing.

In general, I'm really looking forward to the modding potential of OpenMW. In theory (beyond 1.0), it could be for open world sandbox RPGs something like what RPG Maker is for 2D JRPGs: a highly flexible, powerful, and easy to use tool, albeit only for creating a very specific type of game.
Post Reply