Scripting fixes and enhancements

Feedback on past, current, and future development.
Post Reply
Danjb
Posts: 16
Joined: 04 Dec 2014, 10:09

Scripting fixes and enhancements

Post by Danjb »

Hello,

Like many others, I have been following this project for some time as a long-time Morrowind player and modder. I am also a professional software developer and hobbyist game developer, so I may get involved at some stage, but that is not the purpose of this thread!

Morrowind had a LOT of problems and limitations with its scripting language, as I'm sure most people are aware. Some functions, despite being documented, were just straight-up broken. I can't remember all of these problems right now, but I will consult MWSFD later and edit this post. I know a lot of improvements have been made already to the script compiler, but would it be possible for some of these supposed in-built functions to be fixed?
  • References Persist
    One limitation I recall is to do with persistent references, although this isn't strictly a scripting problem. For my Private Stash mod, I wanted a container that could be activated from anywhere, anytime. However, even objects with the "References Persist" flag enabled cannot always be referenced from scripts. IIRC, you first have to go to the cell containing the object so that it gets loaded, but then it automatically gets un-loaded after 72 game hours, or when you quit the game. This makes the "References Persist" feature quite limited. Suggested change: if a script references a persistent object that's not currently loaded -- load it!
  • Closing dialogue menu with MenuTest
    Currently this function can be used to close the inventory and some other menus, but not the dialogue menu.
Thanks,
Danjb
Last edited by Danjb on 04 Dec 2014, 14:56, edited 2 times in total.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting fixes and enhancements

Post by Zini »

OpenMW ignores the references persist flag completely. And you already can access any reference in any cell not matter if it was loaded or not.
Danjb
Posts: 16
Joined: 04 Dec 2014, 10:09

Re: Scripting fixes and enhancements

Post by Danjb »

Ideal! That should open up some modding possibilities.

I had a quick look through MWSFD but it looks like most of the problems I remember were actually caused by the problems with "References Persist".

Should that be added to the Features wiki page?
User avatar
dEnigma
Posts: 248
Joined: 24 Nov 2013, 21:24
Location: Hla Oad

Re: Scripting fixes and enhancements

Post by dEnigma »

Danjb wrote:Hello,
  • Closing dialogue menu with MenuTest
    Currently this function can be used to close the inventory and some other menus, but not the dialogue menu.
I've seen mods use the "ToggleMenu" command twice to close dialogue windows (e.g. Abot's Siltstriders), which was implemented into OpenMW recently (the dialogue closing functionality, ToggleMenus was implemented a long time ago).
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Scripting fixes and enhancements

Post by Zini »

Should that be added to the Features wiki page?
Maybe. We would need a new category though (either that or Misc), because this is actually not a scripting issue.
Danjb
Posts: 16
Joined: 04 Dec 2014, 10:09

Re: Scripting fixes and enhancements

Post by Danjb »

Added to the Misc section for the time being.
BungaDunga
Posts: 3
Joined: 07 Jul 2012, 04:50

Re: Scripting fixes and enhancements

Post by BungaDunga »

Hey, persistent containers was my thing! I wrote a mod that let you carry containers around. The reference died over savegames, so there were two workarounds:

1. Teleport the player to the container
2. Script-activate the container
3. Teleport the player back.

3 was the hard part because PositionCell doesn't take variable arguments (insanity, but there you go). The solution that works outside in plain MW is to teleport the player close enough to load his cell with a massive if/else construct (can't take credit for that one, I had help) and SetPos the player to where he started. Doesn't work inside; for that you need MWSE's xPositionCellwhich works like a sane function.
Danjb
Posts: 16
Joined: 04 Dec 2014, 10:09

Re: Scripting fixes and enhancements

Post by Danjb »

Nice! I do vaguely remember someone in the CS forum explaining to me the difficulties of persistent containers, and the need for the massive if-else construct you described (may even have been you!).

My mod adds "Private Stashes" to various locations around Morrowind which all share the same inventory, so you can access your stuff from all around the world.

I used a similar method to workaround the references problem, where the player would activate an item in his inventory to teleport to a special cell containing a key, and activating the key would teleport the player back to his original location and enable him to access the stash. Sort of like he's "unlocking" it.

Somehow I got away without the need for the massive if-else construct; I think maybe I just used SetPos (although whether that means my mod would crash if the player saved and loaded the game while in the "key" cell, I don't know!). And because all the stashes were outside, I didn't have to worry about teleporting the player back to an interior cell. I never did figure out how to restore the player's facing angle, though.

Needless to say, mods like these will be a lot better in OpenMW!

Another broken function: CellUpdate. Sounds like it would have been really useful in vanilla MW but maybe isn't needed in OpenMW.
Post Reply