Página 1 de 1

[MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader

Enviado: 08 Ago 2020, 18:46
por HzanRsxa2959
Note: If not working with AutoID3000 3002 or later, refer to here.

Hey guys.
Since the blokes at GTAForums have trouble figuring out whether to approve my topic or not (not their fault, the topic I wrote was a mess), I suppose I should also post here. Besides, there are more known lua coders here than there, and their feedback will be invaluable. Anyways, presenting:

___SearchModLoaderLog

Description:
This is a lua script that is mainly for lua coders, like a plugin.
It creates and stores a table of all the files that were found by Mod Loader but not loaded. It does so by reading the modloader.log file and matching the text strings. Then, the list, along with a couple functions, is exported for use by other lua scripts. The best thing is that it supports profiles, ignored mods, exclusive mods, and most features of Mod Loader, excluding priority.

Requirements:
MoonLoader
Mod Loader


Download:
1.0
1.1
1.2
1.3

Note: The script file is intentionally named with three underscores so that it is loaded before other scripts. Changing the file name may result in errors.

Installation Instructions

Mods Using this Script:
[MOON/MoonLoader] Load Scripts from Mod Loader

Usage:
Here is an example how lua coders can use this in their scripts:
___SearchModLoaderLog - Test.lua:

Código: Selecionar tudo

script_author("HzanRsxa2959")
script_version("1.0")
script_description("Test script for ___SearchModLoaderLog.")
script_properties("work-in-pause")
script_dependencies("___SearchModLoaderLog")

--imported data:
--table files
--function filterFiles
    --filters table of files based on extension(s) and subfolders(s)
    --syntax: table filtered = filterFiles(string extension / table extensions [, string subfolder / table subfolders, table list])
        --if table is not given, then it will filter the default table
--function getParentPath
    --gets the parent path of a directory, seems like a handy function so I included it
    --syntax: string parentpath = getParentPath(string path)

local smdl = import("___SearchModLoaderLog.lua") --import data

print("Starting.")

local extensions = {"hzn", "hzan"}
local subfolders = {"hzn", "hzan"}

local files = smdl.filterFiles(extensions, subfolder) --filter out files from default table with extension 'hzn' or 'hzan' inside subfolders named 'hzn' or 'hzan'

for i, file in ipairs(files)do --loop through table
    print("found file", file) --print found files
end

print("total files:", #files) --print total files

print("Done.")

--exit

P.S.:
I am really proud of this, and I hope you guys can find some use out of this. In my opinion, modding capabilities for lua have just multiplied. I will post some scripts that make use of this to show you guys more of its potential.

Credits:
HzanRsxa2959,
with help from StackOverflow

Re: [MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader

Enviado: 14 Ago 2020, 20:04
por HzanRsxa2959
Update!

1.1:
  1. Fixed the subfolders argument not being optional.
  2. Fixed case sensitivity for folder search. Now it will not matter.
Just a small update that fixed bugs I noticed while using it. Any more suggestions and bug reports welcome!

Re: [MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader

Enviado: 29 Set 2020, 13:38
por HzanRsxa2959
Update 1.2:
  • Removed ini check for Mod Loader log as it caused an error on MoonLoader version 0.26.
  • MoonLoader working directory inside Mod Loader will be skipped, i.e., you can install MoonLoader with Mod Loader and the mod will skip that directory. A warning message will be printed to moonloader.log with the skipped directory.
Another small update after a long time. It's rare to find bugs since nobody uses it.

Re: [MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader

Enviado: 30 Set 2020, 07:01
por HzanRsxa2959
Not required, but recommended.

Installation Instructions:
Make sure that you have installed the requirements and run the game at least once.
Navigate to your game directory\modloader\.data\
Open config.ini with a text editor.
Under the [Config] section, change the given keys to the values shown below:

Código: Selecionar tudo

EnableLog         = true
ImmediateFlushLog = true
MaxLogSize        = 20971520
Note: MaxLogSize value is set to 20MB. If your value is greater than the one given here, then leave it.

Thanks to Junior_Djjr for pointing out the log file size concern.

Re: [MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader

Enviado: 08 Nov 2020, 15:35
por HzanRsxa2959
Update 1.3:
Fixed a bug that caused files inside the MoonLoader directory to be loaded when MoonLoader was installed inside Mod Loader.

EDIT: Fixed wrong link.

Re: [MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader

Enviado: 06 Fev 2022, 10:58
por HzanRsxa2959
Note: If not working with AutoID3000 3002 or later, refer to here.