operating system

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
RayB
Posts: 116
Joined: Fri Mar 06, 2015 3:45 am

operating system

Post by RayB » Tue May 26, 2020 5:21 pm

Is there any way to access system or DOS/WINDOWS commands in a scipt or .lua file?

I have been looking at the lua programming reference manual and according to it, the way to do this is with a call like...
**** os.execute("mkdir " .. dirname) **** (taken from an example in the manual). However, the dungeon editor does not like it !

It says global 'os' is a nil value.

Is there any other way to do this? I would like to use the DOS cd (change directory) command.

User avatar
Isaac
Posts: 2943
Joined: Fri Mar 02, 2012 10:02 pm

Re: operating system

Post by Isaac » Tue May 26, 2020 8:36 pm

The os library is not part of the Grimrock titles; afaik. It is certainly not something the developers want user mods to access.

That said, I have read of engine mistakes in the game, that allow this—but it's not something I have experience with.

The [one?] benign use for it is to allow mod-patching of individual files without having to download the whole .dat file again. But the risks would seem to outweigh the benefits; one could no longer trust usermods.

Zo Kath Ra
Posts: 827
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: operating system

Post by Zo Kath Ra » Wed May 27, 2020 1:16 pm

RayB wrote:
Tue May 26, 2020 5:21 pm
Is there any other way to do this? I would like to use the DOS cd (change directory) command.
I have no idea how to do this, but I'm curious what you want to do with the CD command.

RayB
Posts: 116
Joined: Fri Mar 06, 2015 3:45 am

Re: operating system

Post by RayB » Sun May 31, 2020 2:32 am

My computer is not the fastest and the mod takes forever to load and run in the dungeon editor. I decided to create a duplicate mod with just the levels I was interrogating. I created a Twisted Forest dungeon with just the Twisted Forest levels in it. My Twisted Forest dungeon editor file is in the same place as the ORRR3 file so they will both show in the open file dialog box in the dungeon editor.
In the mod_assets folder I created a Twisted Forest folder for my dungeon.lua and init.lua files which is, of course, the same as the original but with only the Twisted Forest and its lower levels, thus keeping the two dungeon.lua files seperate. I was able to access my folder OK by changing the last line of the editor file to ...
dungeonFolder "mod_assets/Twisted Forest" as opposed to dungeonFolder "mod_assets/"
This works fine for pointing to my dungeon.lua and init.lua files but all of the paths in the init file are trying to load from the mod_assets folder.

Rather than copying all the files into my Twisted Forest folder and using up all the disk space, I thought if I could (in my init file) simply change the directory up one (ie. cd ..), I could just use all the original files.

User avatar
Isaac
Posts: 2943
Joined: Fri Mar 02, 2012 10:02 pm

Re: operating system

Post by Isaac » Sun May 31, 2020 4:00 am

The editor allows to disable level maps. The one catch is that disabling levels with script_entities on them causes them to not exist for the preview. This can be alleviated by putting all of your important scripts on the same level, and never disabling that one.

In the editor preview, traveling to a disabled level just gives you a black/empty map. The performance gain for working/previewing just a few maps (with many disabled), is that it does not have to evaluate those maps in the preview. While this cannot speed up the initial load of the project, it can greatly speed up working & previewing individual maps. For instance, when I was working on ORRR3, I would disable all maps other than the first one (for scripts), and the map I was editing. That greatly improved start & stop time for the preview.

Click on the orange dots next to the levels to enable or disable them. You use CTRL + click to disable all but one level, and/or use SHIFT + click to toggle a map on or off.
Image


*Unfortunately this state change does not get recorded when saving the project, so must be done each time you reload.

RayB
Posts: 116
Joined: Fri Mar 06, 2015 3:45 am

Re: operating system

Post by RayB » Sun May 31, 2020 2:33 pm

Thank you

Post Reply