Lua scripting getting started

Post about your mods, learn about OpenMW mod compatibility, check for problematic mods, discuss issues, and give us feedback about your experience with modded OpenMW.
JimmyTang0055
Posts: 3
Joined: 19 May 2022, 01:51

Lua scripting getting started

Post by JimmyTang0055 »

I was going though the documentation https://openmw.readthedocs.io/en/latest ... rview.html
the doc mentions in the first code snip to save the file here
-- Save to my_lua_mod/example/player.lua

does that mean i would make a folder in here
C:\Users\somone\Documents\My Games\OpenMW\data1
called my_lua_mod
then in that
example
then in that
player.lua
?
LoneWolf
Posts: 98
Joined: 26 Sep 2017, 19:13

Re: Lua scripting getting started

Post by LoneWolf »

The file would be called player.lua located in folder my_lua_mod, subfolder example .

The my_lua_mod folder can be created everywhere you have full access, but it helps to use descriptive names.

I wouldn't put it under data1 but use something else.
JimmyTang0055
Posts: 3
Joined: 19 May 2022, 01:51

Re: Lua scripting getting started

Post by JimmyTang0055 »

thank you for the response
i've tried a little more but am having an issue

file structure
C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\Test\Player.lua
C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\Test\Player.omwscripts

Player.omwscripts contents
PLAYER: Test/Player.lua

Player.lua is a copy paste from the tutorial

openmw.cfg entries
data="C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\Test\"
content=Player.omwscripts

error
Cannot load file C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\Test\Player.omwscripts
Last edited by JimmyTang0055 on 26 May 2022, 01:00, edited 1 time in total.
LoneWolf
Posts: 98
Joined: 26 Sep 2017, 19:13

Re: Lua scripting getting started

Post by LoneWolf »

The documentation doesn't have an overview of the structure used for lua mods , but carefully reading it I think I understand which should go where.

Put Player.omwscripts in LuaMods folder .

use C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods as data path in openmw.cfg
JimmyTang0055
Posts: 3
Joined: 19 May 2022, 01:51

Re: Lua scripting getting started

Post by JimmyTang0055 »

I have adjusted as directed. Unfortunately, it is the same error.
Maybe there is something in the latest release of openmw that is no longer compatible with the script from their tutorial pages? I mean, it looks like a pretty simple script but who knows what the functions are doing behind the scenes.
I know in skyrim SKSE was a prereq for just about everything is there something similar in OpenMW land that i should have loaded?
Loriel
Posts: 175
Joined: 28 May 2015, 00:44

Re: Lua scripting getting started

Post by Loriel »

The error message appears to indicate a faulty filepath, and I think LoneWolf's suggestion should be the correct version.

I produced similar error messages when my filepath contained typoes, and the example program worked when I used the correct filepath and filename. Unfortunately I use Linux rather than Windows, so I can't check that your/LoneWolf's filepath would work for me.

Loriel
JimmyTang0055
Posts: 3
Joined: 19 May 2022, 01:51

Re: Lua scripting getting started

Post by JimmyTang0055 »

so i have a little more info.
when i launch this one "openmw-launcher.exe" it modifies my openmw.cfg file and removes the entry "content=Player.omwscripts"
however, when i launch tes3mp.exe i get the error mentioned previously [this is after re-adding content=Player.omwscripts to openmw.cfg].

openmw.cfg also contains the line
data="C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\"
...but this is not removed

folder structure:
C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\Player.omwscripts
C:\Users\someone\Documents\My Games\OpenMW\data2\LuaMods\Test\Player.lua

contents of Player.omwscripts
PLAYER: Test/Player.lua

looks like someone else had something similar happening here:https://www.reddit.com/r/OpenMW/comment ... reverting/
the response seemed to be similar to this issue- messed up path. which is why i included all the path info above. To me, it looks good. I will keep fiddling.
Loriel
Posts: 175
Joined: 28 May 2015, 00:44

Re: Lua scripting getting started

Post by Loriel »

You appear to be using tes3mp - this may have different requirements for LUA.

I only use OpenMW, so can't comment on any such differences.

Loriel
LoneWolf
Posts: 98
Joined: 26 Sep 2017, 19:13

Re: Lua scripting getting started

Post by LoneWolf »

atm lua support is only available in trunk versions of openmw (sometimes called nightlies) .

I think tes3mp has it's own lua implementation, but that's not compatible with openmw.
(maybe tes3mp will support openmw lua when it bases of 0.48 in the near future) .
JimmyTang0055
Posts: 3
Joined: 19 May 2022, 01:51

Re: Lua scripting getting started

Post by JimmyTang0055 »

So here is my confusion
the package i downloaded from here
https://github.com/TES3MP/TES3MP/releases
contained a tes3mp server exe file.
It appeared to also contain 2 client exe files. one for tes3mp and one for openmw.
now before adding any mods, i was able to use either client to connect to the tes3mp server
I was able to add several mods and get everything working (all esp and esm types)
lua mods no luck.

is the tes3mp server intended to work with both the openmw client as well as the tes3mp client?

I think i've made a little headway. I've noticed the openMW launcher has a little pocket knife where you can go in and select plugins.
the only things i see listed are file types .esp and .esm. i dont see the .lua files anywhere in the list. even though i've added the proper entries to the openmw.cfg file as already discussed. Would this be the reason the openmw launcher removes the entry when it tries to run?

i guess i would wonder if i could imbed lua scripts inside of esp or esm files to get around this?
Last edited by JimmyTang0055 on 03 Jun 2022, 00:33, edited 1 time in total.
Post Reply